Class: Admin::PagesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::PagesController
- Defined in:
- app/controllers/admin/pages_controller.rb
Instance Method Summary collapse
- #activate ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #duplicate ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #link ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
- #url ⇒ Object
Instance Method Details
#activate ⇒ Object
81 82 83 |
# File 'app/controllers/admin/pages_controller.rb', line 81 def activate render :text => @page.activate end |
#create ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/pages_controller.rb', line 33 def create if @page.save flash[:notice] = I18n.t('page.create.success').capitalize redirect_to([forgeos_cms, :edit, :admin, @page]) else flash[:error] = I18n.t('page.create.failed').capitalize render :action => 'new' end end |
#destroy ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/admin/pages_controller.rb', line 60 def destroy if @page.destroy flash[:notice] = I18n.t('page.destroy.success').capitalize else flash[:error] = @page.errors if @page flash[:error] = I18n.t('page.destroy.failed').capitalize end render :nothing => true end |
#duplicate ⇒ Object
28 29 30 31 |
# File 'app/controllers/admin/pages_controller.rb', line 28 def duplicate @page = @page.clone render :action => 'new' end |
#edit ⇒ Object
43 44 45 46 47 48 |
# File 'app/controllers/admin/pages_controller.rb', line 43 def edit number_of_cols = @page.min_cols_by_page - @page.page_cols.size number_of_cols.times do @page.page_cols.build end end |
#index ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/admin/pages_controller.rb', line 9 def index respond_to do |format| format.html format.json do sort render :layout => false end end end |
#link ⇒ Object
70 71 72 73 74 75 |
# File 'app/controllers/admin/pages_controller.rb', line 70 def link if request.post? @page.update_attributes!(params[:page]) end return redirect_to([forgeos_cms, :admin, @page]) end |
#new ⇒ Object
21 22 23 24 25 26 |
# File 'app/controllers/admin/pages_controller.rb', line 21 def new number_of_cols = @page.min_cols_by_page - @page.page_cols.size number_of_cols.times do @page.page_cols.build end end |
#show ⇒ Object
19 |
# File 'app/controllers/admin/pages_controller.rb', line 19 def show; end |
#update ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/admin/pages_controller.rb', line 50 def update if @page.update_attributes(params[:page]) flash[:notice] = I18n.t('page.update.success').capitalize redirect_to([forgeos_cms, :edit, :admin, @page]) else flash[:error] = I18n.t('page.update.failed').capitalize render :action => 'edit' end end |
#url ⇒ Object
77 78 79 |
# File 'app/controllers/admin/pages_controller.rb', line 77 def url render :text => Forgeos::url_generator(params[:url]) end |