From b680b71458283d32afddcd0188c980e96ee14158 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Sun, 4 Apr 2021 23:30:31 +0200 Subject: [PATCH] update data --- src/covid19/blueprints/owid/owid_views.py | 2 +- .../date_reported/owid_date_reported_all.html | 79 ++----------------- .../owid_date_reported_all_pagination.html | 34 ++++++++ .../owid_date_reported_all_table.html | 38 +++++++++ .../date_reported/owid_date_reported_one.html | 6 +- ...=> owid_date_reported_one_pagination.html} | 0 .../owid_date_reported_one_table.html} | 0 .../{ => owid_imported}/owid_imported.html | 6 +- .../owid_imported_pagination.html} | 0 .../owid_imported_table.html} | 0 10 files changed, 86 insertions(+), 79 deletions(-) create mode 100644 src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_pagination.html create mode 100644 src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_table.html rename src/covid19/blueprints/owid/templates/owid/date_reported/{owid_date_reported_pagination.html => owid_date_reported_one_pagination.html} (100%) rename src/covid19/blueprints/owid/templates/owid/{fragments/fragment_owid_table_global_data_date_reported.html => date_reported/owid_date_reported_one_table.html} (100%) rename src/covid19/blueprints/owid/templates/owid/{ => owid_imported}/owid_imported.html (67%) rename src/covid19/blueprints/owid/templates/owid/{fragments/fragment_owid_imported_pagination.html => owid_imported/owid_imported_pagination.html} (100%) rename src/covid19/blueprints/owid/templates/owid/{fragments/fragment_owid_imported_table.html => owid_imported/owid_imported_table.html} (100%) diff --git a/src/covid19/blueprints/owid/owid_views.py b/src/covid19/blueprints/owid/owid_views.py index fbeba650..7ce63ce4 100644 --- a/src/covid19/blueprints/owid/owid_views.py +++ b/src/covid19/blueprints/owid/owid_views.py @@ -236,7 +236,7 @@ def url_owid_imported(page=1): flash("No data in the database.") page_data = None return render_template( - 'owid/owid_imported.html', + 'owid/owid_imported/owid_imported.html', page_data=page_data, page_info=page_info) diff --git a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all.html b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all.html index c35a754d..b45ae503 100644 --- a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all.html +++ b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all.html @@ -7,82 +7,17 @@ <div class="container"> <div class="row"> <div class="col"> - {% if page_data.pages > 1 %} - <!-- previous page --> - <ul class="pagination"> - {% if page_data.has_prev %} - <li class="page-item"> - <a class="page-link" href="{{ url_for('owid.url_owid_date_reported_all', page=page_data.prev_num) }}">Previous</a> - </li> - {% endif %} - <!-- all page numbers --> - {% for page_num in page_data.iter_pages() %} - {% if page_num %} - {% if page_num != page_data.page %} - <li class="page-item"> - <a class="page-link" href="{{ url_for('owid.url_owid_date_reported_all', page=page_num) }}">{{ page_num }}</a> - </li> - {% else %} - <li class="page-item active"> - <a class="page-link" href="#">{{ page_num }}</a> - </li> - {% endif %} - {% else %} - <li class="page-item"> - <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> - </li> - {% endif %} - {% endfor %} - <!-- next page --> - {% if page_data.has_next %} - <li class="page-item"> - <a class="page-link" href="{{ url_for('owid.url_owid_date_reported_all', page=page_data.next_num) }}">Next</a> - </li> - {% endif %} - </ul> - {% endif %} + {% include 'owid/date_reported/owid_date_reported_all_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - <table class="table table-hover table-striped table-dark"> - <thead class="table-secondary"> - <tr> - <th scope="col" class="text-right">day of week</th> - <th scope="col" class="text-left">date reported</th> - <th scope="col" class="text-right">week of year</th> - <th scope="col" class="text-left">year</th> - </tr> - </thead> - <tbody> - {% for owid_date_reported in page_data.items %} - <tr> - <td class="text-right"> - {{ owid_date_reported.get_name_for_weekday() }} - </td> - <td class="text-left"> - <a href="/owid/date_reported/{{ owid_date_reported.id }}"> - {{ owid_date_reported }} - </a> - </td> - <td class="text-right"> - {{ owid_date_reported.week_of_year }} - </td> - <td class="text-left"> - {{ owid_date_reported.year }} - </td> - </tr> - {% endfor %} - </tbody> - <tfoot class="table-secondary"> - <tr> - <th scope="col" class="text-right">day of week</th> - <th scope="col" class="text-left">date reported</th> - <th scope="col" class="text-right">week of year</th> - <th scope="col" class="text-left">year</th> - </tr> - </tfoot> - </table> + {% include 'owid/date_reported/owid_date_reported_all_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'owid/date_reported/owid_date_reported_all_pagination.html' %} </div> </div> </div> diff --git a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_pagination.html b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_pagination.html new file mode 100644 index 00000000..a1e014fe --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_pagination.html @@ -0,0 +1,34 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" href="{{ url_for('owid.url_owid_date_reported_all', page=page_data.prev_num) }}">Previous</a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" href="{{ url_for('owid.url_owid_date_reported_all', page=page_num) }}">{{ page_num }}</a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" href="{{ url_for('owid.url_owid_date_reported_all', page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} diff --git a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_table.html b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_table.html new file mode 100644 index 00000000..52e18cc1 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_all_table.html @@ -0,0 +1,38 @@ + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + <tr> + <th scope="col" class="text-right">day of week</th> + <th scope="col" class="text-left">date reported</th> + <th scope="col" class="text-right">week of year</th> + <th scope="col" class="text-left">year</th> + </tr> + </thead> + <tbody> + {% for owid_date_reported in page_data.items %} + <tr> + <td class="text-right"> + {{ owid_date_reported.get_name_for_weekday() }} + </td> + <td class="text-left"> + <a href="/owid/date_reported/{{ owid_date_reported.id }}"> + {{ owid_date_reported }} + </a> + </td> + <td class="text-right"> + {{ owid_date_reported.week_of_year }} + </td> + <td class="text-left"> + {{ owid_date_reported.year }} + </td> + </tr> + {% endfor %} + </tbody> + <tfoot class="table-secondary"> + <tr> + <th scope="col" class="text-right">day of week</th> + <th scope="col" class="text-left">date reported</th> + <th scope="col" class="text-right">week of year</th> + <th scope="col" class="text-left">year</th> + </tr> + </tfoot> + </table> \ No newline at end of file diff --git a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one.html b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one.html index 59100f37..71784df9 100644 --- a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one.html +++ b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one.html @@ -7,17 +7,17 @@ <div class="container"> <div class="row"> <div class="col"> - {% include 'owid/date_reported/owid_date_reported_pagination.html' %} + {% include 'owid/date_reported/owid_date_one_reported_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_table_global_data_date_reported.html' %} + {% include 'owid/date_reported/owid_date_reported_one_table.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/date_reported/owid_date_reported_pagination.html' %} + {% include 'owid/date_reported/owid_date_reported_one_pagination.html' %} </div> </div> </div> diff --git a/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_pagination.html b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one_pagination.html similarity index 100% rename from src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_pagination.html rename to src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one_pagination.html diff --git a/src/covid19/blueprints/owid/templates/owid/fragments/fragment_owid_table_global_data_date_reported.html b/src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one_table.html similarity index 100% rename from src/covid19/blueprints/owid/templates/owid/fragments/fragment_owid_table_global_data_date_reported.html rename to src/covid19/blueprints/owid/templates/owid/date_reported/owid_date_reported_one_table.html diff --git a/src/covid19/blueprints/owid/templates/owid/owid_imported.html b/src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported.html similarity index 67% rename from src/covid19/blueprints/owid/templates/owid/owid_imported.html rename to src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported.html index 8fd968a4..6174c062 100644 --- a/src/covid19/blueprints/owid/templates/owid/owid_imported.html +++ b/src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported.html @@ -7,17 +7,17 @@ <div class="container"> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_imported_pagination.html' %} + {% include 'owid/owid_imported/owid_imported_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_imported_table.html' %} + {% include 'owid/owid_imported/owid_imported_table.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_imported_pagination.html' %} + {% include 'owid/owid_imported/owid_imported_pagination.html' %} </div> </div> </div> diff --git a/src/covid19/blueprints/owid/templates/owid/fragments/fragment_owid_imported_pagination.html b/src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported_pagination.html similarity index 100% rename from src/covid19/blueprints/owid/templates/owid/fragments/fragment_owid_imported_pagination.html rename to src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported_pagination.html diff --git a/src/covid19/blueprints/owid/templates/owid/fragments/fragment_owid_imported_table.html b/src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported_table.html similarity index 100% rename from src/covid19/blueprints/owid/templates/owid/fragments/fragment_owid_imported_table.html rename to src/covid19/blueprints/owid/templates/owid/owid_imported/owid_imported_table.html -- GitLab