Merge pull request #12 from Simple2B/svyat/fix/displaying_crud_btns

hide right side bar buttons if current users is not owner of book
This commit is contained in:
Svyatoslav Artymovych 2023-04-28 12:28:49 +03:00 committed by GitHub
commit 070c9fbcec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

View File

@ -1,11 +1,14 @@
<!-- prettier-ignore -->
{% extends 'base.html' %}
{% if book.owner.id == current_user.id %}
<!-- show create collection btn on rightside bar -->
{% set show_create_collection = True %}
<!-- prettier-ignore -->
{% include 'book/add_collection_modal.html' %}
{% endif %}
{% block right_sidebar %}

View File

@ -2,6 +2,7 @@
<aside id="logo-right-sidebar" class="fixed top-0 right-0 left-auto z-40 w-64 h-screen pt-28 transition-transform translate-x-96 bg-white border-r border-gray-200 md:translate-x-0 dark:bg-gray-800 dark:border-gray-700" aria-label="Right-sidebar">
<div class="h-full pb-4 overflow-y-auto bg-white dark:bg-gray-800">
<ul class="space-y-4 mt-1 font-medium">
{% if book.owner.id == current_user.id %}
<li>
<!-- prettier-ignore -->
<a href="{{ url_for("book.settings", book_id=book.id) }}" type="button" class="space-x-3 text-white ml-2 w-11/12 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" >
@ -9,6 +10,7 @@
<p>Book Settings</p>
</a>
</li>
{% endif %}
{% if show_create_collection %}
<li>

View File

@ -1,6 +1,7 @@
<!-- prettier-ignore -->
{% extends 'base.html' %}
{% if book.owner.id == current_user.id %}
<!-- show edit collection btn on rightside bar -->
{% set show_edit_collection = True %}
<!-- show delete collection btn on rightside bar -->
@ -9,6 +10,7 @@
<!-- prettier-ignore -->
{% include 'book/edit_collection_modal.html' %}
{% include 'book/delete_collection_modal.html' %}
{% endif %}
<!-- prettier-ignore -->
{% block right_sidebar %}

View File

@ -1,6 +1,7 @@
<!-- prettier-ignore -->
{% extends 'base.html' %}
{% if book.owner.id == current_user.id %}
<!-- show edit collection btn on rightside bar -->
{% set show_edit_collection = True %}
<!-- show delete collection btn on rightside bar -->
@ -12,6 +13,7 @@
{% include 'book/edit_collection_modal.html' %}
{% include 'book/delete_collection_modal.html' %}
{% include 'book/add_collection_modal.html' %}
{% endif %}
{% block right_sidebar %}