Commit cbf1bf90f5dab50bdad52b7105a712d461aa6f81
1 parent
99f5d74c
Exists in
web_steps_improvements
and in
9 other branches
link block: shows default message for new blocks with no links
Add a help message for the user. Closes #144
Showing
2 changed files
with
7 additions
and
0 deletions
Show diff stats
app/views/blocks/link_list.html.erb
| 1 | <%= block_title(block.title) %> | 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 | <ul> | 5 | <ul> |
| 4 | <% block.links.select{|i| !i[:name].blank? and !i[:address].blank?}.each do |link| %> | 6 | <% block.links.select{|i| !i[:name].blank? and !i[:address].blank?}.each do |link| %> |
| 5 | <li> | 7 | <li> |
test/unit/link_list_block_test.rb
| @@ -134,4 +134,9 @@ class LinkListBlockTest < ActiveSupport::TestCase | @@ -134,4 +134,9 @@ class LinkListBlockTest < ActiveSupport::TestCase | ||
| 134 | assert_match /title="mytitle"/, render_block_content(l) | 134 | assert_match /title="mytitle"/, render_block_content(l) |
| 135 | end | 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 | end | 142 | end |