[Oi-commits] r1106 - in trunk: forum media/css templates/forum
oi-commits at pardus.org.tr
oi-commits at pardus.org.tr
Wed Mar 5 14:53:18 EET 2008
Author: jnmbk
Date: Wed Mar 5 14:53:18 2008
New Revision: 1106
Modified:
trunk/forum/views.py
trunk/media/css/forum.css
trunk/templates/forum/topic.html
Log:
show latest three news under first post of the topic
Modified: trunk/forum/views.py
=================================================================
--- trunk/forum/views.py (original)
+++ trunk/forum/views.py Wed Mar 5 14:53:18 2008
@@ -20,7 +20,7 @@
from oi.forum.models import Category, Forum, Topic, Post, AbuseReport, WatchList
from django.core.urlresolvers import reverse
-from oi.st.models import Tag
+from oi.st.models import Tag, News
def main(request):
categories = Category.objects.order_by('order')
@@ -51,6 +51,7 @@
forum = get_object_or_404(Forum, slug=forum_slug)
topic = get_object_or_404(Topic, pk=topic_id)
posts = topic.post_set.all().order_by('created')
+ news_list = News.objects.filter(status=1).order_by('-update')[:3]
session_key = 'visited_'+topic_id
@@ -63,7 +64,7 @@
return object_list(request, posts,
template_name = 'forum/topic.html',
template_object_name = 'post',
- extra_context = {'forum': forum, 'topic': topic, 'request': request},
+ extra_context = {'forum': forum, 'topic': topic, 'news_list':news_list, 'request': request},
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 Mar 5 14:53:18 2008
@@ -214,6 +214,32 @@
.tag {
padding-left: 5px;
}
+div.topic_news_area {
+ width: 100%;
+ overflow: hidden;
+}
+div.topic_news_box {
+ float: left;
+ width: 290px;
+ height: 200px;
+ border-width: 0px 1px;
+ border-style: solid;
+ border-color: #D7E1E7;
+ padding: 0px 4px;
+}
+div.topic_news_box:hover {
+ background-color: #D7E1E7;
+}
+div.topic_news_box h2 {
+ font-size: 14px;
+ font-weight: bold;
+}
+div.topic_news_box a:hover,
+div.topic_news_box a:visited,
+div.topic_news_box a {
+ color: black;
+ text-decoration: none;
+}
/* Ends here */
Modified: trunk/templates/forum/topic.html
=================================================================
--- trunk/templates/forum/topic.html (original)
+++ trunk/templates/forum/topic.html Wed Mar 5 14:53:18 2008
@@ -96,6 +96,15 @@
</div>
</div>
{% endif %}
+{% if forloop.first %}
+<div class="topic_news_area">
+ {% for news in news_list %}
+ <div class="topic_news_box">
+ <a href="{{news.get_absolute_url}}"><h2>{{ news.title }}</h2><span>{{ news.sum }}<span></a>
+ </div>
+ {% endfor %}
+</div>
+{% endif %}
{% endfor %}
<div id="post_bottom">
More information about the Oi-commits
mailing list