1 class StoriesController < 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_comic, :by_sheet, :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(
32 'story_sheets', 'by_story', @operators,
33 {:id => @item.id, :my_play => @item.own?(@operators)}
35 @play_count = play_list.count(@operators)
41 respond_to do |format|
42 show_html_format format
43 show_prof_format format
44 show_json_format format
52 respond_to do |format|
54 if @item.own? @operators
55 @new_sheet_items = assist_items('home', 'sheets')
58 list_json_format @list, format
73 @item = @my_model_class.new
75 @item.attributes = params[@my_model_class.item_name]
76 @item.overwrite @operators
83 @item.attributes = params[@my_model_class.item_name]
84 @item.overwrite @operators
89 @item = Story.edit(params[:id], @operators)
90 respond_to do |format|
91 if @item.destroy_with_leafs
92 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Story.model_name.human)
93 format.html { redirect_to '/home/stories' }
94 format.json { head :ok }
96 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Story.model_name.human)
97 format.html { redirect_to @item }
98 format.json { render json: @item.errors, status: :unprocessable_entity }