From 9b5750ba0c9b36be8cf157e12172338d4c5a5e57 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 15 Sep 2023 18:02:04 +0000 Subject: [PATCH] Restyled by prettier --- .../theme-import-cultures/script.js | 43 +++++++++------ .../theme-export-cultures/script.js | 43 +++++++++------ .../components/theme-export-posts/script.js | 53 ++++++++++++------- .../pages/url-alias/url-alias-services.js | 10 ++-- 4 files changed, 92 insertions(+), 57 deletions(-) diff --git a/src/app/app-portal/pages/theme-import/components/theme-import-cultures/script.js b/src/app/app-portal/pages/theme-import/components/theme-import-cultures/script.js index ef320107..9de5d208 100644 --- a/src/app/app-portal/pages/theme-import/components/theme-import-cultures/script.js +++ b/src/app/app-portal/pages/theme-import/components/theme-import-cultures/script.js @@ -1,16 +1,18 @@ app.component("themeImportCultures", { - templateUrl : - "/mix-app/views/app-portal/pages/theme-import/components/theme-import-cultures/view.html", - controller : [ + templateUrl: + "/mix-app/views/app-portal/pages/theme-import/components/theme-import-cultures/view.html", + controller: [ "$rootScope", "$scope", "ngAppSettings", - function($rootScope, $scope, ngAppSettings) { + function ($rootScope, $scope, ngAppSettings) { var ctrl = this; var service = $rootScope.getRestService("culture"); ctrl.selectAllContent = false; ctrl.request = angular.copy(ngAppSettings.request); - ctrl.$onInit = async () => { ctrl.getList(); }; + ctrl.$onInit = async () => { + ctrl.getList(); + }; ctrl.getList = async (cultureIndex) => { if (cultureIndex !== undefined) { ctrl.request.cultureIndex = cultureIndex; @@ -32,29 +34,36 @@ ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; culture.isImportData = selected && culture.isImportData; - ctrl.updateContent([ culture.id ], selected); + ctrl.updateContent([culture.id], selected); }; - ctrl.updateContent = function(arr, selected) { + ctrl.updateContent = function (arr, selected) { if (selected) { - ctrl.importThemeDto.cultureIds = - ctrl.unionArray(ctrl.importThemeDto.cultureIds, arr); + ctrl.importThemeDto.cultureIds = ctrl.unionArray( + ctrl.importThemeDto.cultureIds, + arr, + ); } else { ctrl.importThemeDto.cultureIds = - ctrl.importThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); + ctrl.importThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); ctrl.updateData(arr, false); } }; - ctrl.selectAll = function(arr) { + ctrl.selectAll = function (arr) { // ctrl.selectedList.data = []; - var ids = arr.map(function(obj) { return obj.id; }); + var ids = arr.map(function (obj) { + return obj.id; + }); ctrl.updateContent(ids, ctrl.selectAllContent); - angular.forEach(arr, - function(e) { e.isActived = ctrl.selectAllContent; }); + angular.forEach(arr, function (e) { + e.isActived = ctrl.selectAllContent; + }); + }; + ctrl.unionArray = (a, b) => { + return [...new Set([...a, ...b])]; }; - ctrl.unionArray = (a, b) => { return [...new Set([...a, ...b ]) ]; }; }, ], - bindings : { - importThemeDto : "=", + bindings: { + importThemeDto: "=", }, }); diff --git a/src/app/app-portal/pages/theme/components/theme-export-cultures/script.js b/src/app/app-portal/pages/theme/components/theme-export-cultures/script.js index af0acafa..d8bd54af 100644 --- a/src/app/app-portal/pages/theme/components/theme-export-cultures/script.js +++ b/src/app/app-portal/pages/theme/components/theme-export-cultures/script.js @@ -1,16 +1,18 @@ app.component("themeExportCultures", { - templateUrl : - "/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html", - controller : [ + templateUrl: + "/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html", + controller: [ "$rootScope", "$scope", "ngAppSettings", - function($rootScope, $scope, ngAppSettings) { + function ($rootScope, $scope, ngAppSettings) { var ctrl = this; var service = $rootScope.getRestService("culture"); ctrl.selectAllContent = false; ctrl.request = angular.copy(ngAppSettings.request); - ctrl.$onInit = async () => { ctrl.getList(); }; + ctrl.$onInit = async () => { + ctrl.getList(); + }; ctrl.getList = async (cultureIndex) => { if (cultureIndex !== undefined) { ctrl.request.cultureIndex = cultureIndex; @@ -32,29 +34,36 @@ ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; culture.isExportData = selected && culture.isExportData; - ctrl.updateContent([ culture.id ], selected); + ctrl.updateContent([culture.id], selected); }; - ctrl.updateContent = function(arr, selected) { + ctrl.updateContent = function (arr, selected) { if (selected) { - ctrl.exportThemeDto.cultureIds = - ctrl.unionArray(ctrl.exportThemeDto.cultureIds, arr); + ctrl.exportThemeDto.cultureIds = ctrl.unionArray( + ctrl.exportThemeDto.cultureIds, + arr, + ); } else { ctrl.exportThemeDto.cultureIds = - ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); + ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); ctrl.updateData(arr, false); } }; - ctrl.selectAll = function(arr) { + ctrl.selectAll = function (arr) { // ctrl.selectedList.data = []; - var ids = arr.map(function(obj) { return obj.id; }); + var ids = arr.map(function (obj) { + return obj.id; + }); ctrl.updateContent(ids, ctrl.selectAllContent); - angular.forEach(arr, - function(e) { e.isActived = ctrl.selectAllContent; }); + angular.forEach(arr, function (e) { + e.isActived = ctrl.selectAllContent; + }); + }; + ctrl.unionArray = (a, b) => { + return [...new Set([...a, ...b])]; }; - ctrl.unionArray = (a, b) => { return [...new Set([...a, ...b ]) ]; }; }, ], - bindings : { - exportThemeDto : "=", + bindings: { + exportThemeDto: "=", }, }); diff --git a/src/app/app-portal/pages/theme/components/theme-export-posts/script.js b/src/app/app-portal/pages/theme/components/theme-export-posts/script.js index 70778f6f..7ce8c62d 100644 --- a/src/app/app-portal/pages/theme/components/theme-export-posts/script.js +++ b/src/app/app-portal/pages/theme/components/theme-export-posts/script.js @@ -1,12 +1,12 @@ app.component("themeExportPosts", { - templateUrl : - "/mix-app/views/app-portal/pages/theme/components/theme-export-posts/view.html", - controller : [ + templateUrl: + "/mix-app/views/app-portal/pages/theme/components/theme-export-posts/view.html", + controller: [ "$rootScope", "$scope", "ngAppSettings", "BaseRestService", - function($rootScope, $scope, ngAppSettings, baseRestService) { + function ($rootScope, $scope, ngAppSettings, baseRestService) { var ctrl = this; var service = angular.copy(baseRestService); service.initService("/rest/mix-portal", "mix-post"); @@ -38,25 +38,40 @@ ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; post.isExportData = selected && post.isExportData; - let contentIds = post.contents.map(function(obj) { return obj.id; }); + let contentIds = post.contents.map(function (obj) { + return obj.id; + }); ctrl.exportThemeDto.content.postIds = ctrl.updateArray( - ctrl.exportThemeDto.content.postIds, [ post.id ], selected); + ctrl.exportThemeDto.content.postIds, + [post.id], + selected, + ); ctrl.exportThemeDto.content.postContentIds = ctrl.updateArray( - ctrl.exportThemeDto.content.postContentIds, contentIds, selected); + ctrl.exportThemeDto.content.postContentIds, + contentIds, + selected, + ); if (!selected) { ctrl.selectData(post, false); } }; ctrl.selectData = (post, selected) => { ctrl.selectAllData = ctrl.selectAllData && selected; - let contentIds = post.contents.map(function(obj) { return obj.id; }); + let contentIds = post.contents.map(function (obj) { + return obj.id; + }); ctrl.exportThemeDto.associations.postIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.postIds, [ post.id ], selected); - ctrl.exportThemeDto.associations.postContentIds = - ctrl.updateArray(ctrl.exportThemeDto.associations.postContentIds, - contentIds, selected); + ctrl.exportThemeDto.associations.postIds, + [post.id], + selected, + ); + ctrl.exportThemeDto.associations.postContentIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.postContentIds, + contentIds, + selected, + ); }; - ctrl.updateArray = function(src, arr, selected) { + ctrl.updateArray = function (src, arr, selected) { if (selected) { src = ctrl.unionArray(src, arr); } else { @@ -64,18 +79,20 @@ } return src; }; - ctrl.selectAll = function(arr) { - angular.forEach(arr, function(e) { + ctrl.selectAll = function (arr) { + angular.forEach(arr, function (e) { ctrl.selectContent(e, ctrl.selectAllContent); ctrl.selectData(e, ctrl.selectAllData); e.isActived = ctrl.selectAllContent; e.isExportData = ctrl.selectAllData; }); }; - ctrl.unionArray = (a, b) => { return [...new Set([...a, ...b ]) ]; }; + ctrl.unionArray = (a, b) => { + return [...new Set([...a, ...b])]; + }; }, ], - bindings : { - exportThemeDto : "=", + bindings: { + exportThemeDto: "=", }, }); diff --git a/src/app/app-portal/pages/url-alias/url-alias-services.js b/src/app/app-portal/pages/url-alias/url-alias-services.js index e4fa817d..05139d42 100644 --- a/src/app/app-portal/pages/url-alias/url-alias-services.js +++ b/src/app/app-portal/pages/url-alias/url-alias-services.js @@ -4,15 +4,15 @@ app.factory("UrlAliasService", [ "ApiService", "CommonService", "BaseRestService", - function($rootScope, apiService, commonService, baseService) { + function ($rootScope, apiService, commonService, baseService) { var serviceFactory = Object.create(baseService); serviceFactory.initService("/rest/mix-portal", "mix-url-alias"); - var _updateInfos = async function(pages) { + var _updateInfos = async function (pages) { var req = { - method : "POST", - url : this.prefixUrl + "/update-infos", - data : JSON.stringify(pages), + method: "POST", + url: this.prefixUrl + "/update-infos", + data: JSON.stringify(pages), }; return await apiService.sendRequest(req); };