before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_story, :by_author, :count, :count_by_story, :count_by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :play, :by_story, :by_author, :count, :count_by_story, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
def show_html_format format
format.html {
- @comic = @item
- action = Manifest.manifest.controllers['comics'].actions['play']
- list = Locmare::ListGroup.list action.item_name, action.list_name
- list_result = list.open(@operators,
- {:id => params[:id], :page => params[:page], :page_size => params[:page_size]}
+ play_list = Locmare::ListGroup.list 'comic_story', 'play'
+ @play_count = play_list.count(@operators,
+ {:id => @item.id, :my_play => @item.own?(@operators)}
)
- @comic_stories = list_result.items
- if @operators.author
- @new_story_items = assist_items('story', 'private')
- #@new_story_filer = assist_filer 'story', @new_story_items
- end
}
end
end
end
+ def play
+ @item = self.class.model.show(params[:id], @operators)
+ set_play
+ @items = @list.items(@operators,
+ {:id => params[:id], :my_play => @item.own?(@operators)},
+ 0, -1 # no limit
+ )
+ @count = @items.count
+ # no pager
+ respond_to do |format|
+ format.html {
+ if @item.own? @operators
+ @new_story_items = assist_items('story', 'private')
+ end
+ }
+ format.json { render json: @items.to_json }
+ end
+ end
+
def count
list_count
end
def create
set_model
- @comic = @item
@item = @my_model_class.new
@item.supply_default
+ @my_model_class.fold_extend_settings params[@my_model_class.item_name]
@item.attributes = params[@my_model_class.item_name]
@item.overwrite @operators
render_create
def update
set_edit
- @comic = @item
+ @my_model_class.fold_extend_settings params[@my_model_class.item_name]
@item.attributes = params[@my_model_class.item_name]
@item.overwrite @operators
render_update