OSDN Git Service

add: license publisher
[pettanr/pettanr.git] / app / controllers / stories_controller.rb
index becb8d1..67ba22a 100644 (file)
@@ -28,11 +28,10 @@ class StoriesController < ApplicationController
   
   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
   
@@ -46,11 +45,13 @@ class StoriesController < ApplicationController
   end
   
   def play
+    set_play
+    @list.options.merge!({'per_page' => 1})    # show one sheet
+    @list.reset
     play_list
-    # no limit
-    # no pager
     respond_to do |format|
       format.html {
+        @pager = @list.page_status.pager
         if @item.own? @operators
           @new_sheet_items = assist_items('home', 'sheets')
         end
@@ -86,18 +87,9 @@ class StoriesController < ApplicationController
   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