changeset 45:2598bc18b6fb

Shamelessly stole Bob's anchor target method. Fixed CSS for reviews so that the top of the review is not clipped by the navbar.
author Chris Ridgway <ckridgway@gmail.com>
date Wed, 09 Nov 2011 23:18:32 -0600
parents c32897e111dc
children 51c01a3cb2f2
files bns_website/reviews/models.py bns_website/static/css/base.css bns_website/templates/reviews/review_list.html bns_website/templates/reviews/reviews_tag.html
diffstat 4 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/bns_website/reviews/models.py	Mon Nov 07 21:22:56 2011 -0600
+++ b/bns_website/reviews/models.py	Wed Nov 09 23:18:32 2011 -0600
@@ -3,7 +3,8 @@
 
 """
 from django.db import models
-
+from datetime import timedelta, datetime
+from django.core.urlresolvers import reverse
 
 class Review(models.Model):
     """
@@ -22,3 +23,11 @@
 
     def __unicode__(self):
         return self.reviewer
+
+    def is_new(self):
+        if datetime.now() - self.date <= timedelta(days=30):
+            return True
+        return False
+
+    def get_absolute_url(self):
+        return reverse('reviews') + '#review%d' % self.id
--- a/bns_website/static/css/base.css	Mon Nov 07 21:22:56 2011 -0600
+++ b/bns_website/static/css/base.css	Wed Nov 09 23:18:32 2011 -0600
@@ -21,11 +21,17 @@
 ul.review-list {
    list-style-type: none;
 }
+
 li.review-list-item {
-   margin-bottom: 30px;
+   padding-top:60px;
 }
 
+/*
+-----------------------------------------------
+New Styles
+-----------------------------------------------
+*/
 article.news {
-  margin-bottom: 2em;
-  border-top: 2px solid DimGray;  /* some other gray color might be better */
+   margin-bottom: 2em;
+   border-top: 2px solid DimGray;  /* some other gray color might be better */
 }
\ No newline at end of file
--- a/bns_website/templates/reviews/review_list.html	Mon Nov 07 21:22:56 2011 -0600
+++ b/bns_website/templates/reviews/review_list.html	Wed Nov 09 23:18:32 2011 -0600
@@ -18,8 +18,8 @@
 {% if object_list %}
    <ul class="review-list">
    {% for review in object_list %}
-      <li class="review-list-item">
-         <blockquote>
+      <li id="review{{ review.id }}" class="review-list-item">
+         <blockquote {% if review.review_url %}cite="{{ review.review_url }}"{% endif %}>
             <p>{{ review.review|safe }}</p>
             <small>
                {{ review.reviewer }}
--- a/bns_website/templates/reviews/reviews_tag.html	Mon Nov 07 21:22:56 2011 -0600
+++ b/bns_website/templates/reviews/reviews_tag.html	Wed Nov 09 23:18:32 2011 -0600
@@ -2,7 +2,7 @@
 {% if object_list %}
    <ul>
    {% for review in object_list %}
-      <li>{{ review.title }}</li>
+      <li><a href="{{ review.get_absolute_url }}">{{ review.title }}</a></li>
    {% endfor %}
    </ul>
 {% else %}