OSDN Git Service

fix edit extend_item
[pettanr/pettanr.git] / app / controllers / licenses_controller.rb
index 59e24e2..8456d6e 100644 (file)
@@ -1,43 +1,67 @@
 class LicensesController < ApplicationController
-  layout 'test' if MagicNumber['test_layout']
-  before_filter :authenticate_admin!, :only => [:list, :browse]
+  before_filter :authenticate_resource_reader, :only => [
+    :by_license_group, :by_system_picture, :count_by_license_group, :count_by_system_picture
+  ]
+  before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
 
-  # GET /licenses
-  # GET /licenses.json
+  def self.model
+    License
+  end
+  
   def index
-    @licenses = License.list()
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @licenses.to_json(License.list_json_opt) }
-    end
+    filer_list
   end
-
-  # GET /licenses/1
-  # GET /licenses/1.json
+  
+  def by_license_group
+    filer_list
+  end
+  
+  def by_system_picture
+    filer_list
+  end
+  
+  def show_html_format format
+    format.html {
+      @license = @item
+    }
+  end
+  
   def show
-    @license = License.show(params[:id])
+    set_show
     respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @license.to_json(License.show_json_opt) }
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end
 
-  def list
-    @licenses = License.all
-
+  def search
+    @licenses = License.list_by_name(params[:name])
+    
     respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @licenses }
+      format.html
+      format.json { render json: @licenses.to_json }
     end
   end
-
-  def browse
-    @license = License.find(params[:id])
-
-    respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @license }
-    end
+  
+  def count
+    list_count
+  end
+  
+  def count_by_license_group
+    list_count
+  end
+  
+  def count_by_system_picture
+    list_count
+  end
+  
+  def new
+    form_new
+  end
+  
+  def edit
+    form_edit
   end
+  
 end