OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / controllers / panels_controller.rb
index b6b85bc..8d4b05e 100644 (file)
@@ -4,7 +4,7 @@ class PanelsController < ApplicationController
     before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy, :catch]
   else
     before_filter :authenticate_reader, :only => [
-      :index, :show, :by_scroll, :by_sheet, :by_author, :by_speech_balloon_template, :count, :count_by_scroll, :count_by_sheet, :count_by_author, :count_by_speech_balloon_template
+      :index, :show, :by_scroll, :by_sheet, :by_author, :by_speech_balloon_template
     ]
     before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy, :catch]
     before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy, :catch]
@@ -23,7 +23,7 @@ class PanelsController < ApplicationController
     @pager = list_result.paginate
     respond_to do |format|
       format.html 
-      format.json { render json: @items.to_json }
+      format.json { render json: @items.map{|i| i.attributes}.to_json }
       format.atom 
       format.rss
     end
@@ -58,9 +58,6 @@ class PanelsController < ApplicationController
       if @operators.author
         @new_scroll_items = assist_items('scroll', 'private')
         @fresh_scroll_items = assist_items('scroll_panel', 'private').map {|sp| sp.scroll}
-        
-        @new_sheet_items = assist_items('sheet', 'private')
-        @fresh_sheet_items = assist_items('sheet_panel', 'private').map {|sp| sp.sheet}
       end
     }
   end
@@ -70,7 +67,11 @@ class PanelsController < ApplicationController
     respond_to do |format|
       show_html_format format
       show_prof_format format
-      show_json_format format
+      if params[:with_elements]
+        show_json_format_for_root format
+      else
+        show_json_format format
+      end
     end
   end
 
@@ -121,7 +122,8 @@ class PanelsController < ApplicationController
   end
   
   def create
-    @item = Panel.new
+    set_model
+    @item = @my_model_class.new
 #    @item.boosts 'post'
     jsn = nil
     if params[:json]