X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fcontrollers%2Fspeeches_controller.rb;h=658f270ea5e95974f244286ff9d806f9d35e3797;hb=9192edc531531a036d23449859b7300e0898d886;hp=7e53b73f2f95a28de5e498457ecf3fac4611279f;hpb=aac8dcaac3363c67a15a6fbd77da900ff4d63dbe;p=pettanr%2Fpettanr.git diff --git a/app/controllers/speeches_controller.rb b/app/controllers/speeches_controller.rb index 7e53b73f..658f270e 100644 --- a/app/controllers/speeches_controller.rb +++ b/app/controllers/speeches_controller.rb @@ -1,24 +1,62 @@ 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, :by_speech_balloon, :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 by_speech_balloon + 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