1 class StorySheetsController < 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_story, :by_sheet, :by_author, :count, :count_by_story, :count_by_sheet, :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]
31 respond_to do |format|
32 show_prof_format format
33 show_json_format format
62 @my_model_class = self.class.model
63 @item = @my_model_class.new
65 @item.attributes = params[@item.item_name]
66 @item.overwrite @operators
67 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
68 @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
70 leaf_render_create play_scroll_path(@binder)
74 @my_model_class = self.class.model
75 @item = @my_model_class.edit(params[:id], @operators)
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 # no check permission for destination
81 # swapable hidden panel
82 #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
84 leaf_render_update ot, play_scroll_path(@binder)
88 @story_sheet = StorySheet.edit(params[:id], @operators)
89 @story = Story.edit(@story_sheet.story_id, @operators) if @story_sheet.story_id
90 respond_to do |format|
91 if @story_sheet.destroy_and_shorten
92 flash[:notice] = I18n.t('flash.notice.destroyed', :model => StorySheet.model_name.human)
93 format.html { redirect_to play_story_path(@story) }
94 format.json { head :ok }
96 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => StorySheet.model_name.human)
97 format.html { redirect_to story_sheet_path(@story_sheet) }
98 format.json { render json: @story_sheet.errors, status: :unprocessable_entity }