Class: Gluttonberg::Admin::Content::PagesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Gluttonberg::Admin::Content::PagesController
- Defined in:
- app/controllers/gluttonberg/admin/content/pages_controller.rb
Instance Method Summary (collapse)
- - (Object) create
- - (Object) delete
- - (Object) destroy
- - (Object) edit
- - (Object) edit_home
- - (Object) index
- - (Object) new
- - (Object) pages_list_for_tinymce
- - (Object) show
- - (Object) update
- - (Object) update_home
Instance Method Details
- (Object) create
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 38 def create @page = Page.new(params["gluttonberg_page"]) @page.user_id = current_user.id if @page.save @page.create_default_template_file flash[:notice] = "The page was successfully created." redirect_to admin_pages_path else prepare_to_edit render :new end end |
- (Object) delete
29 30 31 32 33 34 35 36 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 29 def delete display_delete_confirmation( :title => "Delete “#{@page.name}” page?", :url => admin_page_url(@page), :return_url => admin_pages_path , :warning => "Children of this page will also be deleted." ) end |
- (Object) destroy
62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 62 def destroy if @page.destroy flash[:notice] = "The page was successfully deleted." redirect_to admin_pages_path else flash[:error] = "There was an error deleting the page." redirect_to admin_pages_path end end |
- (Object) edit
25 26 27 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 25 def edit prepare_to_edit end |
- (Object) edit_home
72 73 74 75 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 72 def edit_home @current_home_page_id = Page.home_page.id unless Page.home_page.blank? @pages = Page.all end |
- (Object) index
12 13 14 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 12 def index @pages = Page.find(:all , :conditions => { :parent_id => nil } , :order => 'position' ) end |
- (Object) new
19 20 21 22 23 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 19 def new @page = Page.new @page_localization = PageLocalization.new prepare_to_edit end |
- (Object) pages_list_for_tinymce
88 89 90 91 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 88 def pages_list_for_tinymce @pages = Page.published.find(:all , :conditions => "not(description_name = 'top_level_page')" , :order => 'position' ) render :layout => false end |
- (Object) show
16 17 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 16 def show end |
- (Object) update
51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 51 def update if @page.update_attributes(params["gluttonberg_page"]) || !@page.changed? flash[:notice] = "The page was successfully updated." redirect_to edit_admin_page_url(@page) else flash[:error] = "Sorry, The page could not be updated." prepare_to_edit render :edit end end |
- (Object) update_home
77 78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/gluttonberg/admin/content/pages_controller.rb', line 77 def update_home @new_home = Page.find(:first , :conditions => { :id => params[:home] }) unless @new_home.blank? @new_home.update_attributes(:home => true) else @old_home = Page.find(:first , :conditions => { :home => true }) @old_home.update_attributes(:home => false) end render :text => "Home page is changed" end |