before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
before_filter :authenticate_reader, :only => [
- :index, :show, :play, :by_story, :by_author, :count, :count_by_story, :count_by_author
+ :index, :show, :play, :by_story, :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(
'comic_stories', 'by_comic', @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
def play
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
- # no pager
+ @list.options.merge!({'page_size' => -1}) # no limit no pager
+ @list.reset
+ play_list
respond_to do |format|
format.html {
if @item.own? @operators
@new_story_items = assist_items('home', 'stories')
end
}
- format.json { render json: @items.to_json }
+ list_json_format @list, format
end
end
- def count
- list_count
- end
-
- def count_by_story
- list_count
- end
-
- def count_by_author
- list_count
- end
-
def new
form_new
end
end
def destroy
- @item = Comic.edit(params[:id], @operators)
- respond_to do |format|
- if @item.destroy_with_leafs
- flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
- format.html { redirect_to '/home/comics' }
- format.json { head :ok }
- else
- flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.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