Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 404 #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
23 changes: 19 additions & 4 deletions memopol/base/templates/blocks/representative_list_item.haml
Original file line number Diff line number Diff line change
@@ -2,12 +2,26 @@

-cache 86400 representative_list_item result_mep.id
-with mep=result_mep.object
.floor.twelve.list_item
.row.panel
.floor.twelve.list_item{itemscope: None, itemtype: "http://schema.org/Review"}
%div{itemscope: None, itemtype: "http://schema.org/AggregateRating",
itemprop: "aggregateRating", style: "display: none;"}
<span itemprop="ratingValue">{{ mep.total_score|floatformat:1 }}</span>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not HAML syntax?
Note that I'm not a big fan of HAML, but if we can avoid mixing syntaxes, it's better. :)

<span itemprop="reviewCount">{{ mep.score_set.all|length }}</span>
<span itemprop="bestRating">100</span>
<span itemprop="worstRating">0</span>
.row.panel{itemscope: None, itemtype: "http://schema.org/Person",
itemprop: "itemReviewed"}
%div{style: "display: none;"}
%div{itemprop: "nationality"}
=mep.country.name
-for group in mep.groups.all
-# we should do the same with organizations, delegations, etc...
<span itemprop="memberof">{{ group.name }}</span>
.four.columns.flat.mobile-four
.five.columns.flat.mobile-two
%a{class: "th", href: "{{ mep.get_absolute_url }}"}
%img{width: "100px", src: "{% url meps:mep-picture mep.ep_id %}"}
%img{width: "100px", src: "{% url meps:mep-picture mep.ep_id %}",
itemprop: "image"}

.seven.columns.mobile-two
.panel.radius{class: "{{ mep.total_score|scolorize }}"}
@@ -20,7 +34,8 @@
.six.columns
.row
%h4
%a{href: "{{ mep.get_absolute_url }}", style: "color: black;"}
%a{href: "{{ mep.get_absolute_url }}", style: "color: black;",
itemprop: "name"}
=mep
.row
-for achievement in mep.achievements.all
2 changes: 1 addition & 1 deletion memopol/meps/templates/meps/mep_detail.haml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

-block content
.row
.twelve.columns
.twelve.columns{itemscope: None, itemtype: "http://schema.org/Product"}

%dl.tabs
%dd.active
23 changes: 14 additions & 9 deletions memopol/meps/templates/meps/mep_detail/main.haml
Original file line number Diff line number Diff line change
@@ -3,14 +3,19 @@
.twelve.columns.floor
.row.panel
.two.columns
%img{width: "100px", src: "{% url meps:mep-picture mep.ep_id %}"}
%img{width: "100px", src: "{% url meps:mep-picture mep.ep_id %}", itemprop: "image"}

.two.columns
%div{class: "panel radius {{ mep.total_score|scolorize }}"}
.two.columns{itemscope: None, itemtype: "http://schema.org/AggregateRating", itemprop: "aggregateRating"}
%div{class: "panel radius {{ mep.total_score|scolorize }}", itemprop: "ratingValue"}
=mep.total_score|floatformat:1
%div{style: "display: none;"}
<span itemprop="itemReviewed">{{ mep }}</span>
<span itemprop="ratingCount">{{ mep.scores|length }}</span>
<span itemprop="bestRating">100</span>
<span itemprop="worstRating">0</span>

.six.columns
%h4
%h4{itemprop: "name"}
=mep
%div
-for achievement in mep.achievements.all
@@ -30,13 +35,13 @@
-trans "Former mep"
%li
%a{href: "{% url meps:index_by_country mep.country.code %}"}
%span{class: "sprite-country_small-{{ mep.country.code }}"}
=mep.country.name
%span{class: "sprite-country_small-{{ mep.country.code }}", itemprop: "brand"}
=mep.country.name
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shit here

-if mep.group
%li
%a{href: "{% url meps:index_by_group mep.group.abbreviation %}"}
%span{class: "sprite-eu_group-{{ mep.group.abbreviation|cut:'/' }}"}
{{ mep.group.name }} ({{ mep.group.abbreviation }})
%span{class: "sprite-eu_group-{{ mep.group.abbreviation|cut:'/' }}", itemprop: "brand"}
{{ mep.group.name }} ({{ mep.group.abbreviation }})
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shit here also


%ul.eight.columns
-for post in mep.important_posts
@@ -45,7 +50,7 @@
{{ post.role }} of <a href="{{ post.instance.get_absolute_url }}">{{ post.instance.name }}</a>
-if mep.party
%li
<i>{% trans "National party" %}</i>: <a href="{% url meps:index_by_party mep.party.id mep.party.name|slugify %}">{{ mep.party.name }}</a></li>
<i>{% trans "National party" %}</i>: <a href="{% url meps:index_by_party mep.party.id mep.party.name|slugify %}" itemprop="brand">{{ mep.party.name }}</a></li>
-if mep.birth_date
%li
<i>{% if mep.gender == 'M' %}{% trans "Born on" %}{% else %}{% trans "Born on (female)" %}{% endif %}</i> {% blocktrans with mep.birth_date.day as day and mep.birth_date|date:'F' as month and mep.birth_date.year as year and mep.birth_place as birth_place and mep.age as age %}{{ day }} {{ month }} {{ year }}<i> at </i>{{ birth_place }}, {{ age }} years old.{% endblocktrans %}</li>
19 changes: 14 additions & 5 deletions memopol/meps/templates/meps/mep_detail/scores.haml
Original file line number Diff line number Diff line change
@@ -11,14 +11,23 @@
-trans "Trends explanation"

-for score in mep.scores
.row.panel
.row.panel{itemprop: "review", itemscope: None, itemtype: "http://schema.org/Review"}
.two.columns
%div{class: "panel radius {{ score.value|scolorize }}"}
=score.value|floatformat:1
%div{class: "panel radius {{ score.value|scolorize }}", itemprop: "reviewRating", itemscope: None, itemtype: "http://schema.org/Rating"}
%span{itemprop: "ratingValue"}
=score.value|floatformat:1
%span{itemprop: "worstRating"}
0
%span{itemprop: "bestRating"}
100

.eight.columns
<a href="{{ score.proposal.get_absolute_url }}">{{ score.proposal.title }}</a> {% blocktrans with score.date as score_date %}(on {{ score_date }}){% endblocktrans %}
%div{itemprop: "datePublished", style: "display: none;"}
=score.date|date:"Y-m-d"
<a href="{{ score.proposal.get_absolute_url }}" itemprop="about">{{ score.proposal.title }}</a> {% blocktrans with score.date as score_date %}(on {{ score_date }}){% endblocktrans %}

.two.columns
.two.columns{itemprop: "reviewBody"}
%a.button.secondary{href: "{% url meps:votes:votes_mep score.proposal.id mep.id %}"}
-trans "Details"
%div{itemprop: "author", style: "display: none;"}
lqdn
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure of the scope of this author=lqdn, but maybe the long version ("La Quadrature du...") will be better?