Class: Transit::PagesController

Inherits:
TransitController show all
Defined in:
app/controllers/transit/pages_controller.rb

Instance Method Summary collapse

Methods inherited from TransitController

#edit_mode_enabled?, #render

Instance Method Details

#editObject



12
13
14
15
# File 'app/controllers/transit/pages_controller.rb', line 12

def edit
  @page = scope_class.find(params[:id])
  respond_with(@page)
end

#indexObject



4
5
6
7
8
9
10
# File 'app/controllers/transit/pages_controller.rb', line 4

def index
  @pages = scope_class.descending(:post_date).page((params[:page] || 1))
  respond_with(@pages) do |format|
    format.js{ render :partial => 'table' }
    format.any
  end
end

#updateObject



17
18
19
20
21
22
23
24
# File 'app/controllers/transit/pages_controller.rb', line 17

def update
  @page = scope_class.find(params[:id])
  unless @page.update_attributes(params[:page])
    flash.now[:error] = "Looks like you were missing a few fields!"
    render :action => :edit and return
  end    
  respond_with(@post, :location => edit_polymorphic_path(@page), :success => "The page '#{@page.name}' has been updated.")
end