Commit b67c05a56c1905dd3350fabddaac1f014e2b7e6f
1 parent
a61b1b26
Exists in
master
and in
29 other branches
ActionItem250: fixing button helper method: don't throw away upstream
class git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1589 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -248,7 +248,11 @@ module ApplicationHelper |
248 | 248 | end |
249 | 249 | |
250 | 250 | def button(type, label, url, html_options = {}) |
251 | - button_without_text type, label, url, html_options.merge(:class=>'with-text') | |
251 | + the_class = 'with-text' | |
252 | + if html_options.has_key?(:class) | |
253 | + the_class << ' ' << html_options[:class] | |
254 | + end | |
255 | + button_without_text type, label, url, html_options.merge(:class => the_class) | |
252 | 256 | end |
253 | 257 | |
254 | 258 | def button_without_text(type, label, url, html_options = {}) | ... | ... |
test/unit/application_helper_test.rb
... | ... | @@ -50,6 +50,11 @@ class ApplicationHelperTest < Test::Unit::TestCase |
50 | 50 | assert_equal '', show_time(nil) |
51 | 51 | end |
52 | 52 | |
53 | + should 'append with-text class and keep existing classes' do | |
54 | + expects(:button_without_text).with('type', 'label', 'url', { :class => 'with-text class1'}) | |
55 | + button('type', 'label', 'url', { :class => 'class1' }) | |
56 | + end | |
57 | + | |
53 | 58 | protected |
54 | 59 | |
55 | 60 | def content_tag(tag, content, options) | ... | ... |