1 class ComicsController < 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, :play, :by_story, :by_author, :count, :count_by_story, :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]
29 def show_html_format format
31 play_list = Locmare::ListGroup.list 'comic_story', 'play'
32 @play_count = play_list.count(@operators,
33 {:id => @item.id, :my_play => @item.own?(@operators)}
40 respond_to do |format|
41 show_html_format format
42 show_prof_format format
43 show_json_format format
50 @item = self.class.model.show(params[:id], @operators)
52 @items = @list.items(@operators,
53 {:id => params[:id], :my_play => @item.own?(@operators)},
58 respond_to do |format|
60 if @item.own? @operators
61 @new_story_items = assist_items('story', 'private')
64 format.json { render json: @items.to_json }
90 @item = @my_model_class.new
92 @my_model_class.fold_extend_settings params[@my_model_class.item_name]
93 @item.attributes = params[@my_model_class.item_name]
94 @item.overwrite @operators
100 @my_model_class.fold_extend_settings params[@my_model_class.item_name]
101 @item.attributes = params[@my_model_class.item_name]
102 @item.overwrite @operators
107 @item = Comic.edit(params[:id], @operators)
108 respond_to do |format|
109 if @item.destroy_with_leafs
110 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
111 format.html { redirect_to '/home/comics' }
112 format.json { head :ok }
114 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
115 format.html { redirect_to @item }
116 format.json { render json: @item.errors, status: :unprocessable_entity }