diff --git a/.github/workflows/module-ci.yml b/.github/workflows/module-ci.yml index be97485..da782cf 100644 --- a/.github/workflows/module-ci.yml +++ b/.github/workflows/module-ci.yml @@ -127,7 +127,7 @@ jobs: run: vc-build Compress -skip Clean+Restore+Compile+Test - name: Publish Nuget - if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }} + if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }} uses: VirtoCommerce/vc-github-actions/publish-nuget@master - name: Publish to Blob diff --git a/src/VirtoCommerce.SitemapsModule.Web/Localizations/de.VirtoCommerce.Sitemaps.json b/src/VirtoCommerce.SitemapsModule.Web/Localizations/de.VirtoCommerce.Sitemaps.json index 4183db8..a07a4b4 100644 --- a/src/VirtoCommerce.SitemapsModule.Web/Localizations/de.VirtoCommerce.Sitemaps.json +++ b/src/VirtoCommerce.SitemapsModule.Web/Localizations/de.VirtoCommerce.Sitemaps.json @@ -27,10 +27,10 @@ "labelSitemapItemsLocation": "Sitemap Artikellage", "descriptionSitemapItemsLocation": "Zur Erzeugung einer Sitemap-Item-URL können die nächsten Muster verwendet werden: {language} - wird durch Sprachcode ersetzt (d.h. en-US), {slug} - wird durch SEO semantischen URL-Teil ersetzt", "labelSitemapItems": "Sitemap Reihen", - "sitemapMode": "Sitemap-Modus" + "sitemapMode": "Katalogelemente exportieren" }, "sitemapModes": { - "sitemapFullMode": "Vollständige Sitemap", + "sitemapFullMode": "Kategorien und Produkte", "sitemapOnlyCategoriesMode": "Nur Kategorien", "sitemapOnlyProductsMode": "Nur Produkte" }, diff --git a/src/VirtoCommerce.SitemapsModule.Web/Localizations/en.VirtoCommerce.Sitemaps.json b/src/VirtoCommerce.SitemapsModule.Web/Localizations/en.VirtoCommerce.Sitemaps.json index 2d71c5d..26df403 100644 --- a/src/VirtoCommerce.SitemapsModule.Web/Localizations/en.VirtoCommerce.Sitemaps.json +++ b/src/VirtoCommerce.SitemapsModule.Web/Localizations/en.VirtoCommerce.Sitemaps.json @@ -32,10 +32,10 @@ "labelSitemapItemsLocation": "Sitemap items location", "descriptionSitemapItemsLocation": "To generate a sitemap item URL can be used the next patterns: {slug} - will be replaced with SEO semantic URL part constructed depend on store SEO 'Links settings' rules. E.g /my-page/{slug}", "labelSitemapItems": "Sitemap items", - "sitemapMode": "Sitemap mode" + "sitemapMode": "Export catalog items" }, "sitemapModes": { - "sitemapFullMode": "Full", + "sitemapFullMode": "Сategories and products", "sitemapOnlyCategoriesMode": "Only categories", "sitemapOnlyProductsMode": "Only products" }, diff --git a/src/VirtoCommerce.SitemapsModule.Web/Localizations/ru.VirtoCommerce.Sitemaps.json b/src/VirtoCommerce.SitemapsModule.Web/Localizations/ru.VirtoCommerce.Sitemaps.json index 292e0dd..dc4e9da 100644 --- a/src/VirtoCommerce.SitemapsModule.Web/Localizations/ru.VirtoCommerce.Sitemaps.json +++ b/src/VirtoCommerce.SitemapsModule.Web/Localizations/ru.VirtoCommerce.Sitemaps.json @@ -32,10 +32,10 @@ "labelSitemapItemsLocation": "Местонахождение элементов Sitemap", "descriptionSitemapItemsLocation": "Для создания URL-адреса элементов sitemap могут быть использованы следующие шаблоны: {slug} - будет заменен частью семантической SEO в URL-адресе, построенной в зависимости от SEO правил 'Настроек ссылок'. Например, /моя-страница/{slug}", "labelSitemapItems": "Элементы Sitemap", - "sitemapMode": "Режим контента Sitemap" + "sitemapMode": "Экспортировать элементы каталога" }, "sitemapModes": { - "sitemapFullMode": "Полный Sitemap", + "sitemapFullMode": "Категории и продукты", "sitemapOnlyCategoriesMode": "Только категории", "sitemapOnlyProductsMode": "Только продукты" }, diff --git a/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.js b/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.js index 8818af4..8b47d8f 100644 --- a/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.js +++ b/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.js @@ -1,179 +1,186 @@ angular.module('virtoCommerce.sitemapsModule').controller('virtoCommerce.sitemapsModule.sitemapDetailController', ['$scope', 'platformWebApp.bladeUtils', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeNavigationService', 'virtoCommerce.sitemapsModule.sitemapApi', 'platformWebApp.dialogService', function ($scope, bladeUtils, uiGridHelper, bladeNavigationService, sitemapApi, dialogService) { - var blade = $scope.blade; - blade.updatePermission = 'sitemaps:update'; - - blade.refresh = function () { - blade.isLoading = true; - sitemapApi.get({ id: blade.currentEntity.id }, function (data) { - initializeBlade(data); - blade.title = blade.currentEntity.location; - }); - }; - - function initializeBlade(data) { - blade.currentEntity = angular.copy(data); - blade.origEntity = data; - blade.isLoading = false; - } - - blade.refreshSitemapItems = function () { - sitemapApi.searchSitemapItems({ - sitemapId: blade.currentEntity.id, - sort: uiGridHelper.getSortExpression($scope), - skip: ($scope.pageSettings.currentPage - 1) * $scope.pageSettings.itemsPerPageCount, - take: $scope.pageSettings.itemsPerPageCount - }, function (response) { - $scope.pageSettings.totalItems = response.totalCount; - blade.currentEntities = response.results; - blade.isLoading = false; - }); - }; - - function refreshSitemapItemsAndParent() { - blade.refreshSitemapItems(); - refreshParent(); - } - - function refreshParent() { - if (blade.parentRefresh) { - blade.parentRefresh(); - } - } - - blade.onClose = function (closeCallback) { - bladeNavigationService.showConfirmationIfNeeded(isDirty(), canSave(), blade, $scope.saveChanges, closeCallback, "sitemapsModule.dialogs.discardChanges.title", "sitemapsModule.dialogs.discardChanges.message"); - }; - - $scope.setForm = function (form) { $scope.formScope = form; }; - - function isDirty() { - return !angular.equals(blade.origEntity, blade.currentEntity) && blade.hasUpdatePermission(); - } - - function canSave() { - return isDirty() && $scope.formScope && $scope.formScope.$valid; - } - - $scope.hasStaticContentItems = function () { - var staticContentItem = _.find(blade.currentEntities, function (e) { return e.objectType.toLowerCase() === 'contentitem' || e.objectType.toLowerCase() === 'folder' }); - return staticContentItem != null && staticContentItem != undefined; - } - - $scope.saveChanges = function () { - $scope.errorMessage = null; - - if (blade.currentEntity.location.toLowerCase() === 'sitemap.xml') { - $scope.errorMessage = 'sitemapsModule.blades.sitemap.formSitemap.sitemapIndexErrorMessage'; - } else { - blade.isLoading = true; - - sitemapApi.search({ - storeId: blade.currentEntity.storeId, - location: blade.currentEntity.location, - }, function (response) { - if (_.any(response.results, function (s) { return blade.inNew || s.id !== blade.currentEntity.id })) { - $scope.errorMessage = 'sitemapsModule.blades.sitemap.formSitemap.sitemapSitemapLocationExistErrorMessage'; + var blade = $scope.blade; + blade.updatePermission = 'sitemaps:update'; + blade.sitemapModes = ['Full', 'OnlyProducts', 'OnlyCategories']; + + blade.refresh = function () { + blade.isLoading = true; + sitemapApi.get({ id: blade.currentEntity.id }, function (data) { + initializeBlade(data); + blade.title = blade.currentEntity.location; + }); + }; + + function initializeBlade(data) { + blade.currentEntity = angular.copy(data); + blade.origEntity = data; + blade.isLoading = false; + } + + blade.refreshSitemapItems = function () { + sitemapApi.searchSitemapItems({ + sitemapId: blade.currentEntity.id, + sort: uiGridHelper.getSortExpression($scope), + skip: ($scope.pageSettings.currentPage - 1) * $scope.pageSettings.itemsPerPageCount, + take: $scope.pageSettings.itemsPerPageCount + }, function (response) { + $scope.pageSettings.totalItems = response.totalCount; + blade.currentEntities = response.results; blade.isLoading = false; - } else { - if (blade.isNew) { - sitemapApi.addSitemap(blade.currentEntity, function () { - angular.copy(blade.currentEntity, blade.origEntity); - bladeNavigationService.closeBlade(blade, blade.parentRefresh); - }); - } else { - sitemapApi.updateSitemap(blade.currentEntity, function () { - blade.refresh(); - refreshParent(); - }); - } + }); + }; + + function refreshSitemapItemsAndParent() { + blade.refreshSitemapItems(); + refreshParent(); + } + + function refreshParent() { + if (blade.parentRefresh) { + blade.parentRefresh(); } - }); - } - } - - if (blade.isNew) { - blade.title = 'sitemapsModule.blades.sitemap.newSitemapTitle'; - blade.currentEntity.sitemapMode = 'Full'; - initializeBlade(blade.currentEntity); - } else { - blade.title = blade.currentEntity.location; - blade.toolbarCommands = [ - { - name: "platform.commands.save", icon: 'fa fa-save', - executeMethod: $scope.saveChanges, - canExecuteMethod: canSave - }, - { - name: "platform.commands.reset", icon: 'fa fa-undo', - executeMethod: function () { - angular.copy(blade.origEntity, blade.currentEntity); - }, - canExecuteMethod: isDirty, - permission: blade.updatePermission - }, - { - name: 'sitemapsModule.blades.sitemap.toolbar.addItems', icon: 'fa fa-plus', - executeMethod: showAddItemsBlade, - canExecuteMethod: function () { return true; }, - permission: blade.updatePermission - }, - { - name: 'sitemapsModule.blades.sitemap.toolbar.removeItems', icon: 'fa fa-trash-o', - executeMethod: function () { - blade.removeItems($scope.gridApi.selection.getSelectedRows()); - }, - canExecuteMethod: function () { - return $scope.gridApi && _.any($scope.gridApi.selection.getSelectedRows()); - }, - permission: blade.updatePermission } - ]; - - function showAddItemsBlade() { - var newBlade = { - id: 'addSitemapItemsBlade', - sitemap: blade.currentEntity, - storeId: blade.currentEntity.storeId, - parentRefresh: refreshSitemapItemsAndParent, - title: 'sitemapsModule.blades.addItems.title', - controller: 'virtoCommerce.sitemapsModule.sitemapItemsAddController', - template: 'Modules/$(VirtoCommerce.Sitemaps)/Scripts/blades/sitemap-items-add.tpl.html' + + blade.onClose = function (closeCallback) { + bladeNavigationService.showConfirmationIfNeeded(isDirty(), canSave(), blade, $scope.saveChanges, closeCallback, "sitemapsModule.dialogs.discardChanges.title", "sitemapsModule.dialogs.discardChanges.message"); + }; + + $scope.setForm = function (form) { $scope.formScope = form; }; + + function isDirty() { + return !angular.equals(blade.origEntity, blade.currentEntity) && blade.hasUpdatePermission(); } - bladeNavigationService.showBlade(newBlade, blade); - } - - blade.removeItems = function (list) { - var dialog = { - id: "confirmDelete", - title: "sitemapsModule.dialogs.sitemapItems-delete.title", - message: "sitemapsModule.dialogs.sitemapItems-delete.message", - callback: function (remove) { - if (remove) { - blade.isLoading = true; - var ids = _.pluck(list, 'id'); - sitemapApi.removeSitemapItems({ itemIds: ids }, refreshSitemapItemsAndParent); - } - } + + function canSave() { + return isDirty() && $scope.formScope && $scope.formScope.$valid; } - dialogService.showConfirmationDialog(dialog); - }; - // ui-grid - $scope.setGridOptions = function (gridOptions) { - $scope.gridOptions = gridOptions; + $scope.hasStaticContentItems = function () { + var staticContentItem = _.find(blade.currentEntities, function (e) { return e.objectType.toLowerCase() === 'contentitem' || e.objectType.toLowerCase() === 'folder' }); + return staticContentItem != null && staticContentItem != undefined; + } - gridOptions.onRegisterApi = function (gridApi) { - gridApi.core.on.sortChanged($scope, function () { - if (!blade.isLoading) blade.refreshSitemapItems(); + $scope.hasCatalogItems = function () { + return blade.currentEntities && blade.currentEntities.some(function (entity) { + return entity.objectType === "category"; }); - }; + } + + $scope.saveChanges = function () { + $scope.errorMessage = null; - bladeUtils.initializePagination($scope, true); - $scope.$watch('pageSettings.currentPage', function () { blade.refreshSitemapItems(); }); - blade.refresh(); - }; - } + if (blade.currentEntity.location.toLowerCase() === 'sitemap.xml') { + $scope.errorMessage = 'sitemapsModule.blades.sitemap.formSitemap.sitemapIndexErrorMessage'; + } else { + blade.isLoading = true; + + sitemapApi.search({ + storeId: blade.currentEntity.storeId, + location: blade.currentEntity.location, + }, function (response) { + if (_.any(response.results, function (s) { return blade.inNew || s.id !== blade.currentEntity.id })) { + $scope.errorMessage = 'sitemapsModule.blades.sitemap.formSitemap.sitemapSitemapLocationExistErrorMessage'; + blade.isLoading = false; + } else { + if (blade.isNew) { + sitemapApi.addSitemap(blade.currentEntity, function () { + angular.copy(blade.currentEntity, blade.origEntity); + bladeNavigationService.closeBlade(blade, blade.parentRefresh); + }); + } else { + sitemapApi.updateSitemap(blade.currentEntity, function () { + blade.refresh(); + refreshParent(); + }); + } + } + }); + } + } + + if (blade.isNew) { + blade.title = 'sitemapsModule.blades.sitemap.newSitemapTitle'; + blade.currentEntity.sitemapMode = 'Full'; + initializeBlade(blade.currentEntity); + } else { + blade.title = blade.currentEntity.location; + blade.toolbarCommands = [ + { + name: "platform.commands.save", icon: 'fa fa-save', + executeMethod: $scope.saveChanges, + canExecuteMethod: canSave + }, + { + name: "platform.commands.reset", icon: 'fa fa-undo', + executeMethod: function () { + angular.copy(blade.origEntity, blade.currentEntity); + }, + canExecuteMethod: isDirty, + permission: blade.updatePermission + }, + { + name: 'sitemapsModule.blades.sitemap.toolbar.addItems', icon: 'fa fa-plus', + executeMethod: showAddItemsBlade, + canExecuteMethod: function () { return true; }, + permission: blade.updatePermission + }, + { + name: 'sitemapsModule.blades.sitemap.toolbar.removeItems', icon: 'fa fa-trash-o', + executeMethod: function () { + blade.removeItems($scope.gridApi.selection.getSelectedRows()); + }, + canExecuteMethod: function () { + return $scope.gridApi && _.any($scope.gridApi.selection.getSelectedRows()); + }, + permission: blade.updatePermission + } + ]; + + function showAddItemsBlade() { + var newBlade = { + id: 'addSitemapItemsBlade', + sitemap: blade.currentEntity, + storeId: blade.currentEntity.storeId, + parentRefresh: refreshSitemapItemsAndParent, + title: 'sitemapsModule.blades.addItems.title', + controller: 'virtoCommerce.sitemapsModule.sitemapItemsAddController', + template: 'Modules/$(VirtoCommerce.Sitemaps)/Scripts/blades/sitemap-items-add.tpl.html' + } + bladeNavigationService.showBlade(newBlade, blade); + } + + blade.removeItems = function (list) { + var dialog = { + id: "confirmDelete", + title: "sitemapsModule.dialogs.sitemapItems-delete.title", + message: "sitemapsModule.dialogs.sitemapItems-delete.message", + callback: function (remove) { + if (remove) { + blade.isLoading = true; + var ids = _.pluck(list, 'id'); + sitemapApi.removeSitemapItems({ itemIds: ids }, refreshSitemapItemsAndParent); + } + } + } + dialogService.showConfirmationDialog(dialog); + }; + + // ui-grid + $scope.setGridOptions = function (gridOptions) { + $scope.gridOptions = gridOptions; + + gridOptions.onRegisterApi = function (gridApi) { + gridApi.core.on.sortChanged($scope, function () { + if (!blade.isLoading) blade.refreshSitemapItems(); + }); + }; + + bladeUtils.initializePagination($scope, true); + $scope.$watch('pageSettings.currentPage', function () { blade.refreshSitemapItems(); }); + blade.refresh(); + }; + } -}]); + }]); diff --git a/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.tpl.html b/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.tpl.html index 753c3a1..d9d7424 100644 --- a/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.tpl.html +++ b/src/VirtoCommerce.SitemapsModule.Web/Scripts/blades/sitemap-detail.tpl.html @@ -1,48 +1,42 @@
-
-
-
-
- -
- -
{{errorMessage | translate}}
-
{{'sitemapsModule.blades.sitemap.formSitemap.descriptionSitemapLocation' | translate}}
-
-
-
- -
- -
-
-
-
- -
- - - -
-
-
-
-
- -
-
-
+
+
+
+ +
+ +
{{errorMessage | translate}}
+
{{'sitemapsModule.blades.sitemap.formSitemap.descriptionSitemapLocation' | translate}}
+
+
+
+ +
+ +
+
+
+
+ +
+ + {{ 'sitemapsModule.blades.sitemap.sitemapModes.sitemap' + $select.selected + 'Mode' | translate }} + + + + +
+
+
+
+
+ +
+
+
-
- -
-
+
+
+
+
\ No newline at end of file