diff --git a/app/controllers/box_organizer_controller.rb b/app/controllers/box_organizer_controller.rb index 0700ea0..0a42d6e 100644 --- a/app/controllers/box_organizer_controller.rb +++ b/app/controllers/box_organizer_controller.rb @@ -82,6 +82,16 @@ class BoxOrganizerController < ApplicationController def boxes_editor? true end + + def remove + @block = Block.find(params[:id]) + if @block.destroy + redirect_to :action => 'index' + else + flash[:notice] = _('Failed to remove block') + end + end + protected :boxes_editor? end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9199bd4..fc4d866 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -285,7 +285,7 @@ module ApplicationHelper end def icon_button(type, text, url, html_options = {}) - the_class = "button icon-button #{type}" + the_class = "button icon-button icon-#{type}" if html_options.has_key?(:class) the_class << ' ' << html_options[:class] end diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index 1f64534..7656d82 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -123,6 +123,7 @@ module BoxesHelper buttons << icon_button(:up, _('Move block up'), { :action => 'move_block_up', :id => block.id }, { :method => 'post' }) unless block.first? buttons << icon_button(:down, _('Move block down'), { :action => 'move_block_down' ,:id => block.id }, { :method => 'post'}) unless block.last? + buttons << icon_button(:delete, _('Remove block'), { :action => 'remove', :id => block.id }, { :method => 'post'}) unless block.main? if block.editor buttons << lightbox_button(:edit, _('Edit'), block.editor) -- libgit2 0.21.2