From e57e556935eccffca26d76dcf1a2907cacc16aa1 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 15 Sep 2023 18:02:00 +0000 Subject: [PATCH] Restyled by clang-format --- .../theme-import-cultures/script.js | 123 ++++++------- .../theme-export-cultures/script.js | 123 ++++++------- .../components/theme-export-posts/script.js | 173 ++++++++---------- .../pages/url-alias/url-alias-services.js | 36 ++-- 4 files changed, 210 insertions(+), 245 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 c4c94c94..ef320107 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,69 +1,60 @@ app.component("themeImportCultures", { - templateUrl: - "/mix-app/views/app-portal/pages/theme-import/components/theme-import-cultures/view.html", - controller: [ - "$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.getList = async (cultureIndex) => { - if (cultureIndex !== undefined) { - ctrl.request.cultureIndex = cultureIndex; - } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); - } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); - } - let getData = await service.getList(ctrl.request); - if (getData.success) { - ctrl.data = getData.data; - } - }; - ctrl.selectContent = (culture, selected) => { - ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.selectAllData = ctrl.selectAllData && selected; - culture.isImportData = selected && culture.isImportData; - ctrl.updateContent([culture.id], selected); - }; - ctrl.updateContent = function (arr, selected) { - if (selected) { - ctrl.importThemeDto.cultureIds = ctrl.unionArray( - ctrl.importThemeDto.cultureIds, - arr - ); - } else { - ctrl.importThemeDto.cultureIds = - ctrl.importThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); - ctrl.updateData(arr, false); - } - }; - ctrl.selectAll = function (arr) { - // ctrl.selectedList.data = []; - var ids = arr.map(function (obj) { - return obj.id; - }); - ctrl.updateContent(ids, ctrl.selectAllContent); - angular.forEach(arr, function (e) { - e.isActived = ctrl.selectAllContent; - }); - }; - ctrl.unionArray = (a, b) => { - return [...new Set([...a, ...b])]; - }; - }, - ], - bindings: { - importThemeDto: "=", + templateUrl : + "/mix-app/views/app-portal/pages/theme-import/components/theme-import-cultures/view.html", + controller : [ + "$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.getList = async (cultureIndex) => { + if (cultureIndex !== undefined) { + ctrl.request.cultureIndex = cultureIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + let getData = await service.getList(ctrl.request); + if (getData.success) { + ctrl.data = getData.data; + } + }; + ctrl.selectContent = (culture, selected) => { + ctrl.selectAllContent = ctrl.selectAllContent && selected; + ctrl.selectAllData = ctrl.selectAllData && selected; + culture.isImportData = selected && culture.isImportData; + ctrl.updateContent([ culture.id ], selected); + }; + ctrl.updateContent = function(arr, selected) { + if (selected) { + ctrl.importThemeDto.cultureIds = + ctrl.unionArray(ctrl.importThemeDto.cultureIds, arr); + } else { + ctrl.importThemeDto.cultureIds = + ctrl.importThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); + ctrl.updateData(arr, false); + } + }; + ctrl.selectAll = function(arr) { + // ctrl.selectedList.data = []; + var ids = arr.map(function(obj) { return obj.id; }); + ctrl.updateContent(ids, ctrl.selectAllContent); + angular.forEach(arr, + function(e) { e.isActived = ctrl.selectAllContent; }); + }; + ctrl.unionArray = (a, b) => { return [...new Set([...a, ...b ]) ]; }; }, + ], + 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 17f09979..af0acafa 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,69 +1,60 @@ app.component("themeExportCultures", { - templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html", - controller: [ - "$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.getList = async (cultureIndex) => { - if (cultureIndex !== undefined) { - ctrl.request.cultureIndex = cultureIndex; - } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); - } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); - } - let getData = await service.getList(ctrl.request); - if (getData.success) { - ctrl.data = getData.data; - } - }; - ctrl.selectContent = (culture, selected) => { - ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.selectAllData = ctrl.selectAllData && selected; - culture.isExportData = selected && culture.isExportData; - ctrl.updateContent([culture.id], selected); - }; - ctrl.updateContent = function (arr, selected) { - if (selected) { - ctrl.exportThemeDto.cultureIds = ctrl.unionArray( - ctrl.exportThemeDto.cultureIds, - arr - ); - } else { - ctrl.exportThemeDto.cultureIds = - ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); - ctrl.updateData(arr, false); - } - }; - ctrl.selectAll = function (arr) { - // ctrl.selectedList.data = []; - var ids = arr.map(function (obj) { - return obj.id; - }); - ctrl.updateContent(ids, ctrl.selectAllContent); - angular.forEach(arr, function (e) { - e.isActived = ctrl.selectAllContent; - }); - }; - ctrl.unionArray = (a, b) => { - return [...new Set([...a, ...b])]; - }; - }, - ], - bindings: { - exportThemeDto: "=", + templateUrl : + "/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html", + controller : [ + "$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.getList = async (cultureIndex) => { + if (cultureIndex !== undefined) { + ctrl.request.cultureIndex = cultureIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + let getData = await service.getList(ctrl.request); + if (getData.success) { + ctrl.data = getData.data; + } + }; + ctrl.selectContent = (culture, selected) => { + ctrl.selectAllContent = ctrl.selectAllContent && selected; + ctrl.selectAllData = ctrl.selectAllData && selected; + culture.isExportData = selected && culture.isExportData; + ctrl.updateContent([ culture.id ], selected); + }; + ctrl.updateContent = function(arr, selected) { + if (selected) { + ctrl.exportThemeDto.cultureIds = + ctrl.unionArray(ctrl.exportThemeDto.cultureIds, arr); + } else { + ctrl.exportThemeDto.cultureIds = + ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); + ctrl.updateData(arr, false); + } + }; + ctrl.selectAll = function(arr) { + // ctrl.selectedList.data = []; + var ids = arr.map(function(obj) { return obj.id; }); + ctrl.updateContent(ids, ctrl.selectAllContent); + angular.forEach(arr, + function(e) { e.isActived = ctrl.selectAllContent; }); + }; + ctrl.unionArray = (a, b) => { return [...new Set([...a, ...b ]) ]; }; }, + ], + 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 7f410a55..70778f6f 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,98 +1,81 @@ app.component("themeExportPosts", { - templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-posts/view.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "BaseRestService", - function ($rootScope, $scope, ngAppSettings, baseRestService) { - var ctrl = this; - var service = angular.copy(baseRestService); - service.initService("/rest/mix-portal", "mix-post"); - ctrl.selectAllContent = false; - ctrl.selectAllData = false; - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.$onInit = async () => { - ctrl.request.pageSize = 1000; - ctrl.getList(); - }; - ctrl.getList = async (postIndex) => { - if (postIndex !== undefined) { - ctrl.request.postIndex = postIndex; - } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); - } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); - } - let getData = await service.getList(ctrl.request); - if (getData.success) { - ctrl.data = getData.data; - } - }; - ctrl.selectContent = (post, selected) => { - 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; - }); - ctrl.exportThemeDto.content.postIds = ctrl.updateArray( - ctrl.exportThemeDto.content.postIds, - [post.id], - selected - ); - ctrl.exportThemeDto.content.postContentIds = ctrl.updateArray( - 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; - }); - 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.updateArray = function (src, arr, selected) { - if (selected) { - src = ctrl.unionArray(src, arr); - } else { - src = src.filter((m) => arr.indexOf(m) < 0); - } - return src; - }; - 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])]; - }; - }, - ], - bindings: { - exportThemeDto: "=", + templateUrl : + "/mix-app/views/app-portal/pages/theme/components/theme-export-posts/view.html", + controller : [ + "$rootScope", + "$scope", + "ngAppSettings", + "BaseRestService", + function($rootScope, $scope, ngAppSettings, baseRestService) { + var ctrl = this; + var service = angular.copy(baseRestService); + service.initService("/rest/mix-portal", "mix-post"); + ctrl.selectAllContent = false; + ctrl.selectAllData = false; + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.$onInit = async () => { + ctrl.request.pageSize = 1000; + ctrl.getList(); + }; + ctrl.getList = async (postIndex) => { + if (postIndex !== undefined) { + ctrl.request.postIndex = postIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + let getData = await service.getList(ctrl.request); + if (getData.success) { + ctrl.data = getData.data; + } + }; + ctrl.selectContent = (post, selected) => { + 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; }); + ctrl.exportThemeDto.content.postIds = ctrl.updateArray( + ctrl.exportThemeDto.content.postIds, [ post.id ], selected); + ctrl.exportThemeDto.content.postContentIds = ctrl.updateArray( + 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; }); + 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.updateArray = function(src, arr, selected) { + if (selected) { + src = ctrl.unionArray(src, arr); + } else { + src = src.filter((m) => arr.indexOf(m) < 0); + } + return src; + }; + 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 ]) ]; }; }, + ], + 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 a9d5abbf..e4fa817d 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 @@ -1,22 +1,22 @@ "use strict"; app.factory("UrlAliasService", [ - "$rootScope", - "ApiService", - "CommonService", - "BaseRestService", - function ($rootScope, apiService, commonService, baseService) { - var serviceFactory = Object.create(baseService); - serviceFactory.initService("/rest/mix-portal", "mix-url-alias"); + "$rootScope", + "ApiService", + "CommonService", + "BaseRestService", + function($rootScope, apiService, commonService, baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.initService("/rest/mix-portal", "mix-url-alias"); - var _updateInfos = async function (pages) { - var req = { - method: "POST", - url: this.prefixUrl + "/update-infos", - data: JSON.stringify(pages), - }; - return await apiService.sendRequest(req); - }; - serviceFactory.updateInfos = _updateInfos; - return serviceFactory; - }, + var _updateInfos = async function(pages) { + var req = { + method : "POST", + url : this.prefixUrl + "/update-infos", + data : JSON.stringify(pages), + }; + return await apiService.sendRequest(req); + }; + serviceFactory.updateInfos = _updateInfos; + return serviceFactory; + }, ]);