Commit 5ff853b462911055f0b0b82ce22c8a738d0dea98
Exists in
master
and in
22 other branches
Merge branch 'AI2925-add_tittle_field_on_link_list_block' of https://gitlab.com/…
…unb-gama/noosfero into AI2925-add_tittle_field_on_link_list_block Conflicts: app/views/box_organizer/_link_list_block.rhtml
Showing
4 changed files
with
25 additions
and
16 deletions
Show diff stats
app/models/link_list_block.rb
... | ... | @@ -63,7 +63,7 @@ class LinkListBlock < Block |
63 | 63 | def link_html(link) |
64 | 64 | klass = 'icon-' + link[:icon] if link[:icon] |
65 | 65 | sanitize_link( |
66 | - link_to(link[:name], expand_address(link[:address]), :target => link[:target], :class => klass) | |
66 | + link_to(link[:name], expand_address(link[:address]), :target => link[:target], :class => klass, :title => link[:title]) | |
67 | 67 | ) |
68 | 68 | end |
69 | 69 | ... | ... |
app/views/box_organizer/_link_list_block.rhtml
1 | 1 | <strong><%= _('Links') %></strong> |
2 | -<div id='edit-link-list-block' style='width:450px'> | |
3 | -<table id='links' class='noborder'> | |
4 | - <tr><th><%= _('Icon') %></th><th><%= _('Name') %></th><th><%= _('Address') %></th><th><%= _('Target') %></th></tr> | |
2 | +<div id='edit-link-list-block' style='width: 820px;'> | |
3 | +<table id='links' class='noborder' style="width:auto;"> | |
4 | + <tr> | |
5 | + <th><%= _('Icon') %></th> | |
6 | + <th><%= _('Name') %></th> | |
7 | + <th><%= _('Address') %></th> | |
8 | + <th><%= _('Title') %></th> | |
9 | + <th><%= _('Target') %></th> | |
10 | + </tr> | |
5 | 11 | <% for link in @block.links do %> |
6 | - <tr> | |
7 | - <td> | |
8 | - <%= icon_selector(link['icon']) %> | |
9 | - </td> | |
10 | - <td><%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %></td> | |
11 | - <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address], :class => 'link-address' %></td> | |
12 | - <td> | |
13 | - <%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %> | |
14 | - </td> | |
15 | - </tr> | |
12 | + <tr> | |
13 | + <td><%= icon_selector(link['icon']) %></td> | |
14 | + <td><%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %></td> | |
15 | + <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address], :class => 'link-address' %></td> | |
16 | + <td><%= text_field_tag 'block[links][][title]', link[:title], :class => 'link-title' %></td> | |
17 | + <td><%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %></td> | |
18 | + </tr> | |
16 | 19 | <% end %> |
17 | 20 | </table> |
18 | 21 | </div> |
... | ... | @@ -22,8 +25,8 @@ |
22 | 25 | content_tag('td', icon_selector('ok')) + |
23 | 26 | content_tag('td', text_field_tag('block[links][][name]', '', :maxlength => 20)) + |
24 | 27 | content_tag('td', text_field_tag('block[links][][address]', nil, :class => 'link-address'), :class => 'cel-address') + |
25 | - content_tag('td', select_tag('block[links][][target]', | |
26 | -options_for_select(LinkListBlock::TARGET_OPTIONS, '_self'))) | |
28 | + content_tag('td', text_field_tag('block[links][][title]', '', :class => 'link-title'), :class => 'cel-address' ) + | |
29 | + content_tag('td', select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, '_self'))) | |
27 | 30 | ) + |
28 | 31 | javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight") |
29 | 32 | end %> | ... | ... |
public/stylesheets/application.css
test/unit/link_list_block_test.rb
... | ... | @@ -86,4 +86,9 @@ class LinkListBlockTest < ActiveSupport::TestCase |
86 | 86 | assert_equivalent LinkListBlock::TARGET_OPTIONS.map {|t|t[1]}, ['_self', '_blank', '_new'] |
87 | 87 | end |
88 | 88 | |
89 | + should 'link with title' do | |
90 | + l = LinkListBlock.new | |
91 | + assert_match /title="mytitle"/, l.link_html({:name => 'mylink', :address => '/myaddress', :title => 'mytitle'}) | |
92 | + end | |
93 | + | |
89 | 94 | end | ... | ... |