Class: Admin::PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PagesController
- Defined in:
- app/controllers/quic_cms/admin/pages_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 22 def create @page = Page.new(params[:page]) if @page.save redirect_to [:admin, @page], :notice => "Successfully created page." else render :action => 'new' end end |
#destroy ⇒ Object
44 45 46 47 48 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 44 def destroy @page = Page.find(params[:id]) @page.destroy redirect_to admin_pages_url, :notice => "Successfully destroyed page." end |
#edit ⇒ Object
31 32 33 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 31 def edit @page = Page.find(params[:id]) end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 3 def index @pages = Page.all end |
#new ⇒ Object
18 19 20 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 18 def new @page = Page.new end |
#show ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 7 def show if params[:permalink] @page = Page.find_by_permalink(params[:permalink]) if @page.nil? @page = Page.new(:title => "Page with permalink of #{params[:permalink]} does not exist", :content => "If you are an Admin Please <a href='/users/sign_in'> Log in </a>and create it", :permalink => params[:permalink]) end else @page = Page.find(params[:id]) end end |
#update ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'app/controllers/quic_cms/admin/pages_controller.rb', line 35 def update @page = Page.find(params[:id]) if @page.update_attributes(params[:page]) redirect_to [:admin, @page], :notice => "Successfully updated page." else render :action => 'edit' end end |