Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
memopol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anthony
memopol
Commits
896346f5
Commit
896346f5
authored
Oct 09, 2016
by
Nicolas Joyard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Today's mep
parent
e23a4a2e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
44 deletions
+90
-44
src/memopol/static/css/custom.css
src/memopol/static/css/custom.css
+7
-1
src/memopol/templates/home.html
src/memopol/templates/home.html
+14
-0
src/memopol/templates/representatives/_representative_card.html
...mopol/templates/representatives/_representative_card.html
+42
-0
src/memopol/templates/representatives/representative_grid.html
...emopol/templates/representatives/representative_grid.html
+2
-42
src/memopol/views/home.py
src/memopol/views/home.py
+25
-1
No files found.
src/memopol/static/css/custom.css
View file @
896346f5
...
...
@@ -261,7 +261,7 @@ a:hover .custom-thumbnail-details {
position
:
relative
;
}
.
custom-listMEP
.thumbnail
.badge
,
.
representative-card
.thumbnail
.badge
,
.position-button
.badge
{
position
:
absolute
;
top
:
-0.5em
;
...
...
@@ -333,6 +333,12 @@ iframe {
background-size
:
cover
;
}
.todays-mep
.representative-card
.img-responsive
{
width
:
150px
;
height
:
150px
;
}
.representative-card
h4
{
margin-top
:
15px
;
}
...
...
src/memopol/templates/home.html
View file @
896346f5
...
...
@@ -21,6 +21,20 @@
</p>
</div>
<div
class=
"col-md-4"
>
placeholder
</div>
<div
class=
"col-md-4"
>
placeholder
</div>
<div
class=
"col-md-4 todays-mep"
>
<h2>
{% trans "Today's Representative" %}
</h2>
{% include "representatives/_representative_card.html" with representative=todays_mep cols=12 %}
</div>
<div
class=
"col-md-4"
>
<h3>
{% trans "More information" %}
</h3>
<div
class=
"btn-group"
>
...
...
src/memopol/templates/representatives/_representative_card.html
0 → 100644
View file @
896346f5
{% load memopol_tags %}
<div
class=
"col-xs-12 col-md-{{ cols|default:4 }} representative-card"
>
<div
class=
"thumbnail"
>
<a
href=
"{% url 'representative-detail' slug=representative.slug %}"
class=
"custom-thumbnail custom-invisible"
>
<div
class=
"row"
>
<div
class=
"col-xs-5"
>
<img
src=
"data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
class=
"img-responsive"
style=
"background-image: url({{ representative.photo }});"
>
<div
class=
"custom-thumbnail-details"
>
{% if representative.country %}
<div
class=
"icon-badge-detail"
>
{{ representative.country|country_flag }} {{ representative.country.name }}
</div>
{% endif %}
{% if representative.chamber %}
<div
class=
"icon-badge-detail"
>
{{ representative.chamber|chamber_icon }} {{ representative.chamber.name }}
</div>
{% endif %}
{% if representative.main_mandate.group %}
<div
class=
"icon-badge-detail"
>
{{ representative.main_mandate.group|group_icon }} {{ representative.main_mandate.group.abbreviation }}
</div>
{% endif %}
</div>
</div>
<div
class=
"col-xs-7"
>
<h4
class=
"text-center"
>
{{ representative.full_name }}
</h4>
<p
class=
"text-center"
>
<br>
{% if representative.country %}
{{ representative.country|country_flag }}
{% endif %}
{% if representative.chamber %}
{{ representative.chamber|chamber_icon }}
{% endif %}
{% if representative.main_mandate.group %}
{{ representative.main_mandate.group|group_icon }}
{% endif %}
</p>
<p
class=
"text-right"
>
{{ representative.representative_score.score|score_badge }}
</p>
</div>
</div>
</a>
</div>
</div>
\ No newline at end of file
src/memopol/templates/representatives/representative_grid.html
View file @
896346f5
{% extends 'base.html' %}
{% load i18n %}
{% load memopol_tags %}
{% block title %}{% trans "Members of the European Parliement" %}{% endblock %}
...
...
@@ -15,47 +14,8 @@
{% include "blocks/listheader.html" %}
<div
class=
"row card-list"
>
{% for representative in object_list %}
<div
class=
"col-xs-12 col-md-4 representative-card"
>
<div
class=
"thumbnail"
>
<a
href=
"{% url 'representative-detail' slug=representative.slug %}"
class=
"custom-thumbnail custom-invisible"
>
<div
class=
"row"
>
<div
class=
"col-xs-5"
>
<img
src=
"data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
class=
"img-responsive"
style=
"background-image: url({{ representative.photo }});"
>
<div
class=
"custom-thumbnail-details"
>
{% if representative.country %}
<div
class=
"icon-badge-detail"
>
{{ representative.country|country_flag }} {{ representative.country.name }}
</div>
{% endif %}
{% if representative.chamber %}
<div
class=
"icon-badge-detail"
>
{{ representative.chamber|chamber_icon }} {{ representative.chamber.name }}
</div>
{% endif %}
{% if representative.main_mandate.group %}
<div
class=
"icon-badge-detail"
>
{{ representative.main_mandate.group|group_icon }} {{ representative.main_mandate.group.abbreviation }}
</div>
{% endif %}
</div>
</div>
<div
class=
"col-xs-7"
>
<h4
class=
"text-center"
>
{{ representative.full_name }}
</h4>
<p
class=
"text-center"
>
<br>
{% if representative.country %}
{{ representative.country|country_flag }}
{% endif %}
{% if representative.chamber %}
{{ representative.chamber|chamber_icon }}
{% endif %}
{% if representative.main_mandate.group %}
{{ representative.main_mandate.group|group_icon }}
{% endif %}
</p>
<p
class=
"text-right"
>
{{ representative.representative_score.score|score_badge }}
</p>
</div>
</div>
</a>
</div>
</div>
{% for mep in object_list %}
{% include "representatives/_representative_card.html" with representative=mep cols=4 %}
{% empty %}
{% trans "No representatives found !" %}
{% endfor %}
...
...
src/memopol/views/home.py
View file @
896346f5
# coding: utf-8
import
datetime
import
random
from
django.db.models
import
Q
from
django.views
import
generic
from
representatives.models
import
Representative
from
representatives_positions.views
import
PositionFormMixin
from
.representative_mixin
import
RepresentativeViewMixin
class
HomeView
(
PositionFormMixin
,
generic
.
TemplateView
):
class
HomeView
(
PositionFormMixin
,
RepresentativeViewMixin
,
generic
.
TemplateView
):
template_name
=
'home.html'
def
get_context_data
(
self
,
**
kwargs
):
c
=
super
(
HomeView
,
self
).
get_context_data
(
**
kwargs
)
qs
=
Representative
.
objects
qs
=
qs
.
filter
(
Q
(
representative_score__score__lt
=
0
)
|
Q
(
representative_score__score__gt
=
0
))
qs
=
self
.
prefetch_for_representative_country_and_main_mandate
(
qs
)
random
.
seed
(
datetime
.
date
.
today
().
isoformat
())
index
=
random
.
randint
(
0
,
qs
.
count
()
-
1
)
c
[
'todays_mep'
]
=
qs
.
all
()[
index
]
self
.
add_representative_country_and_main_mandate
(
c
[
'todays_mep'
])
return
c
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment