Commit 63f0dc1e51a193673e5ae8006027a0518ebb4be6

Authored by MoisesMachado
1 parent 4d6a766f

ActionItem178: and 196 fixed the up and down buttons and added the remove button


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1520 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/box_organizer_controller.rb
@@ -82,6 +82,16 @@ class BoxOrganizerController < ApplicationController @@ -82,6 +82,16 @@ class BoxOrganizerController < ApplicationController
82 def boxes_editor? 82 def boxes_editor?
83 true 83 true
84 end 84 end
  85 +
  86 + def remove
  87 + @block = Block.find(params[:id])
  88 + if @block.destroy
  89 + redirect_to :action => 'index'
  90 + else
  91 + flash[:notice] = _('Failed to remove block')
  92 + end
  93 + end
  94 +
85 protected :boxes_editor? 95 protected :boxes_editor?
86 96
87 end 97 end
app/helpers/application_helper.rb
@@ -285,7 +285,7 @@ module ApplicationHelper @@ -285,7 +285,7 @@ module ApplicationHelper
285 end 285 end
286 286
287 def icon_button(type, text, url, html_options = {}) 287 def icon_button(type, text, url, html_options = {})
288 - the_class = "button icon-button #{type}" 288 + the_class = "button icon-button icon-#{type}"
289 if html_options.has_key?(:class) 289 if html_options.has_key?(:class)
290 the_class << ' ' << html_options[:class] 290 the_class << ' ' << html_options[:class]
291 end 291 end
app/helpers/boxes_helper.rb
@@ -123,6 +123,7 @@ module BoxesHelper @@ -123,6 +123,7 @@ module BoxesHelper
123 123
124 buttons << icon_button(:up, _('Move block up'), { :action => 'move_block_up', :id => block.id }, { :method => 'post' }) unless block.first? 124 buttons << icon_button(:up, _('Move block up'), { :action => 'move_block_up', :id => block.id }, { :method => 'post' }) unless block.first?
125 buttons << icon_button(:down, _('Move block down'), { :action => 'move_block_down' ,:id => block.id }, { :method => 'post'}) unless block.last? 125 buttons << icon_button(:down, _('Move block down'), { :action => 'move_block_down' ,:id => block.id }, { :method => 'post'}) unless block.last?
  126 + buttons << icon_button(:delete, _('Remove block'), { :action => 'remove', :id => block.id }, { :method => 'post'}) unless block.main?
126 127
127 if block.editor 128 if block.editor
128 buttons << lightbox_button(:edit, _('Edit'), block.editor) 129 buttons << lightbox_button(:edit, _('Edit'), block.editor)