diff media/js/forums.js @ 127:2d299909e074

Adding markdown help to comments and forums. Still need to add it to a few other places that use the markItUp editor.
author Brian Neal <bgneal@gmail.com>
date Mon, 16 Nov 2009 01:00:28 +0000
parents b0d62247c3e4
children 13330e1836f3
line wrap: on
line diff
--- a/media/js/forums.js	Sat Nov 14 20:30:31 2009 +0000
+++ b/media/js/forums.js	Mon Nov 16 01:00:28 2009 +0000
@@ -110,4 +110,26 @@
          }
          return false;
       });
+   $('#markdown_help_dialog').dialog({autoOpen: false, width: 720, height: 600});
+   var firstTimeMd = true;
+   $('#markdown_help').click(function () {
+         $('#markdown_help_dialog').dialog('open');
+         if (firstTimeMd) {
+            $.ajax({
+               url: '/core/markdown_help/',
+               type: 'GET',
+               dataType: 'html',
+               success: function(data, textStatus) {
+                  var img = $('#markdown_busy');
+                  img.hide();
+                  img.after(data);
+                  firstTimeMd = false;
+               },
+               error: function (xhr, textStatus, ex) {
+                  alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText);
+               }
+            });
+         }
+         return false;
+      });
 });