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
M
memopol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Political Memory
memopol
Commits
f18ce532
Commit
f18ce532
authored
Oct 11, 2016
by
njoyard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'homepage-chambers' into 'master'
Add preliminary chamber cards on homepage See merge request !172
parents
47b8e95f
5061b4a2
Pipeline
#198
passed with stages
in 8 minutes and 12 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
20 deletions
+87
-20
src/memopol/static/css/custom.css
src/memopol/static/css/custom.css
+21
-5
src/memopol/templates/blocks/_chamber_card.html
src/memopol/templates/blocks/_chamber_card.html
+29
-0
src/memopol/templates/home.html
src/memopol/templates/home.html
+10
-0
src/memopol/tests/test_home_navigation_pane.py
src/memopol/tests/test_home_navigation_pane.py
+17
-13
src/memopol/views/home.py
src/memopol/views/home.py
+9
-1
src/representatives_votes/models.py
src/representatives_votes/models.py
+1
-1
No files found.
src/memopol/static/css/custom.css
View file @
f18ce532
...
...
@@ -375,28 +375,36 @@ iframe {
Themes
***************************************************************/
.theme-card
.description
{
.theme-card
.description
,
.chamber-card
.description
{
margin
:
0
1em
;
line-height
:
1.2em
;
}
.theme-card
.info-container
{
.theme-card
.info-container
,
.chamber-card
.info-container
,
.chamber-card
.title-container
{
display
:
flex
;
flex-flow
:
row
nowrap
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
1em
;
}
.theme-card
.badge-container
{
.theme-card
.badge-container
,
.chamber-card
.badge-container
{
display
:
flex
;
flex-flow
:
column
nowrap
;
justify-content
:
center
;
}
.theme-card
.badge-container
.label
{
.theme-card
.badge-container
.label
,
.chamber-card
.badge-container
.label
{
margin
:
.25em
0
;
}
.theme-card
.chart-container
{
.theme-card
.chart-container
,
.chamber-card
.chart-container
{
flex-grow
:
1
;
height
:
125px
;
margin-left
:
.5em
;
...
...
@@ -408,6 +416,14 @@ iframe {
background-repeat
:
no-repeat
;
}
.chamber-card
.chart-container
{
margin
:
1em
;
}
.chamber-card
h4
{
margin
:
0
;
}
/***************************************************************
Dossiers
***************************************************************/
...
...
src/memopol/templates/blocks/_chamber_card.html
0 → 100644
View file @
f18ce532
{% load i18n %}
{% load fontawesome %}
{% load memopol_tags %}
<div
class=
"col-xs-12 col-md-{{ cols|default:4 }} chamber-card"
>
<div
class=
"thumbnail"
>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<div
class=
"title-container"
>
<h4
class=
"text-center"
>
{{ chamber.name }}
</h4>
{{ chamber|chamber_icon }}
</div>
<div
class=
"description"
>
{% blocktrans with dossiers=chamber.nb_dossiers proposals=chamber.nb_proposals %}
<b>
{{ dossiers }} dossiers
</b>
and
<b>
{{ proposals }} proposals
</b>
{% endblocktrans %}
</div>
<div
class=
"chart-container"
>
</div>
</div>
</div>
</div>
</div>
src/memopol/templates/home.html
View file @
f18ce532
...
...
@@ -83,6 +83,16 @@
</div>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h2>
{% trans "Chambers in this instance" %}
</h2>
</div>
{% for chamber in chambers %}
{% include "blocks/_chamber_card.html" with chamber=chamber %}
{% endfor %}
</div>
<div
class=
"row"
>
<div
class=
"col-md-4"
>
<h3>
{% trans "More information" %}
</h3>
...
...
src/memopol/tests/test_home_navigation_pane.py
View file @
f18ce532
...
...
@@ -9,19 +9,23 @@ class NavigationPaneTest(BaseTest):
self
.
client
.
get
(
self
.
url
)
"""
Today mep
- 1 for count reps with non null score
- 1 for random mep
- 1 for prefetch main mandate
Latest votes
- 1 for latest votes count setting
- 1 for latest votes (proposal)
- 1 for prefetching latest votes themes
- 1 for prefetching latest votes dossier themes
- 1 for prefetching latest votes dossier documents
- 1 for prefetching latest votes dossier documents chambers
Featured themes
- 1 for featured themes
- 3 for Today mep
- 1 for count reps with non null score
- 1 for random mep
- 1 for prefetch main mandate
- 6 for Latest votes
- 1 for latest votes count setting
- 1 for latest votes (proposal)
- 1 for prefetching latest votes themes
- 1 for prefetching latest votes dossier themes
- 1 for prefetching latest votes dossier documents
- 1 for prefetching latest votes dossier documents chambers
- 1 for Featured themes
- 1 for featured themes
- 0 for Chambers
- 1 for chambers and dossier/proposal counts
=> note: django optimizes out the chamber query for left pane
forms so this one actually does not add 1 to query count
"""
home_queries
=
10
...
...
src/memopol/views/home.py
View file @
f18ce532
...
...
@@ -6,7 +6,7 @@ import random
from
django.db.models
import
Q
,
Count
from
django.views
import
generic
from
representatives.models
import
Representative
from
representatives.models
import
Chamber
,
Representative
from
representatives_positions.views
import
PositionFormMixin
from
representatives_votes.models
import
Proposal
...
...
@@ -57,4 +57,12 @@ class HomeView(PositionFormMixin, RepresentativeViewMixin,
'dossier__documents__chamber'
)
\
.
order_by
(
'-datetime'
)[
0
:
num
]
# Chambers
c
[
'chambers'
]
=
Chamber
.
objects
.
all
()
\
.
annotate
(
nb_dossiers
=
Count
(
'documents__dossier'
,
distinct
=
True
),
nb_proposals
=
Count
(
'documents__dossier__proposals'
,
distinct
=
True
))
return
c
src/representatives_votes/models.py
View file @
f18ce532
...
...
@@ -38,7 +38,7 @@ class Dossier(TimeStampedModel):
class
Document
(
TimeStampedModel
):
dossier
=
models
.
ForeignKey
(
Dossier
,
related_name
=
'documents'
)
chamber
=
models
.
ForeignKey
(
Chamber
)
chamber
=
models
.
ForeignKey
(
Chamber
,
related_name
=
'documents'
)
title
=
models
.
CharField
(
max_length
=
1000
)
kind
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
default
=
''
)
link
=
models
.
URLField
(
max_length
=
1000
)
...
...
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