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 @comic_story = ComicStory.new
67 @comic_story.supply_default
68 @comic_story.attributes = params[:comic_story]
69 @comic_story.overwrite @operators
70 @comic = Comic.edit(@comic_story.comic_id, @operators) if @comic_story.comic_id
71 @story = Story.show(@comic_story.story_id, @operators) if @comic_story.story_id
73 respond_to do |format|
74 if @comic_story.store @operators
75 flash[:notice] = I18n.t('flash.notice.created', :model => ComicStory.model_name.human)
76 format.html { redirect_to play_comic_path(@comic) }
77 format.json { render json: @comic_story.comic_story_as_json(@operators.author) }
79 flash[:notice] = I18n.t('flash.notice.not_created', :model => ComicStory.model_name.human)
80 format.html { render action: "new" }
81 format.json { render json: @comic_story.errors, status: :unprocessable_entity }
87 @comic_story = ComicStory.edit(params[:id], @operators)
89 @comic_story.attributes = params[:comic_story]
90 @comic_story.overwrite @operators
91 @comic = Comic.edit(@comic_story.comic_id, @operators) if @comic_story.comic_id
92 respond_to do |format|
93 if @comic_story.store @operators, ot
94 flash[:notice] = I18n.t('flash.notice.updated', :model => ComicStory.model_name.human)
95 format.html { redirect_to play_comic_path(@comic) }
96 format.json { head :ok }
98 flash[:notice] = I18n.t('flash.notice.not_updated', :model => ComicStory.model_name.human)
99 format.html { render action: "edit" }
100 format.json { render json: @comic_story.errors, status: :unprocessable_entity }
106 @comic_story = ComicStory.edit(params[:id], @operators)
107 @comic = Comic.edit(@comic_story.comic_id, @operators) if @comic_story.comic_id
108 respond_to do |format|
109 if @comic_story.destroy_and_shorten
110 flash[:notice] = I18n.t('flash.notice.destroyed', :model => ComicStory.model_name.human)
111 format.html { redirect_to play_comic_path(@comic) }
112 format.json { head :ok }
114 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => ComicStory.model_name.human)
115 format.html { redirect_to comic_story_path(@comic_story) }
116 format.json { render json: @comic_story.errors, status: :unprocessable_entity }