OSDN Git Service

rename model name
[pettanr/pettanr.git] / app / controllers / application_controller.rb
index bbdd2e8..a169dc1 100644 (file)
@@ -114,14 +114,12 @@ class ApplicationController < ActionController::Base
     set_model
     @my_list_model = Manifest.manifest.models[@my_action.item_name]
     @my_list_model_class = @my_list_model.classify
-    @list = Locmare::ListGroup.list @my_action.item_name, @my_action.list_name
+    @list = Locmare::ListGroup.list @my_controller.name, @my_action.name, @operators, params
   end
   
   def filer_list
     set_list
-    list_result = @list.open(@operators, 
-      {:id => params[:id], :page => params[:page], :page_size => params[:page_size]}
-    )
+    list_result = @list.open(@operators)
     @items = list_result.items 
     respond_to do |format|
       format.html {
@@ -144,17 +142,16 @@ class ApplicationController < ActionController::Base
   def set_play
     set_list
     @binder_controller = Manifest.manifest.controllers[params[:controller].to_s]
-    @binder_model = Manifest.manifest.models[@binder_controller.item_name]
+    @binder_action = @my_controller.actions[params[:action].to_s]
+    @binder_model = Manifest.manifest.models[@binder_action.item_name]
     @binder_model_class = @binder_model.classify
     @item = @binder_model_class.show(params[:id], @operators)
   end
   
   def play_list
-    @options = {:id => params[:id], :my_play => @item.own?(@operators), 
-      :offset => params[:offset], :count => params[:count], 
-      :page => params[:page], :page_size => params[:page_size]
-    }
-    list_result = @list.open(@operators, @options)
+    @options = params
+    @options[:my_play] = @item.own?(@operators)
+    list_result = @list.open(@operators)
     @items = list_result.items 
     @count = list_result.count
     @pager = list_result.paginate
@@ -396,7 +393,7 @@ class ApplicationController < ActionController::Base
   
   def list_count
     set_list
-    j = {:count => @list.count(@operators, {:id => params[:id]})}
+    j = {:count => @list.count(@operators)}
     respond_to do |format|
       format.json { render json: j.to_json }
     end
@@ -421,9 +418,9 @@ class ApplicationController < ActionController::Base
     }
   end
   
-  def assist_items item_name, list_name
-    list = Locmare::ListGroup.list item_name, list_name
-    list_result = list.open(@operators, {:id => @item.id, :page => 1, :page_size => 5})
+  def assist_items controller_name, list_name
+    list = Locmare::ListGroup.list controller_name, list_name, @operators, {:id => @item.id, :page => 1, :page_size => 5}
+    list_result = list.open(@operators)
     list_result.items
   end