1 class ScrollsController < ApplicationController
2 if Manifest.manifest.magic_numbers['run_mode'] == 0
3 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
4 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
6 before_filter :authenticate_reader, :only => [:top, :index, :show, :play, :by_author, :by_panel]
7 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
8 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
27 def show_html_format format
31 @new_panel_items = assist_items('panel', 'private')
32 #@new_panel_filer = assist_filer 'panel', @new_panel_items
39 respond_to do |format|
40 show_html_format format
41 show_prof_format format
42 show_json_format format
47 @item = self.class.model.show(params[:id], @operators)
48 action_name = params[:action]
49 @action = self.class.controller.open(action_name, params, @operators)
50 @items = @action.list.items @item
51 respond_to do |format|
53 @count = @action.list.count @item
54 @prev_offset = @action.list.prev_offset @item
55 @next_offset = @action.list.next_offset @item
57 @new_panel_items = assist_items('panel', 'private_list')
58 @new_panel_filer = assist_filer 'panel', @new_panel_items
61 format.json { render json: @items.to_json(self.class.model.list_json_opt) }
88 @item.attributes = params[:scroll]
89 @item.overwrite @operators
92 respond_to do |format|
93 flash[:notice] = I18n.t('flash.notice.created', :model => Scroll.model_name.human)
94 format.html { redirect_to @item }
95 format.json { render json: @item.to_json(Scroll.show_json_opt), status: :created, location: @item }
98 flash[:notice] = I18n.t('flash.notice.not_created', :model => Scroll.model_name.human)
100 format.html { render action: "new" }
101 format.json { render json: @item.errors, status: :unprocessable_entity }
106 @item = Scroll.edit(params[:id], @operators)
107 @item.attributes = params[:scroll]
108 @item.overwrite @operators
109 respond_to do |format|
111 flash[:notice] = I18n.t('flash.notice.updated', :model => Scroll.model_name.human)
112 format.html { redirect_to @item }
113 format.json { head :ok }
115 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Scroll.model_name.human)
116 format.html { render action: "edit" }
117 format.json { render json: @item.errors, status: :unprocessable_entity }
123 @item = Scroll.edit(params[:id], @operators)
124 respond_to do |format|
125 if @item.destroy_with_scroll_panel
126 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Scroll.model_name.human)
127 format.html { redirect_to '/home/scrolls' }
128 format.json { head :ok }
130 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Scroll.model_name.human)
131 format.html { redirect_to @item }
132 format.json { render json: @item.errors, status: :unprocessable_entity }