From 9a1b8eb7c86a096edbf584eb4910a4a5ad3d5519 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 16 May 2020 21:43:48 +0200 Subject: [PATCH] admin: add empty views to all lists, move invitation to stage-invitations --- .../administration/application/list.html | 13 ++++++++ .../admin/templates/administration/base.html | 12 ++++---- .../certificatekeypair/list.html | 13 ++++++++ .../templates/administration/flow/list.html | 14 +++++++++ .../administration/flowstagebinding/list.html | 13 ++++++++ .../templates/administration/group/list.html | 13 ++++++++ .../templates/administration/policy/list.html | 26 ++++++++++++++++ .../administration/policybinding/list.html | 13 ++++++++ .../administration/property_mapping/list.html | 26 ++++++++++++++++ .../administration/provider/list.html | 25 ++++++++++++++++ .../templates/administration/source/list.html | 25 ++++++++++++++++ .../templates/administration/stage/list.html | 28 ++++++++++++++++- .../list.html | 19 ++++++++++-- .../administration/stage_prompt/list.html | 15 +++++++++- .../templates/administration/user/list.html | 13 ++++++++ passbook/admin/urls.py | 30 +++++++++++-------- .../{invitations.py => stages_invitations.py} | 2 +- passbook/static/static/passbook/pf.js | 7 +++++ 18 files changed, 282 insertions(+), 25 deletions(-) rename passbook/admin/templates/administration/{invitation => stage_invitation}/list.html (68%) rename passbook/admin/views/{invitations.py => stages_invitations.py} (97%) diff --git a/passbook/admin/templates/administration/application/list.html b/passbook/admin/templates/administration/application/list.html index e54ea0190..1e44f4e58 100644 --- a/passbook/admin/templates/administration/application/list.html +++ b/passbook/admin/templates/administration/application/list.html @@ -15,6 +15,7 @@
+ {% if object_list %}
{% trans 'Create' %} @@ -62,6 +63,18 @@
{% include 'partials/pagination.html' %}
+ {% else %} +
+ +

+ {% trans 'No Applications.' %} +

+
+ {% trans 'Currently no applications exist. Click the button below to create one.' %} +
+ {% trans 'Create' %} +
+ {% endif %}
{% endblock %} diff --git a/passbook/admin/templates/administration/base.html b/passbook/admin/templates/administration/base.html index c180c6f96..823f39c0b 100644 --- a/passbook/admin/templates/administration/base.html +++ b/passbook/admin/templates/administration/base.html @@ -78,6 +78,12 @@ {% trans 'Stage Prompts' %} +
  • + + {% trans 'Invitations' %} + +
  • @@ -116,12 +122,6 @@ {% trans 'Certificates' %}
  • -
  • - - {% trans 'Invitations' %} - -
  • diff --git a/passbook/admin/templates/administration/certificatekeypair/list.html b/passbook/admin/templates/administration/certificatekeypair/list.html index 4a98f94f3..265547ca3 100644 --- a/passbook/admin/templates/administration/certificatekeypair/list.html +++ b/passbook/admin/templates/administration/certificatekeypair/list.html @@ -15,6 +15,7 @@
    + {% if object_list %}
    {% trans 'Create' %} @@ -64,6 +65,18 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Certificates.' %} +

    +
    + {% trans 'Currently no certificates exist. Click the button below to create one.' %} +
    + {% trans 'Create' %} +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/flow/list.html b/passbook/admin/templates/administration/flow/list.html index 6e98fc61d..9ee4e95c4 100644 --- a/passbook/admin/templates/administration/flow/list.html +++ b/passbook/admin/templates/administration/flow/list.html @@ -15,6 +15,7 @@
    + {% if object_list %}
    {% trans 'Create' %} @@ -66,6 +67,19 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Flows.' %} +

    +
    + {% trans 'Currently no flows exist. Click the button below to create one.' %} +
    + {% trans 'Create' %} +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/flowstagebinding/list.html b/passbook/admin/templates/administration/flowstagebinding/list.html index b2c2795db..68defbd75 100644 --- a/passbook/admin/templates/administration/flowstagebinding/list.html +++ b/passbook/admin/templates/administration/flowstagebinding/list.html @@ -15,6 +15,7 @@
    {% endblock %} diff --git a/passbook/admin/templates/administration/group/list.html b/passbook/admin/templates/administration/group/list.html index 7bea90876..77a80773a 100644 --- a/passbook/admin/templates/administration/group/list.html +++ b/passbook/admin/templates/administration/group/list.html @@ -16,6 +16,7 @@
    {% endblock %} diff --git a/passbook/admin/templates/administration/policy/list.html b/passbook/admin/templates/administration/policy/list.html index 2061e38e9..3c782f597 100644 --- a/passbook/admin/templates/administration/policy/list.html +++ b/passbook/admin/templates/administration/policy/list.html @@ -15,6 +15,7 @@
    + {% if object_list %}
    @@ -73,6 +74,31 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Policies.' %} +

    +
    + {% trans 'Currently no policies exist. Click the button below to create one.' %} +
    +
    + + +
    +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/policybinding/list.html b/passbook/admin/templates/administration/policybinding/list.html index b3b9fe8cb..98e3a571a 100644 --- a/passbook/admin/templates/administration/policybinding/list.html +++ b/passbook/admin/templates/administration/policybinding/list.html @@ -15,6 +15,7 @@
    {% endblock %} diff --git a/passbook/admin/templates/administration/property_mapping/list.html b/passbook/admin/templates/administration/property_mapping/list.html index f44c7fe86..5d117af39 100644 --- a/passbook/admin/templates/administration/property_mapping/list.html +++ b/passbook/admin/templates/administration/property_mapping/list.html @@ -16,6 +16,7 @@
    + {% if object_list %}
    @@ -67,6 +68,31 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Property Mappings.' %} +

    +
    + {% trans 'Currently no property mappings exist. Click the button below to create one.' %} +
    +
    + + +
    +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/provider/list.html b/passbook/admin/templates/administration/provider/list.html index 7ece34092..0a7fe65fc 100644 --- a/passbook/admin/templates/administration/provider/list.html +++ b/passbook/admin/templates/administration/provider/list.html @@ -17,6 +17,7 @@
    + {% if object_list %}
    @@ -86,6 +87,30 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Providers.' %} +

    +
    + {% trans 'Currently no providers exist. Click the button below to create one.' %} +
    +
    + + +
    +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/source/list.html b/passbook/admin/templates/administration/source/list.html index b0182e796..b50ddab40 100644 --- a/passbook/admin/templates/administration/source/list.html +++ b/passbook/admin/templates/administration/source/list.html @@ -17,6 +17,7 @@
    + {% if object_list %}
    @@ -80,6 +81,30 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Sources.' %} +

    +
    + {% trans 'Currently no sources exist. Click the button below to create one.' %} +
    +
    + + +
    +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/stage/list.html b/passbook/admin/templates/administration/stage/list.html index 1f242e532..2622c8b66 100644 --- a/passbook/admin/templates/administration/stage/list.html +++ b/passbook/admin/templates/administration/stage/list.html @@ -11,12 +11,13 @@ {% trans 'Stages' %} -

    {% trans "Stages required for a user to successfully authenticate." %} +

    {% trans "Stages are single steps of a Flow that a user is guided through." %}

    + {% if object_list %}
    @@ -74,6 +75,31 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Stages.' %} +

    +
    + {% trans 'Currently no stages exist. Click the button below to create one.' %} +
    +
    + + +
    +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/invitation/list.html b/passbook/admin/templates/administration/stage_invitation/list.html similarity index 68% rename from passbook/admin/templates/administration/invitation/list.html rename to passbook/admin/templates/administration/stage_invitation/list.html index 0c5aabbae..779e1344d 100644 --- a/passbook/admin/templates/administration/invitation/list.html +++ b/passbook/admin/templates/administration/stage_invitation/list.html @@ -10,15 +10,16 @@ {% trans 'Invitations' %} -

    {% trans "Create Invitation Links to enroll Users, and optionally force a username or expire on a set date." %} +

    {% trans "Create Invitation Links to enroll Users, and optionally force specific attributes of their account." %}

    + {% if object_list %}
    {% include 'partials/pagination.html' %} @@ -45,7 +46,7 @@ - {% trans 'Delete' %} + {% trans 'Delete' %} {% endfor %} @@ -54,6 +55,18 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Invitations.' %} +

    +
    + {% trans 'Currently no invitations exist. Click the button below to create one.' %} +
    + {% trans 'Create' %} +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/stage_prompt/list.html b/passbook/admin/templates/administration/stage_prompt/list.html index 619bbfc0a..117f221c2 100644 --- a/passbook/admin/templates/administration/stage_prompt/list.html +++ b/passbook/admin/templates/administration/stage_prompt/list.html @@ -11,11 +11,12 @@ {% trans 'Prompts' %} -

    {% trans "Prompts that can be used for Prompt Stages." %}

    +

    {% trans "Single Prompts that can be used for Prompt Stages." %}

    + {% if object_list %}
    {% trans 'Create' %} @@ -61,6 +62,18 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Stage Prompts.' %} +

    +
    + {% trans 'Currently no stage prompts exist. Click the button below to create one.' %} +
    + {% trans 'Create' %} +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/templates/administration/user/list.html b/passbook/admin/templates/administration/user/list.html index 54e66defe..8293b769f 100644 --- a/passbook/admin/templates/administration/user/list.html +++ b/passbook/admin/templates/administration/user/list.html @@ -14,6 +14,7 @@
    + {% if object_list %}
    {% trans 'Create' %} @@ -61,6 +62,18 @@
    {% include 'partials/pagination.html' %}
    + {% else %} +
    + +

    + {% trans 'No Users.' %} +

    +
    + {% trans 'Currently no users exist. How did you even get here.' %} +
    + {% trans 'Create' %} +
    + {% endif %}
    {% endblock %} diff --git a/passbook/admin/urls.py b/passbook/admin/urls.py index bc151c3b3..cd4ca008d 100644 --- a/passbook/admin/urls.py +++ b/passbook/admin/urls.py @@ -8,7 +8,6 @@ from passbook.admin.views import ( debug, flows, groups, - invitations, overview, policies, policies_bindings, @@ -17,6 +16,7 @@ from passbook.admin.views import ( sources, stages, stages_bindings, + stages_invitations, stages_prompts, users, ) @@ -166,6 +166,22 @@ urlpatterns = [ stages_prompts.PromptDeleteView.as_view(), name="stage-prompt-delete", ), + # Invitations + path( + "stages/invitations/", + stages_invitations.InvitationListView.as_view(), + name="stage-invitations", + ), + path( + "stages/invitations/create/", + stages_invitations.InvitationCreateView.as_view(), + name="stage-invitation-create", + ), + path( + "stages/invitations//delete/", + stages_invitations.InvitationDeleteView.as_view(), + name="stage-invitation-delete", + ), # Flows path("flows/", flows.FlowListView.as_view(), name="flows"), path("flows/create/", flows.FlowCreateView.as_view(), name="flow-create",), @@ -196,18 +212,6 @@ urlpatterns = [ property_mapping.PropertyMappingDeleteView.as_view(), name="property-mapping-delete", ), - # Invitations - path("invitations/", invitations.InvitationListView.as_view(), name="invitations"), - path( - "invitations/create/", - invitations.InvitationCreateView.as_view(), - name="invitation-create", - ), - path( - "invitations//delete/", - invitations.InvitationDeleteView.as_view(), - name="invitation-delete", - ), # Users path("users/", users.UserListView.as_view(), name="users"), path("users/create/", users.UserCreateView.as_view(), name="user-create"), diff --git a/passbook/admin/views/invitations.py b/passbook/admin/views/stages_invitations.py similarity index 97% rename from passbook/admin/views/invitations.py rename to passbook/admin/views/stages_invitations.py index dd00bee83..96b373517 100644 --- a/passbook/admin/views/invitations.py +++ b/passbook/admin/views/stages_invitations.py @@ -22,7 +22,7 @@ class InvitationListView(LoginRequiredMixin, PermissionListMixin, ListView): model = Invitation permission_required = "passbook_stages_invitation.view_invitation" - template_name = "administration/invitation/list.html" + template_name = "administration/stage_invitation/list.html" paginate_by = 10 ordering = "-expires" diff --git a/passbook/static/static/passbook/pf.js b/passbook/static/static/passbook/pf.js index 31880461e..e82b27f35 100644 --- a/passbook/static/static/passbook/pf.js +++ b/passbook/static/static/passbook/pf.js @@ -66,3 +66,10 @@ document.querySelector(".pf-c-page__header-brand-toggle>button").addEventListene sidebar.style.zIndex = 200; } }); + +// Collapsable Menus in Sidebar +document.querySelectorAll(".pf-m-expandable").forEach((menu) => { + menu.addEventListener("click", (e) => { + menu.classList.toggle("pf-m-expanded"); + }); +});