From 16b458932eb1c7ad13be50b2cf187af27c962daf Mon Sep 17 00:00:00 2001 From: SvyatoslavArtymovych Date: Wed, 21 Jun 2023 16:22:14 +0300 Subject: [PATCH] sort by btns --- app/__init__.py | 3 + .../book/components/header_buttons.html | 58 +----------------- .../book/components/new_book_btn.html | 3 + .../book/components/sort_by_btn.html | 53 +++++++++++++++++ app/templates/book/favorite_books.html | 5 ++ app/templates/book/my_contributions.html | 9 ++- app/templates/book/my_library.html | 35 ++++------- app/templates/header.html | 59 ++----------------- app/templates/home/explore_books.html | 5 ++ app/templates/home/index.html | 3 + app/templates/right_sidebar.html | 30 ---------- 11 files changed, 100 insertions(+), 163 deletions(-) create mode 100644 app/templates/book/components/new_book_btn.html create mode 100644 app/templates/book/components/sort_by_btn.html delete mode 100644 app/templates/right_sidebar.html diff --git a/app/__init__.py b/app/__init__.py index ba5bf98..78b9567 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,5 +1,6 @@ import os import warnings +from uuid import uuid4 from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy @@ -81,6 +82,8 @@ def create_app(environment="development"): app.jinja_env.globals["type"] = type app.jinja_env.globals["m"] = m + app.jinja_env.globals["str"] = str + app.jinja_env.globals["uuid"] = uuid4 app.jinja_env.globals["Access"] = m.Permission.Access app.jinja_env.globals["EntityType"] = m.Permission.Entity diff --git a/app/templates/book/components/header_buttons.html b/app/templates/book/components/header_buttons.html index 9e0c0ee..80adae6 100644 --- a/app/templates/book/components/header_buttons.html +++ b/app/templates/book/components/header_buttons.html @@ -2,64 +2,12 @@ diff --git a/app/templates/book/components/new_book_btn.html b/app/templates/book/components/new_book_btn.html new file mode 100644 index 0000000..0c9f216 --- /dev/null +++ b/app/templates/book/components/new_book_btn.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/app/templates/book/components/sort_by_btn.html b/app/templates/book/components/sort_by_btn.html new file mode 100644 index 0000000..021b8aa --- /dev/null +++ b/app/templates/book/components/sort_by_btn.html @@ -0,0 +1,53 @@ +{% set unique_id = str(uuid()) %} + + + + + + + \ No newline at end of file diff --git a/app/templates/book/favorite_books.html b/app/templates/book/favorite_books.html index bde83e8..ab11d25 100644 --- a/app/templates/book/favorite_books.html +++ b/app/templates/book/favorite_books.html @@ -30,6 +30,11 @@ {% endif %} +
+ {% include 'book/components/new_book_btn.html' %} + {% include 'book/components/sort_by_btn.html' %} +
+ {% for book in books %} {% include 'book/components/book_list_item.html' %} {% endfor %} diff --git a/app/templates/book/my_contributions.html b/app/templates/book/my_contributions.html index 2e33c7d..e684a0d 100644 --- a/app/templates/book/my_contributions.html +++ b/app/templates/book/my_contributions.html @@ -6,7 +6,8 @@ {% block content %}
+ class="pt-1 relative sm:rounded-lg mt-1 h-box flex" +> {% if not current_user.is_authenticated %}
@@ -27,9 +28,13 @@ {% if current_user.is_authenticated %} {% include 'book/components/header_buttons.html' %} {% endif %} -
+
{% endif %} +
+ {% include 'book/components/sort_by_btn.html' %} +
+ {% for interpretation in interpretations %} {% with show_control_btns=True %} diff --git a/app/templates/book/my_library.html b/app/templates/book/my_library.html index 10fe451..858fa5f 100644 --- a/app/templates/book/my_library.html +++ b/app/templates/book/my_library.html @@ -22,27 +22,7 @@ {% endif %} {% if current_user.is_authenticated and not books.total %}
- + {% include 'book/components/new_book_btn.html' %}
{% endif %} @@ -56,8 +36,17 @@ {% endif %} - {% endif %} {% for book in books if not book.is_deleted %} {% include - 'book/components/book_list_item.html' %} {% endfor %} + {% endif %} + +
+ {% include 'book/components/new_book_btn.html' %} + {% include 'book/components/sort_by_btn.html' %} +
+ + + {% for book in books if not book.is_deleted %} + {% include 'book/components/book_list_item.html' %} + {% endfor %} {% if current_user.is_authenticated and page.pages > 1 %} diff --git a/app/templates/header.html b/app/templates/header.html index e11c909..21c3b15 100644 --- a/app/templates/header.html +++ b/app/templates/header.html @@ -11,60 +11,13 @@ - OpenLaw Logo + + OpenLaw Logo + + - {% if selected_tab=='my_library' or selected_tab=='favorite_books' or selected_tab=='explore_books' or selected_tab=='latest_interpretations' or selected_tab=='my_contributions' %} - - - - - - {% endif %} {% include 'sidebar.html' %} {% include 'searchbar.html' %} diff --git a/app/templates/home/explore_books.html b/app/templates/home/explore_books.html index eb28cfe..cda8a99 100644 --- a/app/templates/home/explore_books.html +++ b/app/templates/home/explore_books.html @@ -33,6 +33,11 @@ + +
+ {% include 'book/components/sort_by_btn.html' %} +
+
diff --git a/app/templates/home/index.html b/app/templates/home/index.html index 08d70e7..98716b1 100644 --- a/app/templates/home/index.html +++ b/app/templates/home/index.html @@ -32,6 +32,9 @@
+
+ {% include 'book/components/sort_by_btn.html' %} +