[Oi-commits] r1496 - in trunk: forum media/css templates/forum

oi-commits at pardus.org.tr oi-commits at pardus.org.tr
Thu Jun 19 14:52:32 EEST 2008


Author: jnmbk
Date: Thu Jun 19 14:52:32 2008
New Revision: 1496

Modified:
   trunk/forum/views.py
   trunk/media/css/forum.css
   trunk/templates/forum/topic.html
Log:
poll makeup

Modified: trunk/forum/views.py
=================================================================
--- trunk/forum/views.py	(original)
+++ trunk/forum/views.py	Thu Jun 19 14:52:32 2008
@@ -191,6 +191,14 @@
                 poll_enabled = poll.end_date > datetime.now()
             else:
                 poll_enabled = True
+            try:
+                PollVote.objects.get(poll=poll, voter=request.user)
+                # user has voted before, let's see if we'll still enable the poll
+                if poll_enabled:
+                    if not poll.allow_changing_vote:
+                        poll_enabled = False
+            except ObjectDoesNotExist:
+                pass
     except: #DoesNotExist
         pass
 

Modified: trunk/media/css/forum.css
=================================================================
--- trunk/media/css/forum.css	(original)
+++ trunk/media/css/forum.css	Thu Jun 19 14:52:32 2008
@@ -474,14 +474,35 @@
 div.poll a {
     text-decoration: none;
 }
+div.poll h2 {
+    margin-left: 10px;
+}
 div.poll a:hover {
     text-decoration: underline;
 }
+div.poll_option {
+    overflow: hidden;
+    margin-bottom: 5px;
+}
 div.poll_question {
     padding-left: 10px;
+    float: left;
+    width: 10%;
 }
-div.poll_option {
-    padding-left: 10px;
-    border-top: 1px solid #CBD8E0;
-    margin-bottom: 3px;
+div.poll_options {
+    width: 80%;
+    float: right;
+}
+div.poll_option_text {
+    float: left;
+    overflow: hidden;
+    width: 20%;
+}
+div.poll_option_bar {
+    float: right;
+    overflow: hidden;
+    width: 80%;
+}
+div.poll_help {
+    font-style: italic;
 }

Modified: trunk/templates/forum/topic.html
=================================================================
--- trunk/templates/forum/topic.html	(original)
+++ trunk/templates/forum/topic.html	Thu Jun 19 14:52:32 2008
@@ -23,19 +23,23 @@
 
 {% if topic.poll %}
 <div class="poll">
+    <h2>Anket</h2>
     <div class="poll_question">
-        <h3>Anket: {{ topic.poll.question }}</h3>
-        {% if topic.poll.date_limit %}<br />Oylama bitiş tarihi: {{ topic.poll.end_date|date:"j F Y l" }}{% endif %}
-        {% if perms.forum.can_change_poll %}<a href="{{ topic.get_change_poll_url }}">change</a> - <a href="{{ topic.get_delete_poll_url }}">delete</a>{% endif %}
+        <p>{{ topic.poll.question }}</p>
+        {% if topic.poll.date_limit %}<p>Oylama bitiş tarihi: {{ topic.poll.end_date|date:"j F Y l" }}</p>{% endif %}
+        {% if perms.forum.can_change_poll %}<p><a href="{{ topic.get_change_poll_url }}">change</a> - <a href="{{ topic.get_delete_poll_url }}">delete</a></p>{% endif %}
     </div>
     <div class="poll_options">
     {% for option in poll_options %}
     <div class="poll_option">
-        {% if poll_enabled %}<a href="{{ forum.get_absolute_url }}{{ topic.id }}/poll/vote/{{ option.id }}/" title="oy vermek için tıklayın">{{ option.text }}</a>{% else %}{{ option.text }}{% endif %}<br />
-        <div class="poll_bar">
-            <div style="width:{{ option.percent }}%;background-color:#51798E;">{% if option.percent_out %}&nbsp;</div><span>%{{ option.percent }} ({{ option.vote_count }} oy)</span>{% else %}<span style="float:right;color:white;">%{{ option.percent }} ({{ option.vote_count }} oy)</span></div>{% endif %}</div>
+        <div class="poll_option_text">{% if poll_enabled %}<a href="{{ forum.get_absolute_url }}{{ topic.id }}/poll/vote/{{ option.id }}/" title="oy vermek için tıklayın">{{ option.text }}</a>{% else %}{{ option.text }}{% endif %}</div>
+        <div class="poll_option_bar">
+            <div class="poll_bar">
+                <div style="width:{{ option.percent }}%;background-color:#51798E;">{% if option.percent_out %}&nbsp;</div><span>%{{ option.percent }} ({{ option.vote_count }} oy)</span>{% else %}<span style="float:right;color:white;">%{{ option.percent }} ({{ option.vote_count }} oy)</span></div>{% endif %}</div>
+            </div>
         </div>
     {% endfor %}
+        {% if poll_enabled %}<div class="poll_help">Oylamaya katılmak için şıklardan birini tıklayın.</div>{% endif %}
     </div>
 </div>
 {% endif %}


More information about the Oi-commits mailing list