From 7c3a708a60b753612fc5f0b0a333ace69132bbdb Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Thu, 18 Jul 2024 19:53:54 +0200 Subject: [PATCH] More user tweaks --- src/models/ExportableCategoryModel.php | 2 ++ src/models/ExportableElementTypeModel.php | 1 + src/models/ExportableEntryModel.php | 1 + src/models/ExportableUserModel.php | 2 ++ src/templates/_index.twig | 18 +++++++++--------- src/templates/sprig/element/step_1.twig | 14 ++++++++++---- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/models/ExportableCategoryModel.php b/src/models/ExportableCategoryModel.php index f6aac7e..5e0e1c0 100644 --- a/src/models/ExportableCategoryModel.php +++ b/src/models/ExportableCategoryModel.php @@ -18,6 +18,8 @@ class ExportableCategoryModel extends ExportableElementTypeModel */ public string $elementLabel = "Categories"; + public bool $shouldBeLocalised = true; + /** * This function defines the element's attributes you want to make exportable * @return array diff --git a/src/models/ExportableElementTypeModel.php b/src/models/ExportableElementTypeModel.php index 9d8e95f..99ee446 100644 --- a/src/models/ExportableElementTypeModel.php +++ b/src/models/ExportableElementTypeModel.php @@ -35,4 +35,5 @@ abstract public function getGroup(): bool|array; * @return bool|array */ abstract public function getSubGroup(): bool|array; + } diff --git a/src/models/ExportableEntryModel.php b/src/models/ExportableEntryModel.php index df6affd..7e09d16 100644 --- a/src/models/ExportableEntryModel.php +++ b/src/models/ExportableEntryModel.php @@ -19,6 +19,7 @@ class ExportableEntryModel extends ExportableElementTypeModel */ public string $elementLabel = "Entries"; + public bool $shouldBeLocalised = true; /** * This function defines the element's attributes you want to make exportable diff --git a/src/models/ExportableUserModel.php b/src/models/ExportableUserModel.php index 26c906c..8f424ac 100644 --- a/src/models/ExportableUserModel.php +++ b/src/models/ExportableUserModel.php @@ -20,6 +20,8 @@ class ExportableUserModel extends ExportableElementTypeModel */ public string $elementLabel = "Users"; + public bool $shouldBeLocalised = false; + /** * This function defines the element's attributes you want to make exportable diff --git a/src/templates/_index.twig b/src/templates/_index.twig index 51801bd..1f67525 100644 --- a/src/templates/_index.twig +++ b/src/templates/_index.twig @@ -34,15 +34,15 @@ {% js %} new Craft.VueAdminTable({ - search: true, - container: '#exporter-vue-admin-table', - columns: {{ columns|json_encode|raw }}, - tableData: {{ tableData|json_encode|raw }}, - deleteAction: {{ currentUser.can('exporter-deleteExports') ? '\'exporter/element/delete\'' : 0 }}, - emptyMessage: 'No exports available', - checkboxes: false, - allowMultipleSelections: false, - search: true, + container: '#exporter-vue-admin-table', + columns: {{ columns|json_encode|raw }}, + tableData: {{ tableData|json_encode|raw }}, + deleteAction: {{ currentUser.can('exporter-deleteExports') ? '\'exporter/element/delete\'' : 0 }}, + emptyMessage: 'No exports available', + checkboxes: false, + allowMultipleSelections: false, + search: true, + searchPlaceholder: 'Search exporter by name' }); {% endjs %} diff --git a/src/templates/sprig/element/step_1.twig b/src/templates/sprig/element/step_1.twig index d33be1c..21d0902 100644 --- a/src/templates/sprig/element/step_1.twig +++ b/src/templates/sprig/element/step_1.twig @@ -100,8 +100,9 @@
+ class="visually-hidden">{{ 'Required'|t('exporter') }}
{% if subGroupSettings.instructions is defined %}
@@ -127,10 +128,15 @@ {% endif %} {% endif %} - + {% set isReady = false %} {% if settings is defined and settings.group is defined and settings.subGroup is defined %} - {% set showSiteOptions = true %} + {% set isReady = true %} {% endif %} + + {% if isReady %} + {% set showSiteOptions = not elementOptions.shouldBeLocalised ? elementOptions.shouldBeLocalised : true %} + {% endif %} + {% if showSiteOptions %}