OSDN Git Service

t30350#:fix destroy in op, p, user
[pettanr/pettanr.git] / app / controllers / panel_pictures_controller.rb
index 4011887..3679894 100644 (file)
@@ -1,6 +1,7 @@
 class PanelPicturesController < ApplicationController
-  layout 'test' if Pettanr::TestLayout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show]
+  before_filter :authenticate_author, :only => [:index, :show]
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   # GET /panel_pictures
@@ -16,6 +17,15 @@ class PanelPicturesController < ApplicationController
     end
   end
 
+  def show
+    @panel_picture = PanelPicture.show(params[:id], @author)
+
+    respond_to do |format|
+      format.html
+      format.json { render :json => @panel_picture.to_json(PanelPicture.show_json_opt) }
+    end
+  end
+
   def list
     @panel_pictures = PanelPicture.all
 
@@ -25,4 +35,13 @@ class PanelPicturesController < ApplicationController
     end
   end
 
+  def browse
+    @panel_picture = PanelPicture.find(params[:id])
+
+    respond_to do |format|
+      format.html { render layout: 'system' }
+      format.json { render json: @panel_picture}
+    end
+  end
+
 end