Class: Admin::StaticContentBlocksController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::StaticContentBlocksController
- Defined in:
- app/controllers/admin/static_content_blocks_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #duplicate ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #link ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #unlink ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 32 def create if @static_content_block.save flash[:notice] = I18n.t('block.create.success').capitalize redirect_to([forgeos_cms, :edit, :admin, @static_content_block]) else flash[:error] = I18n.t('static_content_block.create.failed').capitalize render :action => "new" end end |
#destroy ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 51 def destroy if @static_content_block.destroy flash[:notice] = I18n.t('static_content_block.destroy.success').capitalize else flash[:error] = @static_content_block.errors if @static_content_block flash[:error] = I18n.t('static_content_block.destroy.failed').capitalize end redirect_to([forgeos_cms, :admin, :static_content_blocks]) end |
#duplicate ⇒ Object
24 25 26 27 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 24 def duplicate @static_content_block = @static_content_block.clone render :action => 'new' end |
#edit ⇒ Object
29 30 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 29 def edit end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 8 def index respond_to do |format| format.html format.json do sort render :layout => false end end end |
#link ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 61 def link unless @static_content_block.linked_with? @page if @static_content_block.link_with @page flash[:notice] = I18n.t('static_content_block.link.create.success').capitalize else flash[:error] = I18n.t('static_content_block.link.create.failed').capitalize end else if @static_content_block.unlink_with @page flash[:notice] = I18n.t('static_content_block.link.destroy.success').capitalize else flash[:error] = I18n.t('static_content_block.link.destroy.success').capitalize end end if request.xhr? return render :text => true else return redirect_to(:back) end end |
#new ⇒ Object
21 22 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 21 def new end |
#show ⇒ Object
18 19 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 18 def show end |
#unlink ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 83 def unlink if @page.blocks.delete(@static_content_block) @page.blocks.reset_positions flash[:notice] = I18n.t('static_content_block.link.destroy.success').capitalize else flash[:notice] = I18n.t('static_content_block.link.destroy.success').capitalize end render :nothing => true end |
#update ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'app/controllers/admin/static_content_blocks_controller.rb', line 42 def update if @static_content_block.update_attributes(params[:static_content_block]) flash[:notice] = I18n.t('static_content_block.update.success').capitalize else flash[:error] = I18n.t('static_content_block.update.failed').capitalize end render :action => "edit" end |