OSDN Git Service

list browser created
[pettanr/pettanr.git] / app / controllers / system_pictures_controller.rb
index c671774..8843d8d 100644 (file)
@@ -1,5 +1,6 @@
 class SystemPicturesController < ApplicationController
-  before_filter :authenticate_admin!, :except => [:index, :show]
+  before_filter :authenticate_author!, :only => [:index, :show]
+  before_filter :authenticate_admin!, :only => [:list, :browse, :create, :update, :destroy]
 
   private
   
@@ -57,22 +58,25 @@ class SystemPicturesController < ApplicationController
     end
   end
 
-  # GET /system_pictures/new
-  # GET /system_pictures/new.json
-  def new
-    @system_picture = SystemPicture.new
+  def list
+    @system_pictures = SystemPicture.all
 
     respond_to do |format|
-      format.html # new.html.erb
-      format.json { render json: @system_picture }
+      format.html { render layout: 'system' }
+      format.json { render json: @system_pictures }
     end
   end
 
-  # GET /system_pictures/1/edit
-  def edit
+  def browse
     @system_picture = SystemPicture.find(params[:id])
+
+    respond_to do |format|
+      format.html { render layout: 'system' }
+      format.json { render json: @system_picture}
+    end
   end
 
+
   # POST /system_pictures
   # POST /system_pictures.json
   def create