OSDN Git Service

t#31470:create pager
[pettanr/pettanr.git] / app / controllers / ground_pictures_controller.rb
index 8836779..2d6aff4 100644 (file)
@@ -2,26 +2,28 @@ class GroundPicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
 
-  # GET /ground_pictures
-  # GET /ground_pictures.json
   def index
     @page = GroundPicture.page params[:page]
     @page_size = GroundPicture.page_size params[:page_size]
     @ground_pictures = GroundPicture.list(@page, @page_size)
 
     respond_to do |format|
-      format.html # index.html.erb
+      format.html {
+        @paginate = GroundPicture.list_paginate(@page, @page_size)
+      }
       format.json { render :json => @ground_pictures.to_json(GroundPicture.list_json_opt) }
     end
   end
 
   def show
-    @ground_picture = GroundPicture.show(params[:id], [@author, @admin])
+    @ground_picture = GroundPicture.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }