Commit 76f8ef7bb2392c0413265c2f250437bad392718f
Committed by
Marcos Ramos
1 parent
fca8659a
Exists in
master
and in
29 other branches
link-list-block: Add "target" option to block edit view.
(ActionItem2795) Signed-off-by: Guilherme C. Muniz<guilherme.cmuniz@gmail.com> Signed-off-by: Lucas Couto<loc.unb@gmail.com> Signed-off-by: Marcos Ramos<ms.ramos@outlook.com> Signed-off-by: Rafael de Souza Queiroz<querafael@live.com> Signed-off-by: Victor Carvalho<victorhugodf.ac@gmail.com>
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
app/models/link_list_block.rb
@@ -57,7 +57,7 @@ class LinkListBlock < Block | @@ -57,7 +57,7 @@ class LinkListBlock < Block | ||
57 | def link_html(link) | 57 | def link_html(link) |
58 | klass = 'icon-' + link[:icon] if link[:icon] | 58 | klass = 'icon-' + link[:icon] if link[:icon] |
59 | sanitize_link( | 59 | sanitize_link( |
60 | - link_to(link[:name], expand_address(link[:address]), :class => klass) | 60 | + link_to(link[:name], expand_address(link[:address]), :target => link[:target], :class => klass) |
61 | ) | 61 | ) |
62 | end | 62 | end |
63 | 63 |
app/views/box_organizer/_link_list_block.rhtml
1 | <strong><%= _('Links') %></strong> | 1 | <strong><%= _('Links') %></strong> |
2 | <div id='edit-link-list-block' style='width:450px'> | 2 | <div id='edit-link-list-block' style='width:450px'> |
3 | <table id='links' class='noborder'> | 3 | <table id='links' class='noborder'> |
4 | - <tr><th><%= _('Icon') %></th><th><%= _('Name') %></th><th><%= _('Address') %></th></tr> | 4 | + <tr><th><%= _('Icon') %></th><th><%= _('Name') %></th><th><%= _('Address') %></th><th><%= _('Target') %></th></tr> |
5 | <% for link in @block.links do %> | 5 | <% for link in @block.links do %> |
6 | <tr> | 6 | <tr> |
7 | <td> | 7 | <td> |
@@ -9,6 +9,9 @@ | @@ -9,6 +9,9 @@ | ||
9 | </td> | 9 | </td> |
10 | <td><%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %></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> | 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([[_('Same page'), '_self'], [_('New tab'), '_blank'], [_('New window'), '_new']], link[:target].blank? ? '_self' : link[:target])) %> | ||
14 | + </td> | ||
12 | </tr> | 15 | </tr> |
13 | <% end %> | 16 | <% end %> |
14 | </table> | 17 | </table> |
@@ -18,7 +21,8 @@ | @@ -18,7 +21,8 @@ | ||
18 | page.insert_html :bottom, 'links', content_tag('tr', | 21 | page.insert_html :bottom, 'links', content_tag('tr', |
19 | content_tag('td', icon_selector('ok')) + | 22 | content_tag('td', icon_selector('ok')) + |
20 | content_tag('td', text_field_tag('block[links][][name]', '', :maxlength => 20)) + | 23 | content_tag('td', text_field_tag('block[links][][name]', '', :maxlength => 20)) + |
21 | - content_tag('td', text_field_tag('block[links][][address]', nil, :class => 'cel-address')) | 24 | + content_tag('td', text_field_tag('block[links][][address]', nil, :class => 'cel-address')) + |
25 | + content_tag('td', select_tag('block[links][][target]',options_for_select([['Mesma pagina', '_self'], ['Nova aba', '_blank'], ['Nova Janela', '_new']], '_self'))) | ||
22 | ) + | 26 | ) + |
23 | javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight") | 27 | javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight") |
24 | end %> | 28 | end %> |