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]
25 def show_html_format format
27 play_list = Locmare::ListGroup.list(
28 'comic_stories', 'by_comic', @operators,
29 {:id => @item.id, :my_play => @item.own?(@operators)}
31 @play_count = play_list.count(@operators)
37 respond_to do |format|
38 show_html_format format
39 show_prof_format format
40 show_json_format format
48 @list = Locmare::ListGroup.list(
50 @my_action.name, @operators,
51 {:id => @item.id, :offset => 0, :limit => -1}# no limit
53 @items = @list.items(@operators)
54 @count = @list.count @operators
56 respond_to do |format|
58 if @item.own? @operators
59 @new_story_items = assist_items('home', 'stories')
62 format.json { render json: @items.to_json }
88 @item = @my_model_class.new
90 @my_model_class.fold_extend_settings params[@my_model_class.item_name]
91 @item.attributes = params[@my_model_class.item_name]
92 @item.overwrite @operators
98 @my_model_class.fold_extend_settings params[@my_model_class.item_name]
99 @item.attributes = params[@my_model_class.item_name]
100 @item.overwrite @operators
105 @item = Comic.edit(params[:id], @operators)
106 respond_to do |format|
107 if @item.destroy_with_leafs
108 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
109 format.html { redirect_to '/home/comics' }
110 format.json { head :ok }
112 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
113 format.html { redirect_to @item }
114 format.json { render json: @item.errors, status: :unprocessable_entity }