OSDN Git Service

add show
[pettanr/pettanr.git] / app / controllers / system_pictures_controller.rb
index ca16cf7..ffb75de 100644 (file)
@@ -1,58 +1,42 @@
 class SystemPicturesController < ApplicationController
-  layout 'test' if MagicNumber['test_layout']
-  if MagicNumber['run_mode'] == 0
-    before_filter :authenticate_user!, :only => []
+  if Manifest.manifest.magic_numbers['run_mode'] == 0
+    before_filter :authenticate_user, :only => []
     before_filter :authenticate_author, :only => []
   else
-    before_filter :authenticate_user!, :only => [:index, :show]
-    before_filter :authenticate_author, :only => [:index, :show]
+    before_filter :authenticate_resource_reader, :only => [:index, :show, :count]
+    before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
+  end
+  before_filter :authenticate_admin!, :only => []
+  
+  def self.model
+    SystemPicture
   end
-  before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
-
-  # GET /system_pictures
-  # GET /system_pictures.json
+  
   def index
-    @page = SystemPicture.page params[:page]
-    @page_size = SystemPicture.page_size params[:page_size]
-    @system_pictures = SystemPicture.list(@page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) }
-    end
+    filer_list
   end
-
-  # GET /system_pictures/1
-  # GET /system_pictures/1.json
-  def show
-    @system_picture = SystemPicture.show(params[:id], @author)
-    
-    respond_to do |format|
-      opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
-      format.png { send_data(@system_picture.restore, opt ) }
-      format.gif { send_data(@system_picture.restore, opt ) }
-      format.jpeg { send_data(@system_picture.restore, opt ) }
-      format.html # show.html.erb
-      format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
-    end
+  
+  def show_html_format format
+    format.html {
+    }
   end
-
-  def list
-    @system_pictures = SystemPicture.all
-
+  
+  def show
+    set_show
     respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @system_pictures }
+      opt = {:type => @item.mime_type, :disposition=>"inline"}
+      format.png { send_data(@item.restore, opt ) }
+      format.gif { send_data(@item.restore, opt ) }
+      format.jpeg { send_data(@item.restore, opt ) }
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end
-
-  def browse
-    @system_picture = SystemPicture.find(params[:id])
-
-    respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @system_picture}
-    end
+  
+  def count
+    list_count
   end
-
+  
 end