# HG changeset patch # User Brian Neal # Date 1252865118 0 # Node ID 23035afdeae816a716e703c7556933f20bc50995 # Parent 806399f3b9504efb8f53fd7966d8d47bbfb78907 Forums: use markitup editor on forums post forms. diff -r 806399f3b950 -r 23035afdeae8 gpp/forums/forms.py --- a/gpp/forums/forms.py Sun Sep 13 05:01:52 2009 +0000 +++ b/gpp/forums/forms.py Sun Sep 13 18:05:18 2009 +0000 @@ -2,6 +2,7 @@ Forms for the forums application. """ from django import forms +from django.conf import settings from forums.models import Topic from forums.models import Post @@ -14,7 +15,11 @@ topic = None class Media: - js = ('js/forums.js', ) + css = { + 'all': settings.GPP_THIRD_PARTY_CSS['markitup'], + } + js = settings.GPP_THIRD_PARTY_JS['markitup'] + \ + ('js/forums.js', ) def clean_topic_id(self): id = self.cleaned_data['topic_id'] @@ -38,9 +43,17 @@ class NewTopicForm(forms.Form): """Form for creating a new topic and 1st post to that topic.""" - name = forms.CharField(label='Subject', max_length=255) + name = forms.CharField(label='Subject', max_length=255, + widget=forms.TextInput(attrs={'size': 64})) body = forms.CharField(label='', widget=forms.Textarea) + class Media: + css = { + 'all': settings.GPP_THIRD_PARTY_CSS['markitup'], + } + js = settings.GPP_THIRD_PARTY_JS['markitup'] + \ + ('js/forums.js', ) + def save(self, forum, user, ip=None): """ Creates the new Topic and first Post from the form data and supplied diff -r 806399f3b950 -r 23035afdeae8 gpp/templates/forums/new_topic.html --- a/gpp/templates/forums/new_topic.html Sun Sep 13 05:01:52 2009 +0000 +++ b/gpp/templates/forums/new_topic.html Sun Sep 13 18:05:18 2009 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% block title %}Forums: New Topic{% endblock %} +{% block custom_js %}{{ form.media }}{% endblock %} {% block content %}

{{ forum.name }} - New Topic

diff -r 806399f3b950 -r 23035afdeae8 gpp/templates/forums/post.html --- a/gpp/templates/forums/post.html Sun Sep 13 05:01:52 2009 +0000 +++ b/gpp/templates/forums/post.html Sun Sep 13 18:05:18 2009 +0000 @@ -1,2 +1,3 @@ {% load markup %} -{{ data|markdown:"safe" }} +{% load smiley_tags %} +{{ data|markdown:"safe"|smilify }} diff -r 806399f3b950 -r 23035afdeae8 media/js/forums.js --- a/media/js/forums.js Sun Sep 13 05:01:52 2009 +0000 +++ b/media/js/forums.js Sun Sep 13 18:05:18 2009 +0000 @@ -31,4 +31,5 @@ }); return false; }); + $('#id_body').markItUp(mySettings); });