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

Small improvements for Webservice list #10311

Merged
78 changes: 0 additions & 78 deletions admin-dev/themes/new-theme/js/app/utils/column-toggling.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/

import ColumnToggling from '../../../app/utils/column-toggling';
const $ = global.$;

/**
* Class ReloadListExtension extends grid with "Column toggling" feature
Expand All @@ -37,7 +37,34 @@ export default class ColumnTogglingExtension {
*/
extend(grid) {
const $table = grid.getContainer().find('table.table');
$table.find('.ps-togglable-row').on('click', (e) => {
e.preventDefault();
this._toggleValue($(e.delegateTarget));
});
}

/**
* @param {jQuery} row
* @private
*/
_toggleValue(row) {
const toggleUrl = row.data('toggleUrl');

this._submitAsForm(toggleUrl);
}

/**
* Submits request url as form
*
* @param {string} toggleUrl
* @private
*/
_submitAsForm(toggleUrl) {
const $form = $('<form>', {
action: toggleUrl,
method: 'POST',
}).appendTo('body');

new ColumnToggling($table).attach();
$form.submit();
}
}
2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/js/pages/webservice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import ColumnTogglingExtension from "../../components/grid/extension/column-togg
const $ = window.$;

$(() => {
const webserviceGrid = new Grid('webservice');
const webserviceGrid = new Grid('webservice_key');

webserviceGrid.addExtension(new ReloadListActionExtension());
webserviceGrid.addExtension(new ExportToSqlManagerExtension());
Expand Down
Loading