Skip to content

Commit

Permalink
More user tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Jul 18, 2024
1 parent 382d5b8 commit 7c3a708
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/models/ExportableCategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/models/ExportableElementTypeModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ abstract public function getGroup(): bool|array;
* @return bool|array
*/
abstract public function getSubGroup(): bool|array;

}
1 change: 1 addition & 0 deletions src/models/ExportableEntryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/models/ExportableUserModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/templates/_index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
14 changes: 10 additions & 4 deletions src/templates/sprig/element/step_1.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@
<div class="field width-50" id="elementType-entry-subfields">
<div class="heading">
<label id="section-label" for="section">{{ subGroupSettings.label|t('exporter') }}<span
class="visually-hidden">{{ 'Required'|t('exporter') }}</span><span class="required"
aria-hidden="true"></span></label>
class="visually-hidden">{{ 'Required'|t('exporter') }}</span><span
class="required"
aria-hidden="true"></span></label>
</div>
{% if subGroupSettings.instructions is defined %}
<div id="section-instructions" class="instructions">
Expand All @@ -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 %}

<div class="field">
Expand Down

0 comments on commit 7c3a708

Please sign in to comment.