From 20a00f916b2facf2d50095677d66e8b76ece36f0 Mon Sep 17 00:00:00 2001 From: Shantanu Tomar Date: Mon, 22 Jan 2024 11:36:43 +0530 Subject: [PATCH 1/8] Make page full layout --- .../layouts/tpstreams/full_page_layout.html | 30 ++++ src/tpstreams/roles/detail.html | 33 +++++ src/tpstreams/roles/includes/alert.html | 24 ++++ .../roles/includes/assign_role_users.html | 97 +++++++++++++ .../roles/includes/detail_header.html | 56 ++++++++ .../includes/modals/create_role_modal.html | 32 +++++ .../includes/modals/delete_role_modal.html | 52 +++++++ .../includes/modals/remove_user_modal.html | 49 +++++++ .../includes/modals/rename_role_modal.html | 34 +++++ .../roles/includes/permission_table.html | 65 +++++++++ .../roles/includes/role_detail_scripts.html | 136 ++++++++++++++++++ .../roles/includes/roles_list_empty.html | 14 ++ .../roles/includes/roles_list_header.html | 8 ++ .../roles/includes/roles_list_inner.html | 38 +++++ .../roles/includes/roles_list_scripts.html | 57 ++++++++ src/tpstreams/roles/includes/toggle.html | 8 ++ src/tpstreams/roles/includes/toggles_row.html | 5 + src/tpstreams/roles/index.html | 34 +++++ src/tpstreams/roles/roles.json | 64 +++++++++ .../settings/includes/desktop_tabs.html | 2 + .../settings/includes/tablet_tabs.html | 2 + 21 files changed, 840 insertions(+) create mode 100644 src/_includes/layouts/tpstreams/full_page_layout.html create mode 100644 src/tpstreams/roles/detail.html create mode 100644 src/tpstreams/roles/includes/alert.html create mode 100644 src/tpstreams/roles/includes/assign_role_users.html create mode 100644 src/tpstreams/roles/includes/detail_header.html create mode 100644 src/tpstreams/roles/includes/modals/create_role_modal.html create mode 100644 src/tpstreams/roles/includes/modals/delete_role_modal.html create mode 100644 src/tpstreams/roles/includes/modals/remove_user_modal.html create mode 100644 src/tpstreams/roles/includes/modals/rename_role_modal.html create mode 100644 src/tpstreams/roles/includes/permission_table.html create mode 100644 src/tpstreams/roles/includes/role_detail_scripts.html create mode 100644 src/tpstreams/roles/includes/roles_list_empty.html create mode 100644 src/tpstreams/roles/includes/roles_list_header.html create mode 100644 src/tpstreams/roles/includes/roles_list_inner.html create mode 100644 src/tpstreams/roles/includes/roles_list_scripts.html create mode 100644 src/tpstreams/roles/includes/toggle.html create mode 100644 src/tpstreams/roles/includes/toggles_row.html create mode 100644 src/tpstreams/roles/index.html create mode 100644 src/tpstreams/roles/roles.json diff --git a/src/_includes/layouts/tpstreams/full_page_layout.html b/src/_includes/layouts/tpstreams/full_page_layout.html new file mode 100644 index 000000000..852e49430 --- /dev/null +++ b/src/_includes/layouts/tpstreams/full_page_layout.html @@ -0,0 +1,30 @@ +{% extends "layouts/tpstreams/base.html" %} + +{% block html_class %}h-full bg-white{% endblock html_class %} +{% block body_class %}h-full{% endblock body_class %} + +{% block content %} +
+ +
+
+
+
+ {% block main_content %} + {% endblock main_content %} +
+
+
+
+
+{% endblock content %} diff --git a/src/tpstreams/roles/detail.html b/src/tpstreams/roles/detail.html new file mode 100644 index 000000000..419286b48 --- /dev/null +++ b/src/tpstreams/roles/detail.html @@ -0,0 +1,33 @@ +--- +title: Staff User - Roles +permalink: "tpstreams/roles/staff-user/" +date: 2024-01-20 +--- + +{% extends "layouts/tpstreams/full_page_layout.html" %} + +{% block body_class %}overflow-y-scroll min-h-screen bg-gray-100{% endblock %} + +{% block main_content %} +
+ {% include "./includes/alert.html" %} +
+ {% include './includes/detail_header.html' %} +
+
+
+ {% include "./includes/permission_table.html" %} + {% include "./includes/assign_role_users.html" %} +
+
+
+ + {% include './includes/modals/remove_user_modal.html' %} +
+
+{% endblock %} + +{% block script %} + {{block.super}} + {% include "./includes/role_detail_scripts.html" %} +{% endblock script %} diff --git a/src/tpstreams/roles/includes/alert.html b/src/tpstreams/roles/includes/alert.html new file mode 100644 index 000000000..799d369f5 --- /dev/null +++ b/src/tpstreams/roles/includes/alert.html @@ -0,0 +1,24 @@ +
+
+
+
+ +
+
+

+
+
+
+ +
+
+
+
+
diff --git a/src/tpstreams/roles/includes/assign_role_users.html b/src/tpstreams/roles/includes/assign_role_users.html new file mode 100644 index 000000000..284afceab --- /dev/null +++ b/src/tpstreams/roles/includes/assign_role_users.html @@ -0,0 +1,97 @@ + diff --git a/src/tpstreams/roles/includes/detail_header.html b/src/tpstreams/roles/includes/detail_header.html new file mode 100644 index 000000000..f077f83e9 --- /dev/null +++ b/src/tpstreams/roles/includes/detail_header.html @@ -0,0 +1,56 @@ +
+
+ +

+ + +

+
+
+ + + + {{ roles_list[0]["number_of_users"] }} Users +
+
+ + + + + {{ roles_list[0]["modified_by"] }} + modified on {{ roles_list[0]["modified"] }} + +
+
+
+
+ + + +
+ + +
+
+
diff --git a/src/tpstreams/roles/includes/modals/create_role_modal.html b/src/tpstreams/roles/includes/modals/create_role_modal.html new file mode 100644 index 000000000..b688dc422 --- /dev/null +++ b/src/tpstreams/roles/includes/modals/create_role_modal.html @@ -0,0 +1,32 @@ + diff --git a/src/tpstreams/roles/includes/modals/delete_role_modal.html b/src/tpstreams/roles/includes/modals/delete_role_modal.html new file mode 100644 index 000000000..bd2ba40a5 --- /dev/null +++ b/src/tpstreams/roles/includes/modals/delete_role_modal.html @@ -0,0 +1,52 @@ + diff --git a/src/tpstreams/roles/includes/modals/remove_user_modal.html b/src/tpstreams/roles/includes/modals/remove_user_modal.html new file mode 100644 index 000000000..a4a21659f --- /dev/null +++ b/src/tpstreams/roles/includes/modals/remove_user_modal.html @@ -0,0 +1,49 @@ + diff --git a/src/tpstreams/roles/includes/modals/rename_role_modal.html b/src/tpstreams/roles/includes/modals/rename_role_modal.html new file mode 100644 index 000000000..5765955ac --- /dev/null +++ b/src/tpstreams/roles/includes/modals/rename_role_modal.html @@ -0,0 +1,34 @@ + diff --git a/src/tpstreams/roles/includes/permission_table.html b/src/tpstreams/roles/includes/permission_table.html new file mode 100644 index 000000000..2d6117a43 --- /dev/null +++ b/src/tpstreams/roles/includes/permission_table.html @@ -0,0 +1,65 @@ +
+
+
+

+ Manage Role Permissions + + +

+

Specify permissions granted to users in this role, determining their access level.

+
+
+ +
+
+
+ + + + + + + + + + + + {% for category in permission_categories %} + + {% if category.sub_categories.length > 0 %} + + + + + {% for sub_category in category.sub_categories %} + + + {% set model_name = sub_category.model_name %} {% set valid_permissions = sub_category.permissions %}{% include "./toggles_row.html" %} + + {% endfor %} + {% else %} + + + {% set model_name = category.model_name %} {% set valid_permissions = category.permissions %}{% include "./toggles_row.html" %} + + {% endif %} + + {% endfor %} +
Resource NameCan ViewCan AddCan ChangeCan DeleteCan Download
+ +
{{ sub_category.display_name }}
{{ category.display_name }}
+
+
+
+
diff --git a/src/tpstreams/roles/includes/role_detail_scripts.html b/src/tpstreams/roles/includes/role_detail_scripts.html new file mode 100644 index 000000000..fc50ff19d --- /dev/null +++ b/src/tpstreams/roles/includes/role_detail_scripts.html @@ -0,0 +1,136 @@ + diff --git a/src/tpstreams/roles/includes/roles_list_empty.html b/src/tpstreams/roles/includes/roles_list_empty.html new file mode 100644 index 000000000..dc1cf0b72 --- /dev/null +++ b/src/tpstreams/roles/includes/roles_list_empty.html @@ -0,0 +1,14 @@ +
+
+ + + +
+ +

Welcome to Role Based Permissions

+

+ Using roles, you can efficiently manage permissions for multiple users in one go. + All users in a role automatically inherit the role's associated permissions. + It's worth noting that a user can belong to more than one role. +

+
diff --git a/src/tpstreams/roles/includes/roles_list_header.html b/src/tpstreams/roles/includes/roles_list_header.html new file mode 100644 index 000000000..695523b55 --- /dev/null +++ b/src/tpstreams/roles/includes/roles_list_header.html @@ -0,0 +1,8 @@ +
+
+

Roles

+
+
+ +
+
diff --git a/src/tpstreams/roles/includes/roles_list_inner.html b/src/tpstreams/roles/includes/roles_list_inner.html new file mode 100644 index 000000000..5aea5c534 --- /dev/null +++ b/src/tpstreams/roles/includes/roles_list_inner.html @@ -0,0 +1,38 @@ + diff --git a/src/tpstreams/roles/includes/roles_list_scripts.html b/src/tpstreams/roles/includes/roles_list_scripts.html new file mode 100644 index 000000000..2ec98fe8c --- /dev/null +++ b/src/tpstreams/roles/includes/roles_list_scripts.html @@ -0,0 +1,57 @@ + diff --git a/src/tpstreams/roles/includes/toggle.html b/src/tpstreams/roles/includes/toggle.html new file mode 100644 index 000000000..3040a7e87 --- /dev/null +++ b/src/tpstreams/roles/includes/toggle.html @@ -0,0 +1,8 @@ + diff --git a/src/tpstreams/roles/includes/toggles_row.html b/src/tpstreams/roles/includes/toggles_row.html new file mode 100644 index 000000000..2e73b612c --- /dev/null +++ b/src/tpstreams/roles/includes/toggles_row.html @@ -0,0 +1,5 @@ +{% set permission_name = "view_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} +{% set permission_name = "add_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} +{% set permission_name = "change_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} +{% set permission_name = "delete_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} +{% set permission_name = "download_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} diff --git a/src/tpstreams/roles/index.html b/src/tpstreams/roles/index.html new file mode 100644 index 000000000..a30a4033a --- /dev/null +++ b/src/tpstreams/roles/index.html @@ -0,0 +1,34 @@ +--- +slug: roles +tags: tpstreams +title: Roles +date: 2024-01-20 +--- + +{% extends "layouts/tpstreams/full_page_layout.html" %} + +{% block body_class %}overflow-y-scroll min-h-screen bg-gray-100{% endblock %} + +{% block main_content %} +
+ {% include './includes/roles_list_header.html' %} +
+
+ {% if roles_list.length > 0 %} + {% include './includes/roles_list_inner.html' %} + {% else %} + {% include './includes/roles_list_empty.html' %} + {% endif %} +
+
+ + {% include './includes/modals/delete_role_modal.html' %} + {% include './includes/modals/create_role_modal.html' %} + {% include './includes/modals/rename_role_modal.html' %} +
+{% endblock %} + +{% block script %} + {{block.super}} + {% include "./includes/roles_list_scripts.html" %} +{% endblock script %} diff --git a/src/tpstreams/roles/roles.json b/src/tpstreams/roles/roles.json new file mode 100644 index 000000000..d3d30dcc6 --- /dev/null +++ b/src/tpstreams/roles/roles.json @@ -0,0 +1,64 @@ +{ + "roles_list": [ + { + "id": 1, + "name": "Staff User", + "modified": "November 07, 2023", + "created": "November 07, 2023", + "number_of_users": "23", + "modified_by": "Hannah Mayer", + "permissions": [ + "add_asset", + "change_asset", + "delete_asset", + "view_asset", + "download_asset", + "add_livestream", + "change_livestream", + "delete_livestream", + "view_livestream" + ] + }, + { + "id": 2, + "name": "Video Uploaders", + "modified": "August 09, 2023", + "created": "August 09, 2023", + "number_of_users": "10", + "modified_by": "Hannah Mayer", + "permissions": [] + }, + { + "id": 3, + "name": "Live Stream Creators", + "modified": "June 10, 2023", + "created": "June 10, 2023", + "number_of_users": "6", + "modified_by": "Hannah Mayer", + "permissions": [] + } + ], + "permission_categories": [ + { + "display_name": "Videos", + "model_name": "Asset", + "permissions": [ + "view_asset", + "add_asset", + "change_asset", + "delete_asset", + "download_asset" + ] + }, + { + "display_name": "Live Stream", + "model_name": "LiveStream", + "permissions": [ + "view_livestream", + "add_livestream", + "change_livestream", + "delete_livestream" + ] + } + ] +} diff --git a/src/tpstreams/settings/includes/desktop_tabs.html b/src/tpstreams/settings/includes/desktop_tabs.html index eb1628370..7e66c5f1b 100644 --- a/src/tpstreams/settings/includes/desktop_tabs.html +++ b/src/tpstreams/settings/includes/desktop_tabs.html @@ -13,6 +13,8 @@ Player + Roles diff --git a/src/tpstreams/settings/includes/tablet_tabs.html b/src/tpstreams/settings/includes/tablet_tabs.html index 8c6524536..79a51df95 100644 --- a/src/tpstreams/settings/includes/tablet_tabs.html +++ b/src/tpstreams/settings/includes/tablet_tabs.html @@ -10,5 +10,7 @@ %}>Usages + \ No newline at end of file From ce28c6f2fe497c1a172979954b314c75d5a7aa4a Mon Sep 17 00:00:00 2001 From: Shantanu Tomar Date: Mon, 22 Jan 2024 13:58:52 +0530 Subject: [PATCH 2/8] fix header alignment --- src/_includes/layouts/tpstreams/full_page_layout.html | 4 ++-- src/tpstreams/roles/includes/roles_list_header.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_includes/layouts/tpstreams/full_page_layout.html b/src/_includes/layouts/tpstreams/full_page_layout.html index 852e49430..ae995bff6 100644 --- a/src/_includes/layouts/tpstreams/full_page_layout.html +++ b/src/_includes/layouts/tpstreams/full_page_layout.html @@ -17,9 +17,9 @@
-
+
-
+
{% block main_content %} {% endblock main_content %}
diff --git a/src/tpstreams/roles/includes/roles_list_header.html b/src/tpstreams/roles/includes/roles_list_header.html index 695523b55..756d54aab 100644 --- a/src/tpstreams/roles/includes/roles_list_header.html +++ b/src/tpstreams/roles/includes/roles_list_header.html @@ -1,4 +1,4 @@ -
+

Roles

From df6eb1b940a27a822c57f546949f3c9be2538183 Mon Sep 17 00:00:00 2001 From: Shantanu Tomar Date: Mon, 22 Jan 2024 14:25:52 +0530 Subject: [PATCH 3/8] fix alignment --- src/_includes/layouts/tpstreams/full_page_layout.html | 4 ++-- src/tpstreams/roles/detail.html | 2 +- src/tpstreams/roles/includes/detail_header.html | 2 +- src/tpstreams/roles/index.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/_includes/layouts/tpstreams/full_page_layout.html b/src/_includes/layouts/tpstreams/full_page_layout.html index ae995bff6..2a66ca88a 100644 --- a/src/_includes/layouts/tpstreams/full_page_layout.html +++ b/src/_includes/layouts/tpstreams/full_page_layout.html @@ -6,7 +6,7 @@ {% block content %}
diff --git a/src/tpstreams/roles/detail.html b/src/tpstreams/roles/detail.html index 2735bfd1f..7a569f834 100644 --- a/src/tpstreams/roles/detail.html +++ b/src/tpstreams/roles/detail.html @@ -1,7 +1,7 @@ --- title: Staff User - Roles permalink: "tpstreams/roles/staff-user/" -date: 2024-01-20 +date: 2024-12-10 --- {% extends "layouts/tpstreams/full_page_layout.html" %} diff --git a/src/tpstreams/roles/includes/modals/create_role_modal.html b/src/tpstreams/roles/includes/modals/create_role_modal.html index b688dc422..d9ad41f7c 100644 --- a/src/tpstreams/roles/includes/modals/create_role_modal.html +++ b/src/tpstreams/roles/includes/modals/create_role_modal.html @@ -14,7 +14,7 @@

Create a new role
- +

@@ -23,7 +23,7 @@

Create a new role - Submit + Submit

diff --git a/src/tpstreams/roles/includes/permission_table.html b/src/tpstreams/roles/includes/permission_table.html index 2d6117a43..857d459e2 100644 --- a/src/tpstreams/roles/includes/permission_table.html +++ b/src/tpstreams/roles/includes/permission_table.html @@ -20,18 +20,14 @@

- Resource Name - Can View - Can Add - Can Change - Can Delete - Can Download + Resource Name + Permissions {% for category in permission_categories %} {% if category.sub_categories.length > 0 %} - + + diff --git a/src/tpstreams/roles/includes/toggles_row.html b/src/tpstreams/roles/includes/toggles_row.html index 2e73b612c..4637a0bdd 100644 --- a/src/tpstreams/roles/includes/toggles_row.html +++ b/src/tpstreams/roles/includes/toggles_row.html @@ -1,5 +1,7 @@ -{% set permission_name = "view_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} -{% set permission_name = "add_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} -{% set permission_name = "change_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} -{% set permission_name = "delete_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} -{% set permission_name = "download_" + model_name|lower %} {% set is_disabled = permission_name not in valid_permissions|default([]) %} {% include "./toggle.html" %} + +
+ {% for permission_name in valid_permissions %} + {% include "./toggle.html" %} + {% endfor %} +
+ diff --git a/src/tpstreams/roles/index.html b/src/tpstreams/roles/index.html index 4b3919481..f6d535c5e 100644 --- a/src/tpstreams/roles/index.html +++ b/src/tpstreams/roles/index.html @@ -2,7 +2,7 @@ slug: roles tags: tpstreams title: Roles -date: 2024-01-20 +date: 2024-12-10 --- {% extends "layouts/tpstreams/full_page_layout.html" %} diff --git a/src/tpstreams/roles/roles.json b/src/tpstreams/roles/roles.json index d3d30dcc6..4d5c2c6ec 100644 --- a/src/tpstreams/roles/roles.json +++ b/src/tpstreams/roles/roles.json @@ -8,11 +8,10 @@ "number_of_users": "23", "modified_by": "Hannah Mayer", "permissions": [ - "add_asset", - "change_asset", - "delete_asset", - "view_asset", - "download_asset", + "add_video", + "change_video", + "delete_video", + "view_video", "add_livestream", "change_livestream", "delete_livestream", @@ -38,27 +37,51 @@ "permissions": [] } ], + "permission_categories": [ { - "display_name": "Videos", - "model_name": "Asset", - "permissions": [ - "view_asset", - "add_asset", - "change_asset", - "delete_asset", - "download_asset" - ] + "sub_categories": [ + { + "display_name": "Videos", + "permissions": [ + "view_video", + "add_video", + "change_video", + "delete_video", + "download_video" + ] + }, + { + "display_name": "Live Stream", + "permissions": [ + "view_livestream", + "add_livestream", + "change_livestream", + "delete_livestream" + ] + } + ], + "display_name": "Assets", + "permissions": [] }, { - "display_name": "Live Stream", - "model_name": "LiveStream", - "permissions": [ - "view_livestream", - "add_livestream", - "change_livestream", - "delete_livestream" - ] + "sub_categories": [ + { + "display_name": "Organization Settings", + "permissions": [ + "view_organization", + "change_organization" + ] + }, + { + "display_name": "Bandwidth Usage", + "permissions": [ + "view_bandwidthusage" + ] + } + ], + "display_name": "Settings", + "permissions": [] } ] } From 55b695693d32c888651ff139fe663af71b3f8bdc Mon Sep 17 00:00:00 2001 From: Shantanu Tomar Date: Tue, 10 Dec 2024 18:51:20 +0530 Subject: [PATCH 6/8] fic bg color --- src/tpstreams/roles/detail.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tpstreams/roles/detail.html b/src/tpstreams/roles/detail.html index 7a569f834..0327a7d58 100644 --- a/src/tpstreams/roles/detail.html +++ b/src/tpstreams/roles/detail.html @@ -6,6 +6,8 @@ {% extends "layouts/tpstreams/full_page_layout.html" %} +{% block html_class %}h-full bg-gray-100{% endblock html_class %} + {% block body_class %}overflow-y-scroll min-h-screen bg-gray-100{% endblock %} {% block main_content %} From f18a36bfbc007e180b7cf33f14f5ff416fccc289 Mon Sep 17 00:00:00 2001 From: Shantanu Tomar Date: Wed, 11 Dec 2024 15:10:27 +0530 Subject: [PATCH 7/8] remove ring from toggle --- src/tpstreams/roles/includes/toggle.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tpstreams/roles/includes/toggle.html b/src/tpstreams/roles/includes/toggle.html index 4f230b6a1..b6f4159e3 100644 --- a/src/tpstreams/roles/includes/toggle.html +++ b/src/tpstreams/roles/includes/toggle.html @@ -1,4 +1,4 @@ -