OSDN Git Service

Merge branch 'v05' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v05
[pettanr/pettanr.git] / app / controllers / licenses_controller.rb
index 4fa0b49..d30b226 100644 (file)
@@ -1,11 +1,11 @@
 class LicensesController < ApplicationController
-  layout 'test' if Pettanr::TestLayout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   # GET /licenses
   # GET /licenses.json
   def index
-    @licenses = License.list({})
+    @licenses = License.list()
 
     respond_to do |format|
       format.html # index.html.erb
@@ -19,10 +19,19 @@ class LicensesController < ApplicationController
     @license = License.show(params[:id])
     respond_to do |format|
       format.html # show.html.erb
-      format.json { render json: @license.to_json(License.show_json_include_opt) }
+      format.json { render json: @license.to_json(License.show_json_opt) }
     end
   end
 
+  def search
+    @licenses = License.list_by_name(params[:name])
+    
+    respond_to do |format|
+      format.html
+      format.json { render json: @licenses.to_json }
+    end
+  end
+  
   def list
     @licenses = License.all