[Git][noosfero/noosfero][master] 2 commits: link block: shows default message for new blocks with no links

Bráulio Bhavamitra gitlab at mg.gitlab.com
Thu Mar 17 13:29:50 BRT 2016


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
cbf1bf90 by Larissa Reis at 2016-03-16T22:56:37-03:00
link block: shows default message for new blocks with no links

  Add a help message for the user. Closes #144

- - - - -
940ab514 by Bráulio Bhavamitra at 2016-03-17T16:29:04+00:00
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
- - - - -


2 changed files:

- app/views/blocks/link_list.html.erb
- test/unit/link_list_block_test.rb


Changes:

=====================================
app/views/blocks/link_list.html.erb
=====================================
--- a/app/views/blocks/link_list.html.erb
+++ b/app/views/blocks/link_list.html.erb
@@ -1,5 +1,7 @@
 <%= block_title(block.title) %>
 
+<%= block.links.empty? && block.title.empty? ? content_tag('em', _('Please, edit this block to add links')) : '' %>
+
 <ul>
   <% block.links.select{|i| !i[:name].blank? and !i[:address].blank?}.each do |link| %>
     <li>


=====================================
test/unit/link_list_block_test.rb
=====================================
--- a/test/unit/link_list_block_test.rb
+++ b/test/unit/link_list_block_test.rb
@@ -134,4 +134,9 @@ class LinkListBlockTest < ActiveSupport::TestCase
     assert_match /title="mytitle"/, render_block_content(l)
   end
 
+  should 'display default message to brand new blocks with no links' do
+    l = LinkListBlock.new
+    assert_match /Please, edit this block to add links/, render_block_content(l)
+  end
+
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/3018162d6165536bf2f2c4a61c142f6b0e24d3a5...940ab5143c8abf0c75733a040ebad927f641b1f8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160317/f6dd714c/attachment.html>


More information about the Noosfero-dev mailing list