-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reverting onUpdatView event / added blocks to index view template
- Loading branch information
Showing
3 changed files
with
36 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
{% set sources = sources ?? craft.app.elementIndexes.getSources(elementType, 'index') %} | ||
{% set customizableSources = customizableSources ?? false %} | ||
{% set addButton = addButton is defined ? addButton : '<div class="btn add icon"></div>' %} | ||
{% if element.id %} | ||
<div id="{{ container }}"> | ||
<div class="elementindex"> | ||
{% include 'nested-element-index/_elements/indexcontainer' with { | ||
elementType: elementType, | ||
sources: sources, | ||
customizableSources: customizableSources, | ||
addButton: addButton, | ||
sortOptions: sortOptions ?? null | ||
} only %} | ||
{% block container %} | ||
{% if element.id %} | ||
<div id="{{ container }}"> | ||
<div class="elementindex"> | ||
{% include 'nested-element-index/_elements/indexcontainer' with { | ||
elementType: elementType, | ||
sources: sources, | ||
customizableSources: customizableSources, | ||
addButton: addButton, | ||
sortOptions: sortOptions ?? null | ||
} only %} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% else %} | ||
<p><i>{{ "Please save element before making any associations."|t('element-list') }}</i></p> | ||
{% endif %} | ||
{% else %} | ||
<p><i>{{ "Please save element before making any associations."|t('element-list') }}</i></p> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% set inputVar = ('input-'~container)|namespaceInputId|replace({'-': '_'}) %} | ||
{% set indexVar = ('index-'~container)|namespaceInputId|replace({'-': '_'}) %} | ||
{% js %} | ||
var {{ inputVar }} = new {{ inputJsClass }}($('#{{ container|namespaceInputId }}'), {{ inputJs|json_encode|raw }}); | ||
{% block js %} | ||
{% set inputVar = ('input-'~container)|namespaceInputId|replace({'-': '_'}) %} | ||
{% set indexVar = ('index-'~container)|namespaceInputId|replace({'-': '_'}) %} | ||
{% js %} | ||
var {{ inputVar }} = new {{ inputJsClass }}($('#{{ container|namespaceInputId }}'), {{ inputJs|json_encode|raw }}); | ||
|
||
var {{ indexVar }} = new {{ indexJsClass }}( | ||
'{{ elementType|e("js") }}', | ||
$('#{{ container|namespaceInputId }}'), | ||
{{ indexJs|json_encode|raw }} | ||
); | ||
var {{ indexVar }} = new {{ indexJsClass }}( | ||
'{{ elementType|e("js") }}', | ||
$('#{{ container|namespaceInputId }}'), | ||
{{ indexJs|json_encode|raw }} | ||
); | ||
|
||
{{ indexVar }}.on('afterAction', function(data) { | ||
{{ inputVar }}.removeElements(data.params.elementIds); | ||
}); | ||
{{ indexVar }}.on('afterAction', function(data) { | ||
{{ inputVar }}.removeElements(data.params.elementIds); | ||
}); | ||
|
||
{{ inputVar }}.on('selectElements', function(data) { | ||
{{ indexVar }}.updateElements(); | ||
}); | ||
{% endjs %} | ||
{{ inputVar }}.on('selectElements', function(data) { | ||
{{ indexVar }}.updateElements(); | ||
}); | ||
{% endjs %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.