before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
before_filter :authenticate_reader, :only => [
- :top, :index, :show, :play, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+ :top, :index, :show, :play, :by_panel, :by_author
]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
- def self.model
- Scroll
- end
-
def index
filer_list
end
def show_html_format format
format.html {
- play_list = Locmare::ListGroup.list 'scroll_panel', 'play'
- @play_count = play_list.count(@operators,
- {:id => @item.id, :my_play => @item.own?(@operators)}
+ @play_list = Locmare::ListGroup.list(
+ 'scroll_panels', 'by_scroll', @operators,
+ {:id => @item.id, :page_size => -1} # set no limit options}
)
}
end
end
def play
- @item = self.class.model.show(params[:id], @operators)
set_play
play_list
respond_to do |format|
format.html {
if @item.own? @operators
- @fresh_panel_items = assist_items('panel', 'public')
- @new_panel_items = assist_items('panel', 'private')
+ @fresh_panel_items = assist_items('panels', 'index')
+ @new_panel_items = assist_items('home', 'panels')
end
}
- format.json { render json: @items.to_json }
+ list_json_format @list, format
end
end
- def count
- list_count
- end
-
- def count_by_author
- list_count
- end
-
- def count_by_panel
- list_count
- end
-
def new
form_new
end
end
def destroy
- @item = Scroll.edit(params[:id], @operators)
- respond_to do |format|
- if @item.destroy_with_leafs
- flash[:notice] = I18n.t('flash.notice.destroyed', :model => Scroll.model_name.human)
- format.html { redirect_to '/home/scrolls' }
- format.json { head :ok }
- else
- flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Scroll.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