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]
35 respond_to do |format|
36 show_prof_format format
37 format.json { render json: @item.to_json }
70 @my_model_class = self.class.model
71 @item = @my_model_class.new
73 @item.attributes = params[@item.item_name]
74 @item.overwrite @operators
75 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
76 @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
78 leaf_render_create play_scroll_path(@binder)
82 @my_model_class = self.class.model
83 @item = @my_model_class.edit(params[:id], @operators)
85 @item.attributes = params[@item.item_name]
86 @item.overwrite @operators
87 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
88 # no check permission for destination
89 # swapable hidden panel
90 #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
92 leaf_render_update ot, play_scroll_path(@binder)
96 @scroll_panel = ScrollPanel.edit(params[:id], @operators)
97 @scroll = Scroll.edit(@scroll_panel.scroll_id, @operators) if @scroll_panel.scroll_id
98 respond_to do |format|
99 if @scroll_panel.destroy_and_shorten
100 flash[:notice] = I18n.t('flash.notice.destroyed', :model => ScrollPanel.model_name.human)
101 format.html { redirect_to play_scroll_path(@scroll) }
102 format.json { head :ok }
104 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => ScrollPanel.model_name.human)
105 format.html { redirect_to scroll_panel_path(@scroll_panel) }
106 format.json { render json: @scroll_panel.errors, status: :unprocessable_entity }