OSDN Git Service

list browser created
[pettanr/pettanr.git] / app / controllers / speaches_controller.rb
index 06675f8..1619319 100644 (file)
@@ -1,5 +1,6 @@
 class SpeachesController < ApplicationController
-  before_filter :authenticate_author!, :except => [:index]
+  before_filter :authenticate_author!, :only => [:index, :show]
+  before_filter :authenticate_admin!, :only => [:list, :browse]
 
   # GET /speaches
   # GET /speaches.json
@@ -12,76 +13,12 @@ class SpeachesController < ApplicationController
     end
   end
 
-=begin
-  # GET /speaches/1
-  # GET /speaches/1.json
-  def show
-    @speach = Speach.find(params[:id])
-
-    respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @speach }
-    end
-  end
-
-  # GET /speaches/new
-  # GET /speaches/new.json
-  def new
-    @speach = Speach.new
-
-    respond_to do |format|
-      format.html # new.html.erb
-      format.json { render json: @speach }
-    end
-  end
-
-  # GET /speaches/1/edit
-  def edit
-    @speach = Speach.find(params[:id])
-  end
-
-  # POST /speaches
-  # POST /speaches.json
-  def create
-    @speach = Speach.new(params[:speach])
-
-    respond_to do |format|
-      if @speach.save
-        format.html { redirect_to @speach, notice: 'Speach was successfully created.' }
-        format.json { render json: @speach, status: :created, location: @speach }
-      else
-        format.html { render action: "new" }
-        format.json { render json: @speach.errors, status: :unprocessable_entity }
-      end
-    end
-  end
-
-  # PUT /speaches/1
-  # PUT /speaches/1.json
-  def update
-    @speach = Speach.find(params[:id])
-
-    respond_to do |format|
-      if @speach.update_attributes(params[:speach])
-        format.html { redirect_to @speach, notice: 'Speach was successfully updated.' }
-        format.json { head :ok }
-      else
-        format.html { render action: "edit" }
-        format.json { render json: @speach.errors, status: :unprocessable_entity }
-      end
-    end
-  end
-
-  # DELETE /speaches/1
-  # DELETE /speaches/1.json
-  def destroy
-    @speach = Speach.find(params[:id])
-    @speach.destroy
+  def list
+    @speaches = Speach.all
 
     respond_to do |format|
-      format.html { redirect_to speaches_url }
-      format.json { head :ok }
+      format.html { render layout: 'system' }
+      format.json { render json: @speaches }
     end
   end
-=end
 end