diff --git a/public/javascripts/article.js b/public/javascripts/article.js
index 206d98f..cc7727f 100644
--- a/public/javascripts/article.js
+++ b/public/javascripts/article.js
@@ -27,12 +27,16 @@ jQuery(function($) {
var button_add = $('.text-editor-sidebar meta[name=button.add]').attr('value');
var button_zoom = $('.text-editor-sidebar meta[name=button.zoom]').attr('value');
- function add_to_text_button(item) {
- return '' + button_add + '';
+ function add_to_text_button() {
+ return '' + button_add + '';
}
- function zoom_button(item) {
- return '' + button_zoom + '/span>';
+ function add_to_text_link() {
+ return '' + button_add + '';
+ }
+
+ function zoom_button() {
+ return '' + button_zoom + '';
}
function list_items(items, selector) {
@@ -55,11 +59,11 @@ jQuery(function($) {
});
$.each(images, function(i, item) {
- html_for_items += '

' + add_to_text_button(item) + zoom_button(item) + '
';
+ html_for_items += '
' + add_to_text_button() + zoom_button() + '
';
});
$.each(files, function(i, item) {
- html_for_items += ' ' + add_to_text_button(item) + '
';
+ html_for_items += ' ' + add_to_text_button() + '
';
});
$.each(errors, function(i, item) {
@@ -67,21 +71,23 @@ jQuery(function($) {
});
$(selector).html(html_for_items);
- $(selector).find('.controls a.icon-add').click(function() {
- var $item = $(this).closest('.item');
- var html_selector = $item.attr('data-item');
- insert_item_in_text($item.find(html_selector));
- return false;
- });
- $(selector).find('.controls a.icon-zoom').click(function() {
- var $item = $(this).closest('.item');
- var html_selector = $item.attr('data-item');
- var img = $item.find(html_selector).find('img').attr('src');
- $.colorbox({ html: '
', maxWidth: '640px', maxHeight: '640px', scrolling: false });
- return false;
- });
}
+ $('.controls a.add-to-text').live('click', function() {
+ var $item = $(this).closest('.item');
+ var html_selector = $item.attr('data-item');
+ insert_item_in_text($item.find(html_selector));
+ $.colorbox.close();
+ return false;
+ });
+ $('.controls a.zoom').live('click', function() {
+ var $item = $(this).closest('.item');
+ var html_selector = $item.attr('data-item');
+ var img = $item.find(html_selector).find('img').attr('src');
+ $.colorbox({ html: '' + '
' + add_to_text_link() + '
', maxWidth: '640px', maxHeight: '670px', scrolling: false });
+ return false;
+ });
+
// FIXME the user may also want to add the item to the abstract textarea!
var text_field = 'article_body';
--
libgit2 0.21.2