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/user_pages/routing.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mediagoblin/user_pages/routing.py') diff --git a/mediagoblin/user_pages/routing.py b/mediagoblin/user_pages/routing.py index 9cb665b5..b1dde397 100644 --- a/mediagoblin/user_pages/routing.py +++ b/mediagoblin/user_pages/routing.py @@ -32,6 +32,10 @@ add_route('mediagoblin.user_pages.media_post_comment', '/u//m//comment/add/', 'mediagoblin.user_pages.views:media_post_comment') +add_route('mediagoblin.user_pages.media_preview_comment', + '/ajax/comment/preview/', + 'mediagoblin.user_pages.views:media_preview_comment') + add_route('mediagoblin.user_pages.user_gallery', '/u//gallery/', 'mediagoblin.user_pages.views:user_gallery') -- cgit v1.2.3