1 class ComicStoriesController < 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_comic, :by_author, :count, :count_by_story, :count_by_comic, :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.comic_story_as_json(@operators.author) }
66 @my_model_class = self.class.model
67 @item = @my_model_class.new
69 @item.attributes = params[@item.item_name]
70 @item.overwrite @operators
71 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
72 @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
74 leaf_render_create play_scroll_path(@binder)
78 @my_model_class = self.class.model
79 @item = @my_model_class.edit(params[:id], @operators)
81 @item.attributes = params[@item.item_name]
82 @item.overwrite @operators
83 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
84 # no check permission for destination
85 # swapable hidden panel
86 #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
88 leaf_render_update ot, play_scroll_path(@binder)
92 @comic_story = ComicStory.edit(params[:id], @operators)
93 @comic = Comic.edit(@comic_story.comic_id, @operators) if @comic_story.comic_id
94 respond_to do |format|
95 if @comic_story.destroy_and_shorten
96 flash[:notice] = I18n.t('flash.notice.destroyed', :model => ComicStory.model_name.human)
97 format.html { redirect_to play_comic_path(@comic) }
98 format.json { head :ok }
100 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => ComicStory.model_name.human)
101 format.html { redirect_to comic_story_path(@comic_story) }
102 format.json { render json: @comic_story.errors, status: :unprocessable_entity }