class BalloonsController < ApplicationController
- before_filter :authenticate_user!, :except => [:index]
- # GET /balloons
- # GET /balloons.json
+ 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, :by_speech_balloon_template, :by_system_picture
+ ]
+ before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+ before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
+ end
+
def index
- @balloons = Balloon.all
-
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @balloons }
- end
+ filer_list
end
-
-=begin
- # GET /balloons/1
- # GET /balloons/1.json
- def show
- @balloon = Balloon.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @balloon }
- end
+
+ def by_author
+ filer_list
end
-
- # GET /balloons/new
- # GET /balloons/new.json
- def new
- @balloon = Balloon.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.json { render json: @balloon }
- end
+
+ def by_speech_balloon
+ filer_list
end
-
- # GET /balloons/1/edit
- def edit
- @balloon = Balloon.find(params[:id])
+
+ def by_speech_balloon_template
+ filer_list
end
-
- # POST /balloons
- # POST /balloons.json
- def create
- @balloon = Balloon.new(params[:balloon])
-
- respond_to do |format|
- if @balloon.save
- format.html { redirect_to @balloon, notice: 'Balloon was successfully created.' }
- format.json { render json: @balloon, status: :created, location: @balloon }
- else
- format.html { render action: "new" }
- format.json { render json: @balloon.errors, status: :unprocessable_entity }
- end
- end
+
+ def by_system_picture
+ filer_list
end
-
- # PUT /balloons/1
- # PUT /balloons/1.json
- def update
- @balloon = Balloon.find(params[:id])
-
- respond_to do |format|
- if @balloon.update_attributes(params[:balloon])
- format.html { redirect_to @balloon, notice: 'Balloon was successfully updated.' }
- format.json { head :ok }
- else
- format.html { render action: "edit" }
- format.json { render json: @balloon.errors, status: :unprocessable_entity }
- end
- end
+
+ def show_html_format format
+ format.html {
+ @item.boosts 'post'
+ @balloon = @item
+ }
end
-
- # DELETE /balloons/1
- # DELETE /balloons/1.json
- def destroy
- @balloon = Balloon.find(params[:id])
- @balloon.destroy
-
+
+ def show
+ set_show
respond_to do |format|
- format.html { redirect_to balloons_url }
- format.json { head :ok }
+ show_html_format format
+ show_prof_format format
+ show_json_format format
end
end
-=end
+
+ def new
+ form_new
+ end
+
+ def edit
+ form_edit
+ end
+
end