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, :count, :count_by_panel, :count_by_scroll, :count_by_author
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.scroll_panel_as_json(@operators.author) }
66 @scroll_panel = ScrollPanel.new
67 @scroll_panel.supply_default
68 @scroll_panel.attributes = params[:scroll_panel]
69 @scroll_panel.overwrite @operators
70 @scroll = Scroll.edit(@scroll_panel.scroll_id, @operators) if @scroll_panel.scroll_id
71 @panel = Panel.show(@scroll_panel.panel_id, @operators) if @scroll_panel.panel_id
73 respond_to do |format|
74 if @scroll_panel.store @operators
75 flash[:notice] = I18n.t('flash.notice.created', :model => ScrollPanel.model_name.human)
76 format.html { redirect_to play_scroll_path(@scroll) }
77 format.json { render json: @scroll_panel.scroll_panel_as_json(@operators.author) }
79 flash[:notice] = I18n.t('flash.notice.not_created', :model => ScrollPanel.model_name.human)
80 format.html { render action: "new" }
81 format.json { render json: @scroll_panel.errors, status: :unprocessable_entity }
87 @scroll_panel = ScrollPanel.edit(params[:id], @operators)
89 @scroll_panel.attributes = params[:scroll_panel]
90 @scroll_panel.overwrite @operators
91 @scroll = Scroll.edit(@scroll_panel.scroll_id, @operators) if @scroll_panel.scroll_id
92 respond_to do |format|
93 if @scroll_panel.store @operators, ot
94 flash[:notice] = I18n.t('flash.notice.updated', :model => ScrollPanel.model_name.human)
95 format.html { redirect_to play_scroll_path(@scroll) }
96 format.json { head :ok }
98 flash[:notice] = I18n.t('flash.notice.not_updated', :model => ScrollPanel.model_name.human)
99 format.html { render action: "edit" }
100 format.json { render json: @scroll_panel.errors, status: :unprocessable_entity }
106 @scroll_panel = ScrollPanel.edit(params[:id], @operators)
107 @scroll = Scroll.edit(@scroll_panel.scroll_id, @operators) if @scroll_panel.scroll_id
108 respond_to do |format|
109 if @scroll_panel.destroy_and_shorten
110 flash[:notice] = I18n.t('flash.notice.destroyed', :model => ScrollPanel.model_name.human)
111 format.html { redirect_to play_scroll_path(@scroll) }
112 format.json { head :ok }
114 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => ScrollPanel.model_name.human)
115 format.html { redirect_to scroll_panel_path(@scroll_panel) }
116 format.json { render json: @scroll_panel.errors, status: :unprocessable_entity }