[Oi-commits] r1109 - in trunk: st templates/fs templates/game templates/howto templates/news templates/package

oi-commits at pardus.org.tr oi-commits at pardus.org.tr
Wed Mar 5 17:12:11 EET 2008


Author: jnmbk
Date: Wed Mar  5 17:12:11 2008
New Revision: 1109

Modified:
   trunk/st/views.py
   trunk/templates/fs/fs_detail.html
   trunk/templates/game/game_detail.html
   trunk/templates/howto/howto_detail.html
   trunk/templates/news/news_detail.html
   trunk/templates/package/package_detail.html
Log:
show total number of comments and link to forum (a refactor is needed in comment system to avoid try except blocks here)

Modified: trunk/st/views.py
=================================================================
--- trunk/st/views.py	(original)
+++ trunk/st/views.py	Wed Mar  5 17:12:11 2008
@@ -53,6 +53,12 @@
     if request.user.is_authenticated():
         auth=True
 
+    try:
+        topic = Topic.objects.filter(title=howto.title)[0]
+        comment_count = topic.posts - 1
+        comment_url = topic.get_latest_post_url()
+    except:
+        pass
     numberofpetitioners = Petitioner.objects.filter(is_active=True).count()
     petitionpercent = numberofpetitioners / 30
     return render_response(request, 'howto/howto_detail.html', locals())
@@ -70,6 +76,13 @@
     if request.user.is_authenticated():
         auth=True
 
+    try:
+        topic = Topic.objects.filter(title=game.title)[0]
+        comment_count = topic.posts - 1
+        comment_url = topic.get_latest_post_url()
+    except:
+        pass
+
     return render_response(request, 'game/game_detail.html', locals())
 
 def game_printable(request, slug):
@@ -83,6 +96,12 @@
     if request.user.is_authenticated():
         auth=True
 
+    try:
+        topic = Topic.objects.filter(title=news.title)[0]
+        comment_count = topic.posts - 1
+        comment_url = topic.get_latest_post_url()
+    except:
+        pass
     numberofpetitioners = Petitioner.objects.filter(is_active=True).count()
     petitionpercent = numberofpetitioners / 30
     return render_response(request, 'news/news_detail.html', locals())
@@ -100,6 +119,14 @@
     if request.user.is_authenticated():
         auth=True
 
+    # we need to handle page titles that changed after creating
+    try:
+        topic = Topic.objects.filter(title=package.title)[0]
+        comment_count = topic.posts - 1
+        comment_url = topic.get_latest_post_url()
+    except:
+        pass
+
     return render_response(request, 'package/package_detail.html', locals())
 
 def pkg_printable(request, slug):
@@ -209,7 +236,7 @@
             tags = news.tags.all()
             return render_response(request,'news/news_detail.html',{'news':news,'tags':tags,'form':form,'auth':True})
 
-    form=CommentForm()
+    form = CommentForm()
     tags = news.tags.all()
     return render_response(request,'news/news_detail.html',{'news':news,'tags':tags,'form':form,'auth':True})
 

Modified: trunk/templates/fs/fs_detail.html
=================================================================
--- trunk/templates/fs/fs_detail.html	(original)
+++ trunk/templates/fs/fs_detail.html	Wed Mar  5 17:12:11 2008
@@ -13,14 +13,11 @@
 {% block section %}fs{% endblock %}
 
 {% block header_menu %}
-    <!-- Burası header kısmı -->
-	{% include "header.html" %}
+    {% include "header.html" %}
 {% endblock %}
 <br/>
 {% block ust_menu %}
-	<!-- Burası üst menü kısmı -->
-	{% include "ust_menu_ayrinti.html" %}
-
+    {% include "ust_menu_ayrinti.html" %}
 {% endblock %}
 <br/>
 

Modified: trunk/templates/game/game_detail.html
=================================================================
--- trunk/templates/game/game_detail.html	(original)
+++ trunk/templates/game/game_detail.html	Wed Mar  5 17:12:11 2008
@@ -15,14 +15,11 @@
 {% block section %}game{% endblock %}
 
 {% block header_menu %}
-    <!-- Burası header kısmı -->
-	{% include "header.html" %}
+    {% include "header.html" %}
 {% endblock %}
 <br/>
 {% block ust_menu %}
-	<!-- Burası üst menü kısmı -->
-	{% include "ust_menu_ayrinti.html" %}
-
+    {% include "ust_menu_ayrinti.html" %}
 {% endblock %}
 <br/>
 
@@ -32,16 +29,17 @@
 <div class="page_content grey">
 {{ game.text }}
 </div>
-	{% if auth %}
-		{% if form %}
-			<form method="post" action="/oyun/yorum/{{game.slug}}/">
-
-				{{form}}<br/>
-				<input type="submit" value="Yolla">
-			</form>
-		{% endif %}
-
-	{% endif %}
+{% if auth %}
+    {% if form %}
+        <form method="post" action="/oyun/yorum/{{game.slug}}/">
+            {{form}}
+            <br />
+            <input type="submit" value="Yolla">
+            <br />
+            <a href="{{comment_url}}">Yorumlar ({{ comment_count }})</a>
+        </form>
+    {% endif %}
+{% endif %}
 <div class="page_properties"><a href="{{ game.get_printable_url }}"><img src="/media/img/print.png" /></a></div>
 <div class="page_last_update">Son güncelleme: {{ game.update|timedelta }}</div>
 

Modified: trunk/templates/howto/howto_detail.html
=================================================================
--- trunk/templates/howto/howto_detail.html	(original)
+++ trunk/templates/howto/howto_detail.html	Wed Mar  5 17:12:11 2008
@@ -31,15 +31,17 @@
 <div class="page_content grey">
 {{ howto.text }}
 </div>
-	{% if auth %}
-		{% if form %}
-			<form method="post" action="/nasil/yorum/{{howto.slug}}/">
-
-				{{form}}<br/>
-				<input type="submit" value="Yolla">
-			</form>
-		{% endif %}
-	{% endif %}
+{% if auth %}
+    {% if form %}
+        <form method="post" action="/nasil/yorum/{{howto.slug}}/">
+            {{form}}
+            <br/>
+            <input type="submit" value="Yolla">
+            <br/>
+            <a href="{{comment_url}}">Yorumlar ({{ comment_count }})</a>
+        </form>
+    {% endif %}
+{% endif %}
 
 <div class="page_properties"><a href="{{ howto.get_printable_url }}"><img src="/media/img/print.png" /></a></div>
 <div class="page_last_update">Son güncelleme: {{ howto.update|timedelta }}</div>

Modified: trunk/templates/news/news_detail.html
=================================================================
--- trunk/templates/news/news_detail.html	(original)
+++ trunk/templates/news/news_detail.html	Wed Mar  5 17:12:11 2008
@@ -14,14 +14,11 @@
 {% block section %}news{% endblock %}
 
 {% block header_menu %}
-    <!-- Burası header kısmı -->
-	{% include "header.html" %}
+    {% include "header.html" %}
 {% endblock %}
 <br/>
 {% block ust_menu %}
-	<!-- Burası üst menü kısmı -->
-	{% include "ust_menu_ayrinti.html" %}
-
+    {% include "ust_menu_ayrinti.html" %}
 {% endblock %}
 <br/>
 
@@ -32,16 +29,17 @@
 {{ news.text }}
 </div>
 
-	{% if auth %}
-		{% if form %}
-			<form method="post" action="/haber/yorum/{{news.slug}}/">
-
-				{{form}}
-				<br/>
-				<input type="submit" value="Yolla">
-			</form>
-		{% endif %}
-	{% endif %}
+{% if auth %}
+    {% if form %}
+        <form method="post" action="/haber/yorum/{{news.slug}}/">
+            {{form}}
+            <br/>
+            <input type="submit" value="Yolla">
+            <br/>
+            <a href="{{comment_url}}">Yorumlar ({{ comment_count }})</a>
+        </form>
+    {% endif %}
+{% endif %}
 <div class="page_properties"><a href="{{ news.get_printable_url }}"><img src="/media/img/print.png" /></a></div>
 <div class="page_last_update">Son güncelleme: {{ news.update|timedelta }}</div>
 

Modified: trunk/templates/package/package_detail.html
=================================================================
--- trunk/templates/package/package_detail.html	(original)
+++ trunk/templates/package/package_detail.html	Wed Mar  5 17:12:11 2008
@@ -15,14 +15,11 @@
 {% block section %}package{% endblock %}
 
 {% block header_menu %}
-    <!-- Burası header kısmı -->
-	{% include "header.html" %}
+    {% include "header.html" %}
 {% endblock %}
 <br/>
 {% block ust_menu %}
-	<!-- Burası üst menü kısmı -->
-	{% include "ust_menu_ayrinti.html" %}
-
+    {% include "ust_menu_ayrinti.html" %}
 {% endblock %}
 <br/>
 
@@ -32,15 +29,17 @@
 {{ package.text }}
 </div>
 
-				{% if auth %}
-		{% if form %}
-			<form method="post" action="/paket/yorum/{{package.slug}}/">
-
-				{{form}}<br/>
-				<input type="submit" value="Yolla">
-			</form>
-		{% endif %}
-	{% endif %}
+{% if auth %}
+    {% if form %}
+        <form method="post" action="/paket/yorum/{{package.slug}}/">
+            {{form}}
+            <br/>
+            <input type="submit" value="Yolla">
+            <br/>
+            <a href="{{comment_url}}">Yorumlar ({{ comment_count }})</a>
+        </form>
+    {% endif %}
+{% endif %}
 <div class="page_properties"><a href="{{ package.get_printable_url }}"><img src="/media/img/print.png" /></a></div>
 <div class="page_last_update">Son güncelleme: {{ package.update|timedelta }}</div>
 


More information about the Oi-commits mailing list