Show More
Commit Description:
removed caching on Configuration...
Commit Description:
removed caching on Configuration
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@285 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/controllers/announcements_controller.rb
| 91 lines
| 2.4 KiB
| text/x-ruby
| RubyLexer
|
|
r97 | class AnnouncementsController < ApplicationController | ||
|
r104 | before_filter :admin_authorization | ||
|
r97 | |||
in_place_edit_for :announcement, :published | ||||
# GET /announcements | ||||
# GET /announcements.xml | ||||
def index | ||||
|
r103 | @announcements = Announcement.find(:all, | ||
:order => "created_at DESC") | ||||
|
r97 | |||
respond_to do |format| | ||||
format.html # index.html.erb | ||||
format.xml { render :xml => @announcements } | ||||
end | ||||
end | ||||
# GET /announcements/1 | ||||
# GET /announcements/1.xml | ||||
def show | ||||
@announcement = Announcement.find(params[:id]) | ||||
respond_to do |format| | ||||
format.html # show.html.erb | ||||
format.xml { render :xml => @announcement } | ||||
end | ||||
end | ||||
# GET /announcements/new | ||||
# GET /announcements/new.xml | ||||
def new | ||||
@announcement = Announcement.new | ||||
respond_to do |format| | ||||
format.html # new.html.erb | ||||
format.xml { render :xml => @announcement } | ||||
end | ||||
end | ||||
# GET /announcements/1/edit | ||||
def edit | ||||
@announcement = Announcement.find(params[:id]) | ||||
end | ||||
# POST /announcements | ||||
# POST /announcements.xml | ||||
def create | ||||
@announcement = Announcement.new(params[:announcement]) | ||||
respond_to do |format| | ||||
if @announcement.save | ||||
flash[:notice] = 'Announcement was successfully created.' | ||||
format.html { redirect_to(@announcement) } | ||||
format.xml { render :xml => @announcement, :status => :created, :location => @announcement } | ||||
else | ||||
format.html { render :action => "new" } | ||||
format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } | ||||
end | ||||
end | ||||
end | ||||
# PUT /announcements/1 | ||||
# PUT /announcements/1.xml | ||||
def update | ||||
@announcement = Announcement.find(params[:id]) | ||||
respond_to do |format| | ||||
if @announcement.update_attributes(params[:announcement]) | ||||
flash[:notice] = 'Announcement was successfully updated.' | ||||
format.html { redirect_to(@announcement) } | ||||
format.xml { head :ok } | ||||
else | ||||
format.html { render :action => "edit" } | ||||
format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } | ||||
end | ||||
end | ||||
end | ||||
# DELETE /announcements/1 | ||||
# DELETE /announcements/1.xml | ||||
def destroy | ||||
@announcement = Announcement.find(params[:id]) | ||||
@announcement.destroy | ||||
respond_to do |format| | ||||
format.html { redirect_to(announcements_url) } | ||||
format.xml { head :ok } | ||||
end | ||||
end | ||||
end | ||||