# HG changeset patch # User Brian Neal # Date 1259292615 0 # Node ID 13330e1836f33c872b9fda5a8a25113796a8a1c6 # Parent b8474ffe76d907da57dd6b030edb19927c8906d5 Cutting forums over to the new common way to add markItUp, extra smileys, and markdown help. diff -r b8474ffe76d9 -r 13330e1836f3 gpp/forums/forms.py --- a/gpp/forums/forms.py Fri Nov 27 00:39:50 2009 +0000 +++ b/gpp/forums/forms.py Fri Nov 27 03:30:15 2009 +0000 @@ -11,7 +11,8 @@ class NewPostForm(forms.Form): """Form for creating a new post.""" - body = forms.CharField(label='', widget=forms.Textarea) + body = forms.CharField(label='', + widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) topic_id = forms.IntegerField(widget=forms.HiddenInput) topic = None @@ -50,7 +51,8 @@ """ name = forms.CharField(label='Subject', max_length=255, widget=forms.TextInput(attrs={'size': 64})) - body = forms.CharField(label='', widget=forms.Textarea) + body = forms.CharField(label='', + widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) user = None forum = None has_mod_fields = False @@ -98,7 +100,8 @@ """ Form for editing an existing post or a new, non-quick post. """ - body = forms.CharField(label='', widget=forms.Textarea) + body = forms.CharField(label='', + widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) class Meta: model = Post diff -r b8474ffe76d9 -r 13330e1836f3 gpp/templates/forums/show_form.html --- a/gpp/templates/forums/show_form.html Fri Nov 27 00:39:50 2009 +0000 +++ b/gpp/templates/forums/show_form.html Fri Nov 27 03:30:15 2009 +0000 @@ -1,17 +1,9 @@ +{% load core_tags %}
{{ legend_text }} {{ form.as_p }} - -More smileys - -Help +{% comment_dialogs %}
-
-Loading -
-
-Loading -
diff -r b8474ffe76d9 -r 13330e1836f3 media/js/forums.js --- a/media/js/forums.js Fri Nov 27 00:39:50 2009 +0000 +++ b/media/js/forums.js Fri Nov 27 03:30:15 2009 +0000 @@ -82,54 +82,4 @@ return confirm('Are you sure you want to delete this topic?\n' + 'WARNING: all posts will be lost.'); }); - $('#id_body').markItUp(mySettings); - $('#smileys_dialog').dialog({autoOpen:false}); - var firstTime = true; - $('#more_smileys').click(function () { - $('#smileys_dialog').dialog('open'); - var postBox = $('#id_body')[0]; - if (firstTime) { - $.ajax({ - url: '/smiley/farm/extra/', - type: 'GET', - dataType: 'html', - success: function(data, textStatus) { - var img = $('#smiley_busy'); - img.hide(); - img.after(data); - $('#smileys_dialog .smiley_farm img').click(function() { - postBox.value += ' ' + this.alt + ' '; - postBox.focus(); - }); - firstTime = false; - }, - error: function (xhr, textStatus, ex) { - alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); - } - }); - } - 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; - }); });