diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-02-08 16:27:52 +0100 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-02-08 16:27:52 +0100 |
commit | 671f4bb859d6f8927c97504b97ecf14cb6318fdb (patch) | |
tree | db4c0520fa56e16f26003294e2564c5622a43fe0 | |
parent | 13d11029ba45fa49855b3e346e3425ac1dce0702 (diff) | |
download | hyperkitty-671f4bb859d6f8927c97504b97ecf14cb6318fdb.tar.gz hyperkitty-671f4bb859d6f8927c97504b97ecf14cb6318fdb.tar.xz hyperkitty-671f4bb859d6f8927c97504b97ecf14cb6318fdb.zip |
WIP: Create new thread button
-rw-r--r-- | hyperkitty/static/css/hyperkitty.css | 9 | ||||
-rw-r--r-- | hyperkitty/templates/message_new.html | 33 | ||||
-rw-r--r-- | hyperkitty/templates/thread_list.html | 2 | ||||
-rw-r--r-- | hyperkitty/urls.py | 2 | ||||
-rw-r--r-- | hyperkitty/views/message.py | 18 |
5 files changed, 62 insertions, 2 deletions
diff --git a/hyperkitty/static/css/hyperkitty.css b/hyperkitty/static/css/hyperkitty.css index 5381e86..1c7a4ca 100644 --- a/hyperkitty/static/css/hyperkitty.css +++ b/hyperkitty/static/css/hyperkitty.css @@ -394,6 +394,15 @@ form.likeform { margin-right: 4em; } +#thread-list .thread-list-header .thread-new { + float: right; +} +#thread-list .thread-list-header .thread-new strong { + font-size: 150%; + font-weight: bold; + margin-right: 0.2em; +} + /* Thread view */ diff --git a/hyperkitty/templates/message_new.html b/hyperkitty/templates/message_new.html new file mode 100644 index 0000000..c630127 --- /dev/null +++ b/hyperkitty/templates/message_new.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} +{% load gravatar %} +{% load hk_generic %} +{% load storm %} + + +{% block title %} +Create a new thread - {{ mlist.display_name|default:mlist.name|escapeemail }} - {{ app_name|title }} +{% endblock %} + +{% block content %} + +<div class="row-fluid"> + +{% include 'threads/month_list.html' %} + + <div class="span7"> + + <div class="message-header"> + <h1>Create a new thread</h1> + </div> + + <section id="thread_content"> + {% include 'messages/reply_form.html' %} + </section> + + </div> + +</div> + +{% endblock %} + +{# vim: set noet: #} diff --git a/hyperkitty/templates/thread_list.html b/hyperkitty/templates/thread_list.html index cb95daa..d11fdf3 100644 --- a/hyperkitty/templates/thread_list.html +++ b/hyperkitty/templates/thread_list.html @@ -19,6 +19,8 @@ <h1>{{ mlist.display_name|default:mlist.name|escapeemail }} <small>{{ list_title }}</small> </h1> + <a href="{% url message_new mlist_fqdn=mlist.name %}" + class="thread-new btn"><strong>+</strong> Start a new thread</a> <ul class="thread-list-info"> {% if mlist.display_name %} <li class="list-address"> diff --git a/hyperkitty/urls.py b/hyperkitty/urls.py index e9132cc..dc778ec 100644 --- a/hyperkitty/urls.py +++ b/hyperkitty/urls.py @@ -64,6 +64,8 @@ urlpatterns = patterns('hyperkitty.views', 'message.vote', name='message_vote'), url(r'^list/(?P<mlist_fqdn>[^/@]+@[^/@]+)/message/(?P<message_id_hash>\w+)/reply$', 'message.reply', name='message_reply'), + url(r'^list/(?P<mlist_fqdn>[^/@]+@[^/@]+)/message/new$', + 'message.new_message', name='message_new'), # Thread url(r'^list/(?P<mlist_fqdn>[^/@]+@[^/@]+)/thread/(?P<threadid>\w+)/$', diff --git a/hyperkitty/views/message.py b/hyperkitty/views/message.py index e64ac5f..b0f543b 100644 --- a/hyperkitty/views/message.py +++ b/hyperkitty/views/message.py @@ -26,7 +26,7 @@ import urllib import django.utils.simplejson as simplejson from django.http import HttpResponse, HttpResponseRedirect, Http404 -from django.shortcuts import redirect, render +from django.shortcuts import redirect, render, render_to_response from django.template import RequestContext, loader from django.conf import settings from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger, InvalidPage @@ -139,7 +139,7 @@ def vote(request, mlist_fqdn, message_id_hash): @login_required def reply(request, mlist_fqdn, message_id_hash): """ Sends a reply to the list. - TODO: unit tests + TODO: unit tests, make sure a message-id is generated """ if request.method != 'POST': return HttpResponse("Something went wrong", content_type="text/plain", status=500) @@ -165,3 +165,17 @@ def reply(request, mlist_fqdn, message_id_hash): }) reply.send() return HttpResponse("The reply has been sent successfully.", mimetype="text/plain") + + +@login_required +def new_message(request, mlist_fqdn): + """ Sends a new thread-starting message to the list. + TODO: unit tests, make sure a message-id is generated + """ + store = get_store(request) + mlist = store.get_list(mlist_fqdn) + context = { + "mlist": mlist, + } + return render_to_response("message_new.html", context, + context_instance=RequestContext(request)) |