From e65dc8ce14b848674961e7a6ce8dad6b71f5e98b Mon Sep 17 00:00:00 2001 From: Oleksandr Cherniavskyi Date: Tue, 29 Aug 2023 12:48:40 +0300 Subject: [PATCH] feature: add dashboard_organization fix --- README.md | 3 ++ ckanext/core_fix/config.py | 2 ++ .../user/dashboard_organization.html | 28 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 ckanext/core_fix/template_fix/dashboard_organization/user/dashboard_organization.html diff --git a/README.md b/README.md index 466ec4c..a2757f0 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ Use a fix name from the parentheses to disable it via `ckanext.core_fix.disable_ Add csrf token to a dataset group list form Already in master +8. Fix dashboard organization tab org labels and link (`dashboard_organization`) + Already in master + ## Config settings # Provide a list of fixes names to disable it diff --git a/ckanext/core_fix/config.py b/ckanext/core_fix/config.py index ac4c314..0d7f5c4 100644 --- a/ckanext/core_fix/config.py +++ b/ckanext/core_fix/config.py @@ -21,6 +21,7 @@ class Fixes(Enum): mobile_layout_breakpoint = auto() restyle_activity = auto() group_list_csrf = auto() + dashboard_organization = auto() FIXES_WITH_TEMPLATES = [ @@ -28,6 +29,7 @@ class Fixes(Enum): Fixes.markdown_macro, Fixes.restyle_activity, Fixes.group_list_csrf, + Fixes.dashboard_organization, ] FIXES_WITH_CSS = [ diff --git a/ckanext/core_fix/template_fix/dashboard_organization/user/dashboard_organization.html b/ckanext/core_fix/template_fix/dashboard_organization/user/dashboard_organization.html new file mode 100644 index 0000000..0102d09 --- /dev/null +++ b/ckanext/core_fix/template_fix/dashboard_organization/user/dashboard_organization.html @@ -0,0 +1,28 @@ +{% extends "user/dashboard.html" %} + +{% set org_type = h.default_group_type('organization') %} + +{% block page_primary_action %} + {% if h.check_access('organization_create') %} + {% link_for h.humanize_entity_type('organization', org_type, 'add link') or _('Add Organization'), named_route=org_type ~ '.new', class_="btn btn-primary", icon="plus-square" %} + {% endif %} +{% endblock %} + +{% block primary_content_inner %} +

{{ h.humanize_entity_type('organization', org_type, 'my label') or _('My Organizations') }}

+ {% set organizations = h.organizations_available(permission='manage_group', + include_dataset_count=True, + include_member_count=True) %} + {% if organizations %} +
+ {% snippet "organization/snippets/organization_list.html", organizations=organizations, show_capacity=True %} +
+ {% else %} +

+ {{ h.humanize_entity_type('organization', org_type, 'you not member') or _('You are not a member of any organizations.') }} + {% if h.check_access('organization_create') %} + {% link_for _('Create one now?'), named_route=org_type ~ '.new' %} + {% endif %} +

+ {% endif %} +{% endblock %}