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
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 format.json { render json: @item.to_json }
50 @my_model_class = self.class.model
51 @item = @my_model_class.new
53 @item.attributes = params[@item.item_name]
54 @item.overwrite @operators
55 @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
56 @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
58 leaf_render_create play_scroll_path(@binder)
62 @my_model_class = self.class.model
63 @item = @my_model_class.edit(params[:id], @operators)
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 # no check permission for destination
69 # swapable hidden panel
70 #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
72 leaf_render_update ot, play_scroll_path(@binder)
76 @comic_story = ComicStory.edit(params[:id], @operators)
77 @comic = Comic.edit(@comic_story.comic_id, @operators) if @comic_story.comic_id
78 respond_to do |format|
79 if @comic_story.destroy_and_shorten
80 flash[:notice] = I18n.t('flash.notice.destroyed', :model => ComicStory.model_name.human)
81 format.html { redirect_to play_comic_path(@comic) }
82 format.json { head :ok }
84 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => ComicStory.model_name.human)
85 format.html { redirect_to comic_story_path(@comic_story) }
86 format.json { render json: @comic_story.errors, status: :unprocessable_entity }