OSDN Git Service

add lg_id in resource picture
[pettanr/pettanr.git] / app / controllers / speeches_controller.rb
index 7e53b73..b4f2249 100644 (file)
@@ -1,24 +1,58 @@
 class SpeechesController < ApplicationController
-  before_filter :authenticate_user!, :only => [:index, :show]
-  before_filter :authenticate_admin!, :only => [:list, :browse]
+  if Manifest.manifest.magic_numbers['run_mode'] == 0
+    before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
+  else
+    before_filter :authenticate_reader, :only => [
+      :index, :show, :by_author, :count, :count_by_author
+    ]
+    before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
+  end
+  before_filter :authenticate_admin!, :only => []
 
-  # GET /speeches
-  # GET /speeches.json
+  def self.model
+    Speech
+  end
+  
   def index
-    @speeches = Speech.all
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @speeches }
-    end
+    filer_list
   end
-
-  def list
-    @speeches = Speech.all
-
+  
+  def by_author
+    filer_list
+  end
+  
+  def show_html_format format
+    format.html {
+      @item.boosts 'post'
+      @speech = @item
+    }
+  end
+  
+  def show
+    set_show
     respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @speeches }
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end
+  
+  def count
+    list_count
+  end
+  
+  def count_by_author
+    list_count
+  end
+  
+  def new
+    form_new
+  end
+  
+  def edit
+    form_edit
+  end
+  
 end