From c1862e35771103c5c9b6f7b85712a9a105e2e4f8 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 12 Jul 2012 11:05:49 -0300 Subject: [PATCH] When uploading, add images directly to the text --- public/javascripts/article.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/javascripts/article.js b/public/javascripts/article.js index cc7727f..e91ae9b 100644 --- a/public/javascripts/article.js +++ b/public/javascripts/article.js @@ -39,7 +39,7 @@ jQuery(function($) { return '' + button_zoom + ''; } - function list_items(items, selector) { + function list_items(items, selector, auto_add) { var html_for_items = ''; var images = []; @@ -71,6 +71,10 @@ jQuery(function($) { }); $(selector).html(html_for_items); + + if (auto_add) { + $(selector).find('a.add-to-text').click(); + } } $('.controls a.add-to-text').live('click', function() { @@ -118,7 +122,7 @@ jQuery(function($) { var $button = $(this); $('#media-search-box .header').toggleClass('icon-loading'); $.get($(this).parent().attr('action'), { 'q': query }, function(data) { - list_items(data, '#media-search-results .items'); + list_items(data, '#media-search-results .items', false); if (data.length && data.length > 0) { $('#media-search-results').slideDown(); } @@ -137,7 +141,7 @@ jQuery(function($) { }, success: function(data) { - list_items(data, '#media-upload-results .items'); + list_items(data, '#media-upload-results .items', true); if (data.length && data.length > 0) { $('#media-upload-results').slideDown(); } -- libgit2 0.21.2