Commit b501e2ce38e027ef868d32ca448bc8baf6fef314
1 parent
886d362a
Exists in
master
and in
29 other branches
Fix embed button in boxes helper
Showing
2 changed files
with
19 additions
and
2 deletions
Show diff stats
app/helpers/boxes_helper.rb
... | ... | @@ -251,8 +251,8 @@ module BoxesHelper |
251 | 251 | content_tag('h2', _('Embed block code')) + |
252 | 252 | content_tag('div', _('Below, you''ll see a field containing embed code for the block. Just copy the code and paste it into your website or blogging software.'), :style => 'margin-bottom: 1em;') + |
253 | 253 | content_tag('textarea', embed_code, :style => 'margin-bottom: 1em; width:100%; height:40%;', :readonly => 'readonly') + |
254 | - thickbox_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}") | |
255 | - buttons << thickbox_inline_popup_icon(:embed, _('Embed code'), {}, "embed-code-box-#{block.id}") << html | |
254 | + modal_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}") | |
255 | + buttons << modal_inline_icon(:embed, _('Embed code'), {}, "#embed-code-box-#{block.id}") << html | |
256 | 256 | end |
257 | 257 | |
258 | 258 | content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar') | ... | ... |
test/unit/boxes_helper_test.rb
... | ... | @@ -3,6 +3,7 @@ require 'boxes_helper' |
3 | 3 | |
4 | 4 | class BoxesHelperTest < ActionView::TestCase |
5 | 5 | |
6 | + include ApplicationHelper | |
6 | 7 | include BoxesHelper |
7 | 8 | include ActionView::Helpers::TagHelper |
8 | 9 | |
... | ... | @@ -181,4 +182,20 @@ class BoxesHelperTest < ActionView::TestCase |
181 | 182 | display_box_content(box, '') |
182 | 183 | end |
183 | 184 | |
185 | + should 'display embed button when a block is embedable' do | |
186 | + box = create(Box, position: 1, owner: fast_create(Profile)) | |
187 | + block = Block.create!(:box => box) | |
188 | + block.stubs(:embedable?).returns(true) | |
189 | + stubs(:url_for).returns('') | |
190 | + assert_tag_in_string block_edit_buttons(block), :tag => 'a', :attributes => {:class => 'button icon-button icon-embed '} | |
191 | + end | |
192 | + | |
193 | + should 'not display embed button when a block is not embedable' do | |
194 | + box = create(Box, position: 1, owner: fast_create(Profile)) | |
195 | + block = Block.create!(:box => box) | |
196 | + block.stubs(:embedable?).returns(false) | |
197 | + stubs(:url_for).returns('') | |
198 | + assert_no_tag_in_string block_edit_buttons(block), :tag => 'a', :attributes => {:class => 'button icon-button icon-embed '} | |
199 | + end | |
200 | + | |
184 | 201 | end | ... | ... |