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
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 }
76 @item = @my_model_class.new
78 @my_model_class.fold_extend_settings params[@my_model_class.item_name]
79 @item.attributes = params[@my_model_class.item_name]
80 @item.overwrite @operators
86 @my_model_class.fold_extend_settings params[@my_model_class.item_name]
87 @item.attributes = params[@my_model_class.item_name]
88 @item.overwrite @operators
93 @item = Comic.edit(params[:id], @operators)
94 respond_to do |format|
95 if @item.destroy_with_leafs
96 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
97 format.html { redirect_to '/home/comics' }
98 format.json { head :ok }
100 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
101 format.html { redirect_to @item }
102 format.json { render json: @item.errors, status: :unprocessable_entity }