Skip to content

Commit

Permalink
Simplify grid javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox committed Sep 14, 2024
1 parent 717b2ab commit be2ad9d
Show file tree
Hide file tree
Showing 48 changed files with 554 additions and 1,070 deletions.
27 changes: 9 additions & 18 deletions admin-dev/themes/new-theme/js/pages/address/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,21 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import Grid from '@components/grid/grid';
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
import SortingExtension from '@components/grid/extension/sorting-extension';
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
import ReloadListExtension from '@components/grid/extension/reload-list-extension';
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension';
import ChoiceTable from '@components/choice-table';

const {$} = window;

$(() => {
const addressGrid = new Grid('address');
const addressGrid = new window.prestashop.component.Grid('address');

addressGrid.addExtension(new FiltersResetExtension());
addressGrid.addExtension(new SortingExtension());
addressGrid.addExtension(new ExportToSqlManagerExtension());
addressGrid.addExtension(new ReloadListExtension());
addressGrid.addExtension(new BulkActionCheckboxExtension());
addressGrid.addExtension(new SubmitBulkExtension());
addressGrid.addExtension(new SubmitRowActionExtension());
addressGrid.addExtension(new LinkRowActionExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.ReloadListExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
addressGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());

// needed for address required fields form
new ChoiceTable();
Expand Down
24 changes: 8 additions & 16 deletions admin-dev/themes/new-theme/js/pages/api-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,17 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import Grid from '@components/grid/grid';
import SortingExtension from '@components/grid/extension/sorting-extension';
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
import ReloadListActionExtension from '@components/grid/extension/reload-list-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
import FiltersSubmitButtonEnablerExtension from '@components/grid/extension/filters-submit-button-enabler-extension';
import AsyncToggleColumnExtension from '@components/grid/extension/column/common/async-toggle-column-extension';

Check failure on line 26 in admin-dev/themes/new-theme/js/pages/api-client/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

More than 1 blank line not allowed
const {$} = window;

$(() => {
const grid = new Grid('api_client');
const grid = new window.prestashop.component.Grid('api_client');

grid.addExtension(new ExportToSqlManagerExtension());
grid.addExtension(new ReloadListActionExtension());
grid.addExtension(new SortingExtension());
grid.addExtension(new FiltersResetExtension());
grid.addExtension(new SubmitRowActionExtension());
grid.addExtension(new FiltersSubmitButtonEnablerExtension());
grid.addExtension(new AsyncToggleColumnExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.ReloadListActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.AsyncToggleColumnExtension());
});
27 changes: 9 additions & 18 deletions admin-dev/themes/new-theme/js/pages/attachment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,21 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import Grid from '@components/grid/grid';
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
import SortingExtension from '@components/grid/extension/sorting-extension';
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
import ReloadListExtension from '@components/grid/extension/reload-list-extension';
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension';
import TranslatableInput from '@components/translatable-input';

const {$} = window;

$(() => {
const attachmentGrid = new Grid('attachment');
const attachmentGrid = new window.prestashop.component.Grid('attachment');

attachmentGrid.addExtension(new FiltersResetExtension());
attachmentGrid.addExtension(new SortingExtension());
attachmentGrid.addExtension(new ExportToSqlManagerExtension());
attachmentGrid.addExtension(new ReloadListExtension());
attachmentGrid.addExtension(new BulkActionCheckboxExtension());
attachmentGrid.addExtension(new SubmitBulkExtension());
attachmentGrid.addExtension(new SubmitRowActionExtension());
attachmentGrid.addExtension(new LinkRowActionExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.ReloadListExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());

new TranslatableInput();
});
33 changes: 11 additions & 22 deletions admin-dev/themes/new-theme/js/pages/attribute-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,24 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import Grid from '@components/grid/grid';
import SortingExtension from '@components/grid/extension/sorting-extension';
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
import ReloadListActionExtension from '@components/grid/extension/reload-list-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
import FiltersSubmitButtonEnablerExtension from '@components/grid/extension/filters-submit-button-enabler-extension';
import ShowcaseCard from '@components/showcase-card/showcase-card';
import ShowcaseCardCloseExtension from '@components/showcase-card/extension/showcase-card-close-extension';
import PositionExtension from '@components/grid/extension/position-extension';
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension';

const {$} = window;

$(() => {
const grid = new Grid('attribute_group');
const grid = new window.prestashop.component.Grid('attribute_group');

grid.addExtension(new ExportToSqlManagerExtension());
grid.addExtension(new ReloadListActionExtension());
grid.addExtension(new SortingExtension());
grid.addExtension(new FiltersResetExtension());
grid.addExtension(new SubmitRowActionExtension());
grid.addExtension(new SubmitBulkExtension());
grid.addExtension(new BulkActionCheckboxExtension());
grid.addExtension(new FiltersSubmitButtonEnablerExtension());
grid.addExtension(new PositionExtension(grid));
grid.addExtension(new LinkRowActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.ReloadListActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.PositionExtension(grid));
grid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());

const showcaseCard = new ShowcaseCard('attributesShowcaseCard');
showcaseCard.addExtension(new ShowcaseCardCloseExtension());
Expand Down
33 changes: 11 additions & 22 deletions admin-dev/themes/new-theme/js/pages/attribute/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,20 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import Grid from '@components/grid/grid';
import SortingExtension from '@components/grid/extension/sorting-extension';
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
import ReloadListActionExtension from '@components/grid/extension/reload-list-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
import FiltersSubmitButtonEnablerExtension from '@components/grid/extension/filters-submit-button-enabler-extension';
import PositionExtension from '@components/grid/extension/position-extension';
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension';

Check failure on line 26 in admin-dev/themes/new-theme/js/pages/attribute/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

More than 1 blank line not allowed
const {$} = window;

$(() => {
const grid = new Grid('attribute');
const grid = new window.prestashop.component.Grid('attribute');

grid.addExtension(new ExportToSqlManagerExtension());
grid.addExtension(new ReloadListActionExtension());
grid.addExtension(new SortingExtension());
grid.addExtension(new FiltersResetExtension());
grid.addExtension(new SubmitRowActionExtension());
grid.addExtension(new SubmitBulkExtension());
grid.addExtension(new BulkActionCheckboxExtension());
grid.addExtension(new FiltersSubmitButtonEnablerExtension());
grid.addExtension(new PositionExtension(grid));
grid.addExtension(new LinkRowActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.ReloadListActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension());
grid.addExtension(new window.prestashop.component.GridExtensions.PositionExtension(grid));
grid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());
});
19 changes: 6 additions & 13 deletions admin-dev/themes/new-theme/js/pages/backup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,15 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import Grid from '@components/grid/grid';
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import FiltersSubmitButtonEnablerExtension
from '@components/grid/extension/filters-submit-button-enabler-extension';

Check failure on line 26 in admin-dev/themes/new-theme/js/pages/backup/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

More than 1 blank line not allowed
const {$} = window;

$(() => {
const backupGrid = new Grid('backup');
const backupGrid = new window.prestashop.component.Grid('backup');

backupGrid.addExtension(new BulkActionCheckboxExtension());
backupGrid.addExtension(new SubmitBulkExtension());
backupGrid.addExtension(new LinkRowActionExtension());
backupGrid.addExtension(new SubmitRowActionExtension());
backupGrid.addExtension(new FiltersSubmitButtonEnablerExtension());
backupGrid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());
backupGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkExtension());
backupGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());
backupGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
backupGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension());
});
36 changes: 12 additions & 24 deletions admin-dev/themes/new-theme/js/pages/carrier/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,23 @@

import ShowcaseCard from '@components/showcase-card/showcase-card';
import ShowcaseCardCloseExtension from '@components/showcase-card/extension/showcase-card-close-extension';
import Grid from '@components/grid/grid';
import SortingExtension from '@components/grid/extension/sorting-extension';
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
import ReloadListActionExtension from '@components/grid/extension/reload-list-extension';
import ColumnTogglingExtension from '@components/grid/extension/column-toggling-extension';
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
import FiltersSubmitButtonEnablerExtension from '@components/grid/extension/filters-submit-button-enabler-extension';
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension';
import PositionExtension from '@components/grid/extension/position-extension';

const {$} = window;

$(() => {
const carrierGrid = new Grid('carrier');
const carrierGrid = new window.prestashop.component.Grid('carrier');

carrierGrid.addExtension(new SortingExtension());
carrierGrid.addExtension(new ReloadListActionExtension());
carrierGrid.addExtension(new PositionExtension(carrierGrid));
carrierGrid.addExtension(new FiltersSubmitButtonEnablerExtension());
carrierGrid.addExtension(new FiltersResetExtension());
carrierGrid.addExtension(new ExportToSqlManagerExtension());
carrierGrid.addExtension(new ColumnTogglingExtension());
carrierGrid.addExtension(new LinkRowActionExtension());
carrierGrid.addExtension(new SubmitRowActionExtension());
carrierGrid.addExtension(new SubmitBulkExtension());
carrierGrid.addExtension(new BulkActionCheckboxExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.ReloadListActionExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.PositionExtension(carrierGrid));
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.ColumnTogglingExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkExtension());
carrierGrid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());

const showcaseCard = new ShowcaseCard('carriersShowcaseCard');
showcaseCard.addExtension(new ShowcaseCardCloseExtension());
Expand Down
Loading

0 comments on commit be2ad9d

Please sign in to comment.