1 class ScrollPanelsController < 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 => [
7 :index, :show, :by_panel, :by_scroll, :by_author, :play, :count, :count_by_panel, :count_by_scroll, :count_by_author, :play
9 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
10 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
39 respond_to do |format|
40 show_prof_format format
41 format.json { render json: @item.to_json }
74 @my_model_class = self.class.model
75 @item = @my_model_class.new
77 @item.attributes = params[@item.item_name]
78 @item.overwrite @operators
79 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
80 @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
82 leaf_render_create play_scroll_path(@binder)
86 @my_model_class = self.class.model
87 @item = @my_model_class.edit(params[:id], @operators)
89 @item.attributes = params[@item.item_name]
90 @item.overwrite @operators
91 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
92 # no check permission for destination
93 # swapable hidden panel
94 #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
96 leaf_render_update ot, play_scroll_path(@binder)
100 @scroll_panel = ScrollPanel.edit(params[:id], @operators)
101 @scroll = Scroll.edit(@scroll_panel.scroll_id, @operators) if @scroll_panel.scroll_id
102 respond_to do |format|
103 if @scroll_panel.destroy_and_shorten
104 flash[:notice] = I18n.t('flash.notice.destroyed', :model => ScrollPanel.model_name.human)
105 format.html { redirect_to play_scroll_path(@scroll) }
106 format.json { head :ok }
108 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => ScrollPanel.model_name.human)
109 format.html { redirect_to scroll_panel_path(@scroll_panel) }
110 format.json { render json: @scroll_panel.errors, status: :unprocessable_entity }