OSDN Git Service

fix: any
[pettanr/pettanr.git] / app / controllers / speech_balloons_controller.rb
index 85a39e2..191172f 100644 (file)
@@ -1,22 +1,45 @@
 class SpeechBalloonsController < ApplicationController
-  before_filter :authenticate_admin!, :only => [:list, :browse]
-
-  def list
-    @speech_balloons = SpeechBalloon.all
-
-    respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @speech_balloons }
-    end
+  if Manifest.manifest.magic_numbers['run_mode'] == 0
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
+  else
+    before_action :authenticate_reader, :only => [
+      :index, :show, :by_panel, :by_author, :by_speech_balloon_template
+    ]
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
+  end
+  
+  def index
+    filer_list
+  end
+  
+  def by_panel
+    filer_list param: params[:id]
+  end
+  
+  def by_author
+    filer_list param: params[:id]
+  end
+  
+  def by_speech_balloon_template
+    filer_list param: params[:id]
+  end
+  
+  def show_html_format format
+    format.html {
+      @item.boosts 'post'
+      @speech_balloon = @item
+    }
   end
-
-  def browse
-    @speech_balloon = SpeechBalloon.find(params[:id])
-
+  
+  def show
+    set_show
     respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @speech_balloon }
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end
-
+  
 end