Class: PagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PagesController
- Defined in:
- app/controllers/pages_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #list ⇒ Object
- #save_theme ⇒ Object
- #select_theme ⇒ Object
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/pages_controller.rb', line 17 def create @page = Page.create(:title => "New Page ("<<( Page.find(:all).last.id + 1 ).to_s<< ")", :theme_name => Page.available_themes.first ) if @page.save render :update do |page| page.insert_html :bottom, 'pages_listed', :partial=>'page_listed' page["page_"<< @page.id.to_s].hide page["page_"<< @page.id.to_s].visual_effect :slide_down end else render :update do |page| page.replace_html 'flash_error', "The page title you've chosen is unavailable, please try with a diferent title." end end end |
#destroy ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/pages_controller.rb', line 33 def destroy @page = Page.find(params[:id]) @page.destroy render :update do |page| page['page_'+params[:id]].visual_effect :drop_out end end |
#edit ⇒ Object
41 42 43 |
# File 'app/controllers/pages_controller.rb', line 41 def edit @page = Page.find(params[:id]) end |
#index ⇒ Object
10 11 |
# File 'app/controllers/pages_controller.rb', line 10 def index end |
#list ⇒ Object
13 14 15 |
# File 'app/controllers/pages_controller.rb', line 13 def list @pages = Page.find_all end |
#save_theme ⇒ Object
52 53 54 55 56 57 |
# File 'app/controllers/pages_controller.rb', line 52 def save_theme @page = Page.find(params[:id]) @page.update_attribute :theme_name, params[:page][:theme_name] redirect_to :action=>"edit", :id=>params[:id] end |
#select_theme ⇒ Object
45 46 47 48 49 50 |
# File 'app/controllers/pages_controller.rb', line 45 def select_theme @page = Page.find(params[:id]) render :update do |page| page.insert_html :bottom, "change_theme", :partial => "select_theme" end end |