From 05ab92ddf9a261c48292fcbb4a2d216d705ee632 Mon Sep 17 00:00:00 2001 From: Dinuka De Silva Date: Mon, 13 Jul 2020 22:22:08 +0530 Subject: [PATCH 1/2] gh-671: Avoid margins to fix the print layout alignments --- .../ParliamentaryElection2020/AI-LETTER.html | 12 ++++-------- .../ParliamentaryElection2020/PE-21-LETTER.html | 12 ++++-------- .../PE-CE-RO-V1-LETTER.html | 12 ++++-------- .../ParliamentaryElection2020/PE-R2-LETTER.html | 14 +++++--------- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html index 6e22101b..f1766e28 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html @@ -14,17 +14,11 @@ .table th { font-weight: 800; } - - .report-header span { - display: block; - margin-bottom: 5px; - } - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#}
- +
@@ -47,6 +41,8 @@
+
+ @@ -130,7 +126,7 @@
- +
{% if pageNumber in [1,2,3,4] %}
diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html index 89f5d6d2..a005f78f 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html @@ -14,17 +14,11 @@ .table th { font-weight: 800; } - - .report-header span { - display: block; - margin-bottom: 5px; - } - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#}
- +
@@ -47,6 +41,8 @@
+
+ @@ -75,7 +71,7 @@
- +
{% if pageNumber in [1,2,3,4] %}
diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html index fda4e112..16c3ea34 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html @@ -14,17 +14,11 @@ .table th { font-weight: 800; } - - .report-header span { - display: block; - margin-bottom: 5px; - } - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#}
- +
@@ -48,6 +42,8 @@
+
+ @@ -131,7 +127,7 @@
- +
{% if pageNumber in [1,2,3,4] %}
diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html index 0eea595f..ff6b7b03 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html @@ -14,17 +14,11 @@ .table th { font-weight: 800; } - - .report-header span { - display: block; - margin-bottom: 5px; - } - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#} -
- +
+
@@ -47,6 +41,8 @@
+
+ @@ -133,7 +129,7 @@
- +
{% if pageNumber in [1,2,3,4] %}
From 6f4f7f1f0f0fc3607ee4618d48ace7a493c3ca9f Mon Sep 17 00:00:00 2001 From: Dinuka De Silva Date: Mon, 13 Jul 2020 22:42:46 +0530 Subject: [PATCH 2/2] gh-671: Refactoring * Seprate the letter signatures to a common jinja template --- results-tabulation-api/static/css/styles.css | 1 - .../ParliamentaryElection2020/AI-LETTER.html | 258 +++++++---------- .../PE-21-LETTER.html | 149 ++++------ .../PE-CE-RO-V1-LETTER.html | 259 +++++++---------- .../PE-R2-LETTER.html | 264 +++++++----------- .../letter_with_signatures.html | 58 ++++ 6 files changed, 428 insertions(+), 561 deletions(-) create mode 100644 results-tabulation-api/templates/ParliamentaryElection2020/letter_with_signatures.html diff --git a/results-tabulation-api/static/css/styles.css b/results-tabulation-api/static/css/styles.css index 2b9a7ff7..935414d6 100644 --- a/results-tabulation-api/static/css/styles.css +++ b/results-tabulation-api/static/css/styles.css @@ -12,7 +12,6 @@ width: 100%; position: fixed; left: 0; - width: 100%; } .printer-only.printer-only-header { diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html index f1766e28..05579150 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/AI-LETTER.html @@ -1,160 +1,112 @@ -{% extends 'base.html' %} +{% extends 'ParliamentaryElection2020/letter_with_signatures.html' %} -{% block container %} - {% for pageNumber in [1,2,3,4] %} - - - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#} -
- - - - - + + + +
-
- OFFICIAL RESULTS -
- DEPARTMENT OF ELECTIONS
- +{% block letter_header %} + + + + + - - - -
+
+ OFFICIAL RESULTS +
+ DEPARTMENT OF ELECTIONS
+ {{ content.election.electionName }}
- Votes Received By Each Party
- + Votes Received By Each Party
+ All Island - Sri Lanka -
- -
- - - - - - - - - - - {% for row in content.data %} - - - - - - - - {% endfor %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Name of the PartyParty AbbreviationVotes ReceivedPercentage
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}
Total Valid Votes - {{ content.validVoteCounts[0] }} - - {{ content.validVoteCounts[1] }} -
Rejected Votes - {{ content.rejectedVoteCounts[0] }} - - {{ content.rejectedVoteCounts[1] }} -
Total Polled - {{ content.totalVoteCounts[0] }} - - {{ content.totalVoteCounts[1] }} -
Registered No. of Electors{{ content.registeredVoters[0] }}
Time{{ content.time }}
Date{{ content.date }}
- - - {% if pageNumber in [1,2,3,4] %} - - {% endif %} - {% if pageNumber in [1,2] %} - - {% endif %} - {% if pageNumber in [1,3] %} - - {% endif %} - -
- ....................................
- MAHINDA DESHAPRIYA
- Chairman
- Election Commission -
- ....................................
- N. J. ABEYESEKERE
- Member
- Election Commission -
- ....................................
- S. RATNAJEEVAN H. HOOLE
- Member
- Election Commission -
+
+{% endblock %} -
- {% endfor %} +{% block letter_content %} + + + + + + + + + + {% for row in content.data %} + + + + + + + + {% endfor %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Name of the PartyParty AbbreviationVotes ReceivedPercentage
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}
Total Valid Votes + {{ content.validVoteCounts[0] }} + + {{ content.validVoteCounts[1] }} +
Rejected Votes + {{ content.rejectedVoteCounts[0] }} + + {{ content.rejectedVoteCounts[1] }} +
Total Polled + {{ content.totalVoteCounts[0] }} + + {{ content.totalVoteCounts[1] }} +
Registered No. of Electors{{ content.registeredVoters[0] }}
Time{{ content.time }}
Date{{ content.date }}
{% endblock %} diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html index a005f78f..62c9a054 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/PE-21-LETTER.html @@ -1,105 +1,58 @@ -{% extends 'base.html' %} +{% extends 'ParliamentaryElection2020/letter_with_signatures.html' %} -{% block container %} - {% for pageNumber in [1,2,3,4] %} - - - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#} -
- - - - - + + + +
-
- OFFICIAL RESULTS -
- DEPARTMENT OF ELECTIONS
- +{% block letter_header %} + + + + + - - - -
+
+ OFFICIAL RESULTS +
+ DEPARTMENT OF ELECTIONS
+ {{ content.election.electionName }}
- Candidates Selected to The Parliament
- + Candidates Selected to The Parliament
+ Electoral District - {{ content.electoralDistrict }} -
- -
- - - - - - - - - - - - {% for row in content.data %} - - - - - - - - - {% endfor %} - - - - -
#Name of the PartyParty AbbreviationCandidate NameCandidate NumberPreference Count
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}{{ row[4] }}
- - - {% if pageNumber in [1,2,3,4] %} - - {% endif %} - {% if pageNumber in [1,2] %} - - {% endif %} - {% if pageNumber in [1,3] %} - - {% endif %} - -
- ....................................
- MAHINDA DESHAPRIYA
- Chairman
- Election Commission -
- ....................................
- N. J. ABEYESEKERE
- Member
- Election Commission -
- ....................................
- S. RATNAJEEVAN H. HOOLE
- Member
- Election Commission -
+
+{% endblock %} -
- {% endfor %} +{% block letter_content %} + + + + + + + + + + + {% for row in content.data %} + + + + + + + + + {% endfor %} + + + + +
#Name of the PartyParty AbbreviationCandidate NameCandidate NumberPreference Count
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}{{ row[4] }}
{% endblock %} + diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html index 16c3ea34..96565192 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/PE-CE-RO-V1-LETTER.html @@ -1,161 +1,114 @@ -{% extends 'base.html' %} +{% extends 'ParliamentaryElection2020/letter_with_signatures.html' %} -{% block container %} - {% for pageNumber in [1,2,3,4] %} - - - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#} -
- - - - - + + + +
-
- OFFICIAL RESULTS -
- DEPARTMENT OF ELECTIONS
- +{% block letter_header %} + + + + + - - - -
+
+ OFFICIAL RESULTS +
+ DEPARTMENT OF ELECTIONS
+ {{ content.election.electionName }}
- Votes Received By Each Party
- + Votes Received By Each Party
+ Electoral District - {{ content.electoralDistrict }} | Polling Division - {{ content.pollingDivision }} -
- -
- - - - - - - - - - - {% for row in content.data %} - - - - - - - - {% endfor %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Name of the PartyParty AbbreviationVotes ReceivedPercentage
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}
Total Valid Votes - {{ content.validVoteCounts[0] }} - - {{ content.validVoteCounts[1] }} -
Rejected Votes - {{ content.rejectedVoteCounts[0] }} - - {{ content.rejectedVoteCounts[1] }} -
Total Polled - {{ content.totalVoteCounts[0] }} - - {{ content.totalVoteCounts[1] }} -
Registered No. of Electors{{ content.registeredVoters[0] }}
Time{{ content.time }}
Date{{ content.date }}
- - - {% if pageNumber in [1,2,3,4] %} - - {% endif %} - {% if pageNumber in [1,2] %} - - {% endif %} - {% if pageNumber in [1,3] %} - - {% endif %} - -
- ....................................
- MAHINDA DESHAPRIYA
- Chairman
- Election Commission -
- ....................................
- N. J. ABEYESEKERE
- Member
- Election Commission -
- ....................................
- S. RATNAJEEVAN H. HOOLE
- Member
- Election Commission -
+
+{% endblock %} -
- {% endfor %} +{% block letter_content %} + + + + + + + + + + {% for row in content.data %} + + + + + + + + {% endfor %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Name of the PartyParty AbbreviationVotes ReceivedPercentage
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}
Total Valid Votes + {{ content.validVoteCounts[0] }} + + {{ content.validVoteCounts[1] }} +
Rejected Votes + {{ content.rejectedVoteCounts[0] }} + + {{ content.rejectedVoteCounts[1] }} +
Total Polled + {{ content.totalVoteCounts[0] }} + + {{ content.totalVoteCounts[1] }} +
Registered No. of Electors{{ content.registeredVoters[0] }}
Time{{ content.time }}
Date{{ content.date }}
{% endblock %} + diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html b/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html index ff6b7b03..6c26e985 100644 --- a/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html +++ b/results-tabulation-api/templates/ParliamentaryElection2020/PE-R2-LETTER.html @@ -1,163 +1,115 @@ -{% extends 'base.html' %} +{% extends 'ParliamentaryElection2020/letter_with_signatures.html' %} -{% block container %} - {% for pageNumber in [1,2,3,4] %} - - - {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#} -
- - - - - + + + +
-
- OFFICIAL RESULTS -
- DEPARTMENT OF ELECTIONS
- +{% block letter_header %} + + + + + - - - -
+
+ OFFICIAL RESULTS +
+ DEPARTMENT OF ELECTIONS
+ {{ content.election.electionName }}
- Party Wise Seat Allocation
- + Party Wise Seat Allocation
+ Electoral District - {{ content.electoralDistrict }} -
- -
- - - - - - - - - - - - {% for row in content.data %} - - - - - - - - - {% endfor %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Name of the PartyParty AbbreviationVotes ReceivedVote PercentageSeat Count
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}{{ row[4] }}
Total Valid Votes - {{ content.validVoteCounts[0] }} - - {{ content.validVoteCounts[1] }} -
Rejected Votes - {{ content.rejectedVoteCounts[0] }} - - {{ content.rejectedVoteCounts[1] }} -
Total Polled - {{ content.totalVoteCounts[0] }} - - {{ content.totalVoteCounts[1] }} -
Registered No. of Electors{{ content.registeredVoters[0] }}
Time{{ content.time }}
Date{{ content.date }}
- - - {% if pageNumber in [1,2,3,4] %} - - {% endif %} - {% if pageNumber in [1,2] %} - - {% endif %} - {% if pageNumber in [1,3] %} - - {% endif %} - -
- ....................................
- MAHINDA DESHAPRIYA
- Chairman
- Election Commission -
- ....................................
- N. J. ABEYESEKERE
- Member
- Election Commission -
- ....................................
- S. RATNAJEEVAN H. HOOLE
- Member
- Election Commission -
+
+{% endblock %} -
- {% endfor %} +{% block letter_content %} + + + + + + + + + + + {% for row in content.data %} + + + + + + + + + {% endfor %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Name of the PartyParty AbbreviationVotes ReceivedVote PercentageSeat Count
{{ loop.index }}{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}{{ row[4] }}
Total Valid Votes + {{ content.validVoteCounts[0] }} + + {{ content.validVoteCounts[1] }} +
Rejected Votes + {{ content.rejectedVoteCounts[0] }} + + {{ content.rejectedVoteCounts[1] }} +
Total Polled + {{ content.totalVoteCounts[0] }} + + {{ content.totalVoteCounts[1] }} +
Registered No. of Electors{{ content.registeredVoters[0] }}
Time{{ content.time }}
Date{{ content.date }}
{% endblock %} diff --git a/results-tabulation-api/templates/ParliamentaryElection2020/letter_with_signatures.html b/results-tabulation-api/templates/ParliamentaryElection2020/letter_with_signatures.html new file mode 100644 index 00000000..a30d7c2a --- /dev/null +++ b/results-tabulation-api/templates/ParliamentaryElection2020/letter_with_signatures.html @@ -0,0 +1,58 @@ +{% extends 'base.html' %} + +{% block container %} + {% for pageNumber in [1,2,3,4] %} + + + {# TODO review why "padding-top: 1px" is needed to align the pages on print view.#} +
+ {% block letter_header %}{% endblock %} + +
+ + {% block letter_content %}{% endblock %} + + + + {% if pageNumber in [1,2,3,4] %} + + {% endif %} + {% if pageNumber in [1,2] %} + + {% endif %} + {% if pageNumber in [1,3] %} + + {% endif %} + +
+ ....................................
+ MAHINDA DESHAPRIYA
+ Chairman
+ Election Commission +
+ ....................................
+ N. J. ABEYESEKERE
+ Member
+ Election Commission +
+ ....................................
+ S. RATNAJEEVAN H. HOOLE
+ Member
+ Election Commission +
+ +
+ {% endfor %} +{% endblock %}