diff --git a/src/covid19/blueprints/owid/owid_views.py b/src/covid19/blueprints/owid/owid_views.py index fbeba6509ae4c53596ed1fae5f4faa80e31b0454..7ce63ce410b91e11fbe4428653d22e3fdc6fb936 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 c35a754d6b5f0ff19f37e42cb02fdfd8dcf58260..b45ae50331641eac576fd6c011622aed6c6e01d4 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 0000000000000000000000000000000000000000..a1e014fe75858ba7db12dfae74bd01506e791563 --- /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 0000000000000000000000000000000000000000..52e18cc16f24613f589fc4b670ae6d7e83eda2d0 --- /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 59100f379b9d22a286926ea54c7b14caf5a9623a..71784df96e1687d561ec928c5eba55d33db01da4 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 8fd968a46f46da5a281c808ad0fb743cb21a1768..6174c06240d25c4b2a59c549b59c07c197c46891 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