Commit 7261d10e93332914d6ceb6910178e572e1030f6a
1 parent
10e71235
Exists in
master
and in
28 other branches
Adding a "Close" link to the image zoom dialog
Showing
2 changed files
with
11 additions
and
1 deletions
Show diff stats
app/views/cms/_text_editor_sidebar.rhtml
1 | 1 | <div class='text-editor-sidebar'> |
2 | 2 | <meta name='button.add' value='<%= _('Add to the text') %>'/> |
3 | 3 | <meta name='button.zoom' value='<%= _('Zoom in') %>'/> |
4 | + <meta name='button.close' value='<%= _('Close') %>'/> | |
4 | 5 | <%= render(:partial => 'textile_quick_reference') if @article.is_a?(TextileArticle) %> |
5 | 6 | <div class='text-editor-sidebar-box' id='media-upload-box'> |
6 | 7 | <div class='header'<strong><%= _('Media upload') %></strong></div> | ... | ... |
public/javascripts/article.js
... | ... | @@ -26,6 +26,7 @@ jQuery(function($) { |
26 | 26 | |
27 | 27 | var button_add = $('.text-editor-sidebar meta[name=button.add]').attr('value'); |
28 | 28 | var button_zoom = $('.text-editor-sidebar meta[name=button.zoom]').attr('value'); |
29 | + var button_close = $('.text-editor-sidebar meta[name=button.close]').attr('value'); | |
29 | 30 | |
30 | 31 | function add_to_text_button() { |
31 | 32 | return '<a class="button icon-add add-to-text" href="#"><span>' + button_add + '</span></a>'; |
... | ... | @@ -35,6 +36,10 @@ jQuery(function($) { |
35 | 36 | return '<a class="add-to-text" href="#">' + button_add + '</a>'; |
36 | 37 | } |
37 | 38 | |
39 | + function close_link() { | |
40 | + return '<a class="close" href="#">' + button_close + '</a>'; | |
41 | + } | |
42 | + | |
38 | 43 | function zoom_button() { |
39 | 44 | return '<a class="button icon-zoom zoom" href="#" title="' + button_zoom + '"><span>' + button_zoom + '</span></a>'; |
40 | 45 | } |
... | ... | @@ -88,9 +93,13 @@ jQuery(function($) { |
88 | 93 | var $item = $(this).closest('.item'); |
89 | 94 | var html_selector = $item.attr('data-item'); |
90 | 95 | var img = $item.find(html_selector).find('img').attr('src'); |
91 | - $.colorbox({ html: '<div class="item" data-item="div"><div><img src="' + img + '" style="max-width: 580px; max-height: 580px"/></div>' + '<div class="controls" style="padding-top: 5px;">' + add_to_text_link() + '</div></div>', maxWidth: '640px', maxHeight: '670px', scrolling: false }); | |
96 | + $.colorbox({ html: '<div class="item" data-item="div"><div><img src="' + img + '" style="max-width: 580px; max-height: 580px"/></div>' + '<div class="controls" style="padding-top: 5px;">' + add_to_text_link() + ' ' + close_link() + '</div></div>', maxWidth: '640px', maxHeight: '670px', scrolling: false }); | |
92 | 97 | return false; |
93 | 98 | }); |
99 | + $('.controls a.close').live('click', function() { | |
100 | + $.colorbox.close(); | |
101 | + return false; | |
102 | + }) | |
94 | 103 | |
95 | 104 | // FIXME the user may also want to add the item to the abstract textarea! |
96 | 105 | var text_field = 'article_body'; | ... | ... |