class BalloonsController < ApplicationController
- before_filter :authenticate_user!, :except => [:index]
+ before_filter :authenticate_author!, :only => [:index, :show]
+ before_filter :authenticate_admin!, :only => [:list, :browse]
+
# GET /balloons
# GET /balloons.json
def index
end
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
- 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
- end
-
- # GET /balloons/1/edit
- def edit
- @balloon = Balloon.find(params[:id])
- 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
- 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
- end
-
- # DELETE /balloons/1
- # DELETE /balloons/1.json
- def destroy
- @balloon = Balloon.find(params[:id])
- @balloon.destroy
+ def list
+ @balloons = Balloon.all
respond_to do |format|
- format.html { redirect_to balloons_url }
- format.json { head :ok }
+ format.html { render layout: 'system' }
+ format.json { render json: @balloons }
end
end
-=end
end