OSDN Git Service

add: license publisher
[pettanr/pettanr.git] / app / controllers / licenses_controller.rb
index 4051865..cd697dd 100644 (file)
@@ -1,11 +1,8 @@
 class LicensesController < ApplicationController
   before_filter :authenticate_resource_reader, :only => [
-    :by_license_group, :by_system_picture, :count_by_license_group, :count_by_system_picture
+    :by_license_group, :by_system_picture
   ]
-
-  def self.model
-    License
-  end
+  before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
   
   def index
     filer_list
@@ -43,16 +40,36 @@ class LicensesController < ApplicationController
     end
   end
   
-  def count
-    list_count
+  def new
+    form_new
+  end
+  
+  def edit
+    form_edit
+  end
+  
+  def create
+    set_model
+    @item = @my_model_class.new
+    @item.supply_default 
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_create
   end
   
-  def count_by_license_group
-    list_count
+  def update
+    set_edit
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_update
   end
   
-  def count_by_system_picture
-    list_count
+  def destroy
+    set_model
+    @item = @my_model_class.edit(params[:id], @operators)
+    render_destroy '/' + @my_model_class.path_name
   end
   
 end