From 5ab60299619557307cf38aa14824c8576f23f21c Mon Sep 17 00:00:00 2001 From: Emily O'Leary Date: Sun, 24 Mar 2013 21:42:42 -0400 Subject: Added comment preview functionality to user pages. It works by passing the comment's value as a JSON string to a new handler that lives at /ajax/comment/preview. The query string is decoded, unquoted, and has its leading and trailing quotes removed to match the input that cleaned_markdown_conversion expects. It does this in real time with a 500ms lag by using a timer. Initially I tried the onChange handler but you need to lose focus for that to process. The javascript timer is only invoked if the add comment button is pressed. A request is only sent if the comment box is not empty and the current value is not the same as the last value. --- mediagoblin/static/js/comment_show.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mediagoblin/static') diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js index c5ccee66..cb69fccd 100644 --- a/mediagoblin/static/js/comment_show.js +++ b/mediagoblin/static/js/comment_show.js @@ -15,12 +15,24 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ +var content=""; +function previewComment(){ + if ($('#comment_content').val() && (content != $('#comment_content').val())) { + content = $('#comment_content').val(); + $.getJSON($('#previewURL').val(),JSON.stringify($('#comment_content').val()), + function(data){ + $('#comment_preview').replaceWith("

Comment Preview


" + decodeURIComponent(data) + + "
"); + }); + } +} $(document).ready(function(){ $('#form_comment').hide(); $('#button_addcomment').click(function(){ $(this).fadeOut('fast'); $('#form_comment').slideDown(function(){ + setInterval("previewComment()",500); $('#comment_content').focus(); }); }); -- cgit v1.2.3 From bb3299ce219d538cc2c3b0f41f535665fb901aff Mon Sep 17 00:00:00 2001 From: Emily O'Leary Date: Sun, 24 Mar 2013 22:16:12 -0400 Subject: Added i18n to my javascript changes as per trac #417 --- mediagoblin/static/js/comment_show.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/static') diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js index cb69fccd..35183beb 100644 --- a/mediagoblin/static/js/comment_show.js +++ b/mediagoblin/static/js/comment_show.js @@ -22,7 +22,7 @@ function previewComment(){ content = $('#comment_content').val(); $.getJSON($('#previewURL').val(),JSON.stringify($('#comment_content').val()), function(data){ - $('#comment_preview').replaceWith("

Comment Preview


" + decodeURIComponent(data) + + $('#comment_preview').replaceWith("

{% trans -%}Comment Preview{%- endtrans %}


" + decodeURIComponent(data) + "
"); }); } -- cgit v1.2.3 From 3bd62dc4ca4fb12c772729bbb9dd6a78c3c08e48 Mon Sep 17 00:00:00 2001 From: Emily O'Leary Date: Tue, 6 Aug 2013 18:22:51 -0400 Subject: Changed how the comment was encoded/read. Fixed CSRF + Post with comment preview. Merged with latest master --- mediagoblin/static/js/comment_show.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'mediagoblin/static') diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js index 35183beb..42a21817 100644 --- a/mediagoblin/static/js/comment_show.js +++ b/mediagoblin/static/js/comment_show.js @@ -18,21 +18,22 @@ var content=""; function previewComment(){ - if ($('#comment_content').val() && (content != $('#comment_content').val())) { - content = $('#comment_content').val(); - $.getJSON($('#previewURL').val(),JSON.stringify($('#comment_content').val()), - function(data){ - $('#comment_preview').replaceWith("

{% trans -%}Comment Preview{%- endtrans %}


" + decodeURIComponent(data) + - "
"); - }); - } + if ($('#comment_content').val() && (content != $('#comment_content').val())) { + content = $('#comment_content').val(); + $.post($('#previewURL').val(),$('#form_comment').serialize(), + function(data){ + preview = JSON.parse(data) + $('#comment_preview').replaceWith("

" + $('#previewText').val() +"


" + preview.content + + "
"); + }); + } } $(document).ready(function(){ $('#form_comment').hide(); $('#button_addcomment').click(function(){ $(this).fadeOut('fast'); $('#form_comment').slideDown(function(){ - setInterval("previewComment()",500); + setInterval("previewComment()",500); $('#comment_content').focus(); }); }); -- cgit v1.2.3 From b2d6c45850a7627110a464e398b82f1e3a79e9a4 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Wed, 7 Aug 2013 16:58:06 -0700 Subject: change interval to 1000ms --- mediagoblin/static/js/comment_show.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/static') diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js index 42a21817..df3c1093 100644 --- a/mediagoblin/static/js/comment_show.js +++ b/mediagoblin/static/js/comment_show.js @@ -33,7 +33,7 @@ $(document).ready(function(){ $('#button_addcomment').click(function(){ $(this).fadeOut('fast'); $('#form_comment').slideDown(function(){ - setInterval("previewComment()",500); + setInterval("previewComment()",1000); $('#comment_content').focus(); }); }); -- cgit v1.2.3 From 4de7db6fefa17c5c87b07c7aeccb098b9ec403b2 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 8 Aug 2013 14:15:23 -0500 Subject: Switching the MediaGoblin homepage image over to using the "official" gavroche style --- mediagoblin/static/images/home_goblin.png | Bin 0 -> 61657 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mediagoblin/static/images/home_goblin.png (limited to 'mediagoblin/static') diff --git a/mediagoblin/static/images/home_goblin.png b/mediagoblin/static/images/home_goblin.png new file mode 100644 index 00000000..5ba9afeb Binary files /dev/null and b/mediagoblin/static/images/home_goblin.png differ -- cgit v1.2.3