before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
before_filter :authenticate_reader, :only => [
- :index, :show, :play, :by_comic, :by_sheet, :by_author, :count, :count_by_comic, :count_by_sheet, :count_by_author
+ :index, :show, :play, :by_comic, :by_sheet, :by_author
]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
def show_html_format format
format.html {
- play_list = Locmare::ListGroup.list(
+ @play_list = Locmare::ListGroup.list(
'story_sheets', 'by_story', @operators,
- {:id => @item.id, :my_play => @item.own?(@operators)}
+ {:id => @item.id, :page_size => -1} # set no limit options
)
- @play_count = play_list.count(@operators)
}
end
end
def play
- params[:offset] = nil
- params[:count] = nil
- params[:page] ||= 1
- params[:page_size] = 1
set_play
- @list = Locmare::ListGroup.list(
- @my_controller.name,
- @my_action.name, @operators,
- {:id => @item.id, :offset => 0, :limit => -1}# no limit
- )
- @items = @list.items(@operators)
- @count = @list.count @operators
+ @list.options.merge!({'per_page' => 1}) # show one sheet
+ @list.reset
+ play_list
respond_to do |format|
format.html {
+ @pager = @list.page_status.pager
if @item.own? @operators
@new_sheet_items = assist_items('home', 'sheets')
end
}
- format.json { render json: @items.to_json }
+ list_json_format @list, format
end
end
- def count
- list_count
- end
-
- def count_by_comic
- list_count
- end
-
- def count_by_sheet
- list_count
- end
-
- def count_by_author
- list_count
- end
-
def new
form_new
end
end
def destroy
- @item = Story.edit(params[:id], @operators)
- respond_to do |format|
- if @item.destroy_with_leafs
- flash[:notice] = I18n.t('flash.notice.destroyed', :model => Story.model_name.human)
- format.html { redirect_to '/home/stories' }
- format.json { head :ok }
- else
- flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Story.model_name.human)
- format.html { redirect_to @item }
- format.json { render json: @item.errors, status: :unprocessable_entity }
- end
- end
+ set_model
+ @item = @my_model_class.edit(params[:id], @operators)
+ render_destroy '/home/' + @item.path_name
end
end