From e4f727c3236a7de5caf5579eeaf7a13db5e0f81f Mon Sep 17 00:00:00 2001 From: Yaron Date: Wed, 6 Aug 2014 21:48:11 +0300 Subject: [PATCH] added voting tags --- committeeVotes/static/site.css | 21 +++++++++++++++++++ .../committeeVotes/minister_detail.html | 3 ++- committeeVotes/templatetags/custom_tags.py | 14 +++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/committeeVotes/static/site.css b/committeeVotes/static/site.css index 71508e4..d903bce 100644 --- a/committeeVotes/static/site.css +++ b/committeeVotes/static/site.css @@ -551,6 +551,26 @@ ul, ol, table { margin-top: 10px; } +.minister-vote { + text-align: center; + background-clip: content-box; + font-weight: bold; +} + +.yay { + background-color: #3ac8a8 !important; +} + +.nay { + background-color: #ec6752 !important; +} + +.abstain { + background-color: #87ceeb !important; +} + + + .good { fill: #3ac8a8 } @@ -602,3 +622,4 @@ ul, ol, table { .social-links ul li a:hover, .party-member-info-links ul li a:hover { opacity: 1 } + diff --git a/committeeVotes/templates/committeeVotes/minister_detail.html b/committeeVotes/templates/committeeVotes/minister_detail.html index 79568b5..ae13fdc 100644 --- a/committeeVotes/templates/committeeVotes/minister_detail.html +++ b/committeeVotes/templates/committeeVotes/minister_detail.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load custom_tags %} {% block content %} {% load staticfiles %} @@ -35,7 +36,7 @@

{% for v in votes %} {{ v.bill }} - {{ v.vote }} + {{ v.vote }} {% endfor %} diff --git a/committeeVotes/templatetags/custom_tags.py b/committeeVotes/templatetags/custom_tags.py index 06614e9..08a13d8 100644 --- a/committeeVotes/templatetags/custom_tags.py +++ b/committeeVotes/templatetags/custom_tags.py @@ -1,4 +1,6 @@ +# coding: utf-8 from django import template +from django.template.defaultfilters import stringfilter register = template.Library() @@ -11,5 +13,17 @@ def active_page(request, view_name): except Resolver404: return "" +@register.filter(name='vote_style') +@stringfilter +def vote_style(value): + vote = value.encode('utf-8') + if vote == 'בעד': + return "yay" + elif vote == 'נגד': + return "nay" + else: + return "abstain" + register.simple_tag(active_page) +#register.filter('vote_style', vote_style)