Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding condition to display sorting options #916

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bundle/Resources/public/js/scripts/admin.location.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
const token = doc.querySelector('meta[name="CSRF-Token"]').content;
const siteaccess = doc.querySelector('meta[name="SiteAccess"]').content;
const sortContainer = doc.querySelector('[data-sort-field][data-sort-order]');
const sortField = sortContainer.getAttribute('data-sort-field');
const sortOrder = sortContainer.getAttribute('data-sort-order');
const handleEditItem = (content, location) => {
const contentId = content._id;
const locationId = location._id;
Expand Down Expand Up @@ -124,6 +122,8 @@
};

listContainers.forEach((container) => {
const sortField = sortContainer.getAttribute('data-sort-field');
const sortOrder = sortContainer.getAttribute('data-sort-order');
const subitemsRoot = ReactDOM.createRoot(container);
const parentLocationId = parseInt(container.dataset.location, 10);
const activeView = getLocationActiveView(parentLocationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,25 @@
body_rows,
} %}

{% include '@ibexadesign/ui/component/table/table_header.html.twig' with {
headline: 'tab.details.sub_items_sorting_order'|trans|desc('Sub-item sorting order'),
} only %}

<div class="bg-white ml-4" data-sort-field="{{ sort_field_clause_map[location.sortField] }}" data-sort-order="{{ location.sortOrder ? 'ascending' : 'descending' }}">
{{ form_start(form_location_update, {
'method': 'POST',
'action': path('ibexa.location.update'),
'attr': {'class': 'form-inline ibexa-form-inline justify-content-start'}
}) }}

{{ form_label(form_location_update.sort_field, 'tab.details.sub_items_listing_by.order_by'|trans|desc('Order by')) }}
{{ form_widget(form_location_update.sort_field, { 'attr': {'class': 'ibexa-form-autosubmit ml-2'} }) }}

{{ form_label(form_location_update.sort_order, 'tab.details.sub_items_listing_by.in'|trans|desc('in')) }}
{{ form_widget(form_location_update.sort_order, { 'attr': {'class': 'ibexa-form-autosubmit ml-2'} }) }}

{% do form_location_update.update.setRendered() %}
{{ form_end(form_location_update) }}
</div>
{% if show_sorting ?? true %}
{% include '@ibexadesign/ui/component/table/table_header.html.twig' with {
headline: 'tab.details.sub_items_sorting_order'|trans|desc('Sub-item sorting order'),
} only %}

<div class="bg-white ml-4" data-sort-field="{{ sort_field_clause_map[location.sortField] }}" data-sort-order="{{ location.sortOrder ? 'ascending' : 'descending' }}">
{{ form_start(form_location_update, {
'method': 'POST',
'action': path('ibexa.location.update'),
'attr': {'class': 'form-inline ibexa-form-inline justify-content-start'}
}) }}

{{ form_label(form_location_update.sort_field, 'tab.details.sub_items_listing_by.order_by'|trans|desc('Order by')) }}
{{ form_widget(form_location_update.sort_field, { 'attr': {'class': 'ibexa-form-autosubmit ml-2'} }) }}

{{ form_label(form_location_update.sort_order, 'tab.details.sub_items_listing_by.in'|trans|desc('in')) }}
{{ form_widget(form_location_update.sort_order, { 'attr': {'class': 'ibexa-form-autosubmit ml-2'} }) }}

{% do form_location_update.update.setRendered() %}
{{ form_end(form_location_update) }}
</div>
{% endif %}
Loading