OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / controllers / ground_pictures_controller.rb
index aa23e7f..974cc6e 100644 (file)
@@ -1,18 +1,40 @@
 class GroundPicturesController < ApplicationController
-  layout 'test' if Pettanr::TestLayout
-  before_filter :authenticate_user!, :only => [:index]
-
-  # GET /ground_pictures
-  # GET /ground_pictures.json
+  if Manifest.manifest.magic_numbers['run_mode'] == 0
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
+  else
+    before_action :authenticate_reader, :only => [
+      :index, :show, :by_panel, :by_author
+    ]
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
+  end
+  
   def index
-    @page = GroundPicture.page params[:page]
-    @page_size = GroundPicture.page_size params[:page_size]
-    @ground_pictures = GroundPicture.list(@page, @page_size)
-
+    filer_list
+  end
+  
+  def by_panel
+    filer_list param: params[:id]
+  end
+  
+  def by_author
+    filer_list param: params[:id]
+  end
+  
+  def show_html_format format
+    format.html {
+      @ground_picture = @item
+    }
+  end
+  
+  def show
+    set_show
     respond_to do |format|
-      format.html # index.html.erb
-      format.json { render :json => @ground_pictures.to_json(GroundPicture.list_json_opt) }
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end
-
+  
 end