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
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
46 @my_model_class = self.class.model
47 @item = @my_model_class.new
49 @item.attributes = params[@item.item_name]
50 @item.overwrite @operators
51 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
52 @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
54 leaf_render_create play_story_path(@binder)
58 @my_model_class = self.class.model
59 @item = @my_model_class.edit(params[:id], @operators)
61 @item.attributes = params[@item.item_name]
62 @item.overwrite @operators
63 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
64 # no check permission for destination
65 # swapable hidden panel
66 #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
68 leaf_render_update ot, play_story_path(@binder)
72 @story_sheet = StorySheet.edit(params[:id], @operators)
73 @story = Story.edit(@story_sheet.story_id, @operators) if @story_sheet.story_id
74 respond_to do |format|
75 if @story_sheet.destroy_and_shorten
76 flash[:notice] = I18n.t('flash.notice.destroyed', :model => StorySheet.model_name.human)
77 format.html { redirect_to play_story_path(@story) }
78 format.json { head :ok }
80 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => StorySheet.model_name.human)
81 format.html { redirect_to story_sheet_path(@story_sheet) }
82 format.json { render json: @story_sheet.errors, status: :unprocessable_entity }