adds quoting to lofi

This commit is contained in:
Nathan Dinsmore 2013-02-18 18:59:03 -05:00
parent 135e4bd6bf
commit 05eec6deae
7 changed files with 62 additions and 4 deletions

View file

@ -219,16 +219,30 @@ article header {
article h1 {
font-size: 1em;
margin: 0;
line-height: 18px;
}
article header p {
margin: 6px 0 0;
}
article header a {
display: block;
margin: -6px -12px;
padding: 6px 12px;
color: #fff !important;
padding: 6px 6px 6px 7px;
margin: -6px 12px -6px -12px;
text-decoration: none;
float: left;
width: 18px;
height: 18px;
overflow: hidden;
color: transparent !important;
cursor: pointer;
background: url(../img/lofi_reply.png) center center no-repeat;
-webkit-tap-highlight-color: transparent;
border-right: 1px solid #555;
box-shadow: inset -1px 0 #aaa;
}
article header a:active {
background-color: #666;
box-shadow: inset 0 1px #888, inset -1px 0 #888;
}
article time {
float: right;

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

View file

@ -1,5 +1,5 @@
{% load i18n %}
<form class=post-editor method=post>
<form class=post-editor method=post id=reply>
{% csrf_token %}
{{ form.non_field_errors }}
{% if forum %}

View file

@ -0,0 +1,16 @@
{% extends 'djangobb_forum/lofi/base.html' %}
{% load i18n %}
{% load forum_extras %}
{% block full-link %}{% url djangobb:topic post.topic.id %}{% endblock %}
{% block title %}
<span><a href="{% url djangobb:lofi_index %}">{% trans "Scratch Forums" %}</a></span>
<span>{% lofi_link post.topic.forum %}</span>
<span>{% lofi_link post.topic %}</span>
{% block page-name %}{% trans "Reply" %}{% endblock %}
{% endblock %}
{% block content %}
{% include 'djangobb_forum/lofi/includes/post_form.html' %}
{% endblock %}

View file

@ -20,6 +20,7 @@
<article id=post-{{ post.id }}>
<header>
<time datetime={{ post.created|date:"c" }}>{{ post.created|localtime|forum_time }}</time>
<a class=reply href="{% url djangobb:lofi_reply post.id %}">Reply</a>
<h1>{{ post.user.username }}</h1>
</header>
<div class=post-content>{{ post.body_html|safe }}</div>

View file

@ -71,6 +71,7 @@ if (forum_settings.LOFI_SUPPORT):
url('^(?P<forum_id>\d+)/lofi/$', forum_views.show_forum, {'full':False}, name='lofi_forum'),
url('^(?P<forum_id>\d+)/topic/add/lofi/$', forum_views.add_topic, {'full':False}, name='lofi_add_topic'),
url('^post/(?P<post_id>\d+)/lofi/$', forum_views.show_post, {'full':False}, name='lofi_post'),
url('^post/(?P<post_id>\d+)/reply/lofi/$', forum_views.lofi_reply, name='lofi_reply'),
url('^topic/(?P<topic_id>\d+)/lofi/$', forum_views.show_topic, {'full':False}, name='lofi_topic'),
)

View file

@ -995,3 +995,29 @@ def show_youtube_video(request, video_id):
'video_id': video_id,
'video_title': title,
})
@login_required
def lofi_reply(request, post_id):
post = get_object_or_404(Post, id=post_id)
ip = request.META.get('REMOTE_ADDR', None)
post_form_kwargs = {"topic":post.topic, "user":request.user, "ip":ip}
if AddPostForm.FORM_NAME in request.POST:
reply_form = AddPostForm(request.POST, request.FILES, **post_form_kwargs)
if reply_form.is_valid():
post = reply_form.save()
messages.success(request, _("Reply saved."))
return HttpResponseRedirect(post.get_absolute_url() + 'lofi/')
else:
reply_form = AddPostForm(
initial={
'markup': request.user.forum_profile.markup,
'subscribe': request.user.forum_profile.auto_subscribe,
'body':'[quote=' + post.user.username + ']' + post.body + '[/quote]\n',
},
**post_form_kwargs
)
return render(request, 'djangobb_forum/lofi/reply.html', {
'form': reply_form,
'post': post
})