Commit 940ab5143c8abf0c75733a040ebad927f641b1f8

Authored by Braulio Bhavamitra
2 parents 3018162d cbf1bf90

Merge branch 'some-bug-fixes' into 'master'

link block: shows default message for new blocks with no links

Currently, link blocks are added with no links and no title which, depending on the theme, makes it hard to see where the block was added. This patch add a help message for the user as suggested in #144, following the behavior of other blocks like slideshow block.

See merge request !724
app/views/blocks/link_list.html.erb
1 1 <%= block_title(block.title) %>
2 2  
  3 +<%= block.links.empty? && block.title.empty? ? content_tag('em', _('Please, edit this block to add links')) : '' %>
  4 +
3 5 <ul>
4 6 <% block.links.select{|i| !i[:name].blank? and !i[:address].blank?}.each do |link| %>
5 7 <li>
... ...
test/unit/link_list_block_test.rb
... ... @@ -134,4 +134,9 @@ class LinkListBlockTest &lt; ActiveSupport::TestCase
134 134 assert_match /title="mytitle"/, render_block_content(l)
135 135 end
136 136  
  137 + should 'display default message to brand new blocks with no links' do
  138 + l = LinkListBlock.new
  139 + assert_match /Please, edit this block to add links/, render_block_content(l)
  140 + end
  141 +
137 142 end
... ...