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)
49 list_result = @list.open(@operators,
50 {:id => params[:id], :offset => params[:offset], :count => params[:count]}
52 @items = list_result.items
53 respond_to do |format|
55 #@count = @action.list.count @item
56 #@prev_offset = @action.list.prev_offset @item
57 #@next_offset = @action.list.next_offset @item
59 @new_panel_items = assist_items('panel', 'private')
60 #@new_panel_filer = assist_filer 'panel', @new_panel_items
63 format.json { render json: @items.to_json(self.class.model.list_json_opt) }
90 @item = @my_model_class.new
92 @item.attributes = params[@my_model_class.item_name]
93 @item.overwrite @operators
100 @item.attributes = params[@my_model_class.item_name]
101 @item.overwrite @operators
106 @item = Scroll.edit(params[:id], @operators)
107 respond_to do |format|
108 if @item.destroy_with_leafs
109 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Scroll.model_name.human)
110 format.html { redirect_to '/home/scrolls' }
111 format.json { head :ok }
113 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Scroll.model_name.human)
114 format.html { redirect_to @item }
115 format.json { render json: @item.errors, status: :unprocessable_entity }