[Oi-commits] r1350 - in trunk: forum media/css templates/forum
oi-commits at pardus.org.tr
oi-commits at pardus.org.tr
Wed May 7 13:25:52 EEST 2008
Author: jnmbk
Date: Wed May 7 13:25:51 2008
New Revision: 1350
Modified:
trunk/forum/views.py
trunk/media/css/forum.css
trunk/templates/forum/forum_error.html
trunk/templates/forum/topic.html
Log:
smarter watch button
Modified: trunk/forum/views.py
=================================================================
--- trunk/forum/views.py (original)
+++ trunk/forum/views.py Wed May 7 13:25:51 2008
@@ -131,19 +131,25 @@
return HttpResponseRedirect(topic.get_absolute_url())
posts = topic.post_set.all().order_by('created')
news_list = News.objects.filter(status=1).order_by('-update')[:3]
+ watching = False
if request.user.is_authenticated():
request.session["read_topic_dict"][topic.id] = datetime.now()
request.session["read_forum_dict"][forum.id] = datetime.now()
request.session.modified = True
+ # is the user watching this topic?
+ if len(request.user.watchlist_set.filter(topic=topic_id)) > 0:
+ watching = True
+
topic.views += 1
topic.save()
+
# we love Django, just 1 line and pagination is ready :)
return object_list(request, posts,
template_name = 'forum/topic.html',
template_object_name = 'post',
- extra_context = {'forum': forum, 'topic': topic, 'news_list':news_list},
+ extra_context = {'forum': forum, 'topic': topic, 'news_list':news_list, "watching":watching},
paginate_by = POSTS_PER_PAGE,
allow_empty = True)
Modified: trunk/media/css/forum.css
=================================================================
--- trunk/media/css/forum.css (original)
+++ trunk/media/css/forum.css Wed May 7 13:25:51 2008
@@ -250,7 +250,10 @@
font-weight: bold;
font-size: 14px;
width: 50%;
- height: 20px;
+}
+
+div.forum_error a {
+ color: #EDE4E1;
}
div.topic_news_area {
Modified: trunk/templates/forum/forum_error.html
=================================================================
--- trunk/templates/forum/forum_error.html (original)
+++ trunk/templates/forum/forum_error.html Wed May 7 13:25:51 2008
@@ -4,5 +4,5 @@
{% block content %}
<div id="space"> </div>
- <div class="forum_error">{{ error }}</div>
+ <div class="forum_error">{{ error }}<br /><a href="javascript: history.go(-1)">Geri dönmek için tıklayın</a></div>
{% endblock %}
Modified: trunk/templates/forum/topic.html
=================================================================
--- trunk/templates/forum/topic.html (original)
+++ trunk/templates/forum/topic.html Wed May 7 13:25:51 2008
@@ -40,9 +40,9 @@
<div class="post_message_top_button">
<a href="{{ post.get_quote_url }}"><img src="/media/dijital/img/forum/quote.gif" alt="alıntıla" border="0" /></a>
</div>
- {% if forloop.first %}
+ {% if request.user.is_authenticated and forloop.first and not watching %}
<div class="post_message_top_button">
- <a href="{{ topic.get_follow_url }}"><img src="/media/dijital/img/forum/watch.gif" alt="izle" border="0" /></a>
+ <a href="{{ topic.get_follow_url }}"><img src="/media/dijital/img/forum/watch.gif" alt="izle" title="E-posta ile izle" border="0" /></a>
</div>
{% endif %}
{% if perms.forum.change_post %}
More information about the Oi-commits
mailing list