include user rating in reviews

This commit is contained in:
Luke Hatcher 2012-10-03 18:41:16 -04:00
parent 1abf1ca230
commit cc032da288
3 changed files with 9 additions and 4 deletions

View file

@ -53,9 +53,11 @@ def proposals_generator(request, queryset, user_pk=None, check_speaker=True):
lookup_params["user"] = request.user lookup_params["user"] = request.user
try: try:
obj.latest_vote = LatestVote.objects.get(**lookup_params).css_class() obj.user_vote = LatestVote.objects.get(**lookup_params).vote
obj.user_vote_css = LatestVote.objects.get(**lookup_params).css_class()
except LatestVote.DoesNotExist: except LatestVote.DoesNotExist:
obj.latest_vote = "no-vote" obj.user_vote = None
obj.user_vote_css = "no-vote"
yield obj yield obj

View file

@ -10,11 +10,12 @@
<th>{% trans "+0" %}</th> <th>{% trans "+0" %}</th>
<th>{% trans "-0" %}</th> <th>{% trans "-0" %}</th>
<th>{% trans "-1" %}</th> <th>{% trans "-1" %}</th>
<th><a href="#" class="tip" title="{% trans "Your Rating" %}"><i class="icon-user"></i></a></th>
</thead> </thead>
<tbody> <tbody>
{% for proposal in proposals %} {% for proposal in proposals %}
<tr> <tr class="{{ proposal.user_vote_css }}">
<td>{{ proposal.number }}</td> <td>{{ proposal.number }}</td>
<td> <td>
<a href="{% url review_detail proposal.pk %}"> <a href="{% url review_detail proposal.pk %}">
@ -29,6 +30,7 @@
<td>{{ proposal.plus_zero }}</td> <td>{{ proposal.plus_zero }}</td>
<td>{{ proposal.minus_zero }}</td> <td>{{ proposal.minus_zero }}</td>
<td>{{ proposal.minus_one }}</td> <td>{{ proposal.minus_one }}</td>
<td>{{ proposal.user_vote|default:"" }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View file

@ -97,7 +97,8 @@
<script src="{{ STATIC_URL }}tabletools/js/TableTools.min.js" type="text/javascript"></script> <script src="{{ STATIC_URL }}tabletools/js/TableTools.min.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script> <script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$(".tip").tooltip();
$("table.table-reviews").dataTable({ $("table.table-reviews").dataTable({
"sDom": "<'row'<'span3'l><'span3'T><'span4'f>r>t<'row'<'span3'i><'span5'p>>", "sDom": "<'row'<'span3'l><'span3'T><'span4'f>r>t<'row'<'span3'i><'span5'p>>",
"sPaginationType": "bootstrap", "sPaginationType": "bootstrap",