diff --git a/src/JsonSchema/AppSettings.cs b/src/JsonSchema/AppSettings.cs index 18d83b53a3..e1a6d619ec 100644 --- a/src/JsonSchema/AppSettings.cs +++ b/src/JsonSchema/AppSettings.cs @@ -91,6 +91,8 @@ namespace JsonSchema public InstallDefaultDataSettings? DefaultDataCreation { get; set; } public DataTypesSettings? DataTypes { get; set; } + + public MarketplaceSettings? Marketplace { get; set; } } /// diff --git a/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs b/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs index 3373b7a778..3a3f90de89 100644 --- a/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs @@ -7,7 +7,8 @@ namespace Umbraco.Cms.Core.Configuration.Models; /// Typed configuration options for active directory settings. /// [UmbracoOptions(Constants.Configuration.ConfigActiveDirectory)] -[Obsolete("This is not used anymore. Will be removed in Umbraco 12")]public class ActiveDirectorySettings +[Obsolete("This is not used anymore. Will be removed in Umbraco 12")] +public class ActiveDirectorySettings { /// /// Gets or sets a value for the Active Directory domain. diff --git a/src/Umbraco.Core/Configuration/Models/MarketplaceSettings.cs b/src/Umbraco.Core/Configuration/Models/MarketplaceSettings.cs new file mode 100644 index 0000000000..73f7da185f --- /dev/null +++ b/src/Umbraco.Core/Configuration/Models/MarketplaceSettings.cs @@ -0,0 +1,16 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Cms.Core.Configuration.Models; + +/// +/// Configuration options for the Marketplace. +/// +[UmbracoOptions(Constants.Configuration.ConfigMarketplace)] +public class MarketplaceSettings +{ + /// + /// Gets or sets the additional parameters that are sent to the Marketplace. + /// + public Dictionary AdditionalParameters { get; set; } = new (); +} diff --git a/src/Umbraco.Core/Constants-Configuration.cs b/src/Umbraco.Core/Constants-Configuration.cs index 11694fa5c0..fea3ceecbf 100644 --- a/src/Umbraco.Core/Constants-Configuration.cs +++ b/src/Umbraco.Core/Constants-Configuration.cs @@ -27,6 +27,7 @@ public static partial class Constants public const string ConfigHostingDebug = ConfigHostingPrefix + "Debug"; public const string ConfigCustomErrorsMode = ConfigCustomErrorsPrefix + "Mode"; public const string ConfigActiveDirectory = ConfigPrefix + "ActiveDirectory"; + public const string ConfigMarketplace = ConfigPrefix + "Marketplace"; public const string ConfigLegacyPasswordMigration = ConfigPrefix + "LegacyPasswordMigration"; public const string ConfigContent = ConfigPrefix + "Content"; public const string ConfigCoreDebug = ConfigCorePrefix + "Debug"; diff --git a/src/Umbraco.Core/Constants-Marketplace.cs b/src/Umbraco.Core/Constants-Marketplace.cs new file mode 100644 index 0000000000..38cf282b74 --- /dev/null +++ b/src/Umbraco.Core/Constants-Marketplace.cs @@ -0,0 +1,12 @@ +namespace Umbraco.Cms.Core; + +public static partial class Constants +{ + /// + /// Defines the constants used for the Umbraco Marketplace. + /// + public static class Marketplace + { + public const string Url = "https://marketplace.umbraco.com"; + } +} diff --git a/src/Umbraco.Core/Constants-PackageRepository.cs b/src/Umbraco.Core/Constants-PackageRepository.cs index 96746adb49..ef2e6fdd48 100644 --- a/src/Umbraco.Core/Constants-PackageRepository.cs +++ b/src/Umbraco.Core/Constants-PackageRepository.cs @@ -5,6 +5,7 @@ public static partial class Constants /// /// Defines the constants used for the Umbraco package repository /// + [Obsolete("This is no longer used and will be removed in Umbraco 13")] public static class PackageRepository { public const string RestApiBaseUrl = "https://our.umbraco.com/webapi/packages/v1"; diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs index e65bc3c47b..da49cf68fc 100644 --- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs @@ -50,6 +50,7 @@ public static partial class UmbracoBuilderExtensions builder .AddUmbracoOptions() .AddUmbracoOptions() + .AddUmbracoOptions() .AddUmbracoOptions() .AddUmbracoOptions() .AddUmbracoOptions() diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/da.xml b/src/Umbraco.Core/EmbeddedResources/Lang/da.xml index c8a5dc0c99..7fbc7d0b5b 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/da.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/da.xml @@ -1262,6 +1262,7 @@ Mange hilsner fra Umbraco robotten Mediearkiv Medlemmer Pakker + Marketplace Nyhedsbreve Indstillinger Statistik diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en.xml index b8c12eb0ac..941ac9d8a0 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en.xml @@ -1476,6 +1476,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Members Newsletters Packages + Marketplace Settings Statistics Translation diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml index 9aef174996..64694dd053 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml @@ -1513,6 +1513,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Media Members Packages + Marketplace Settings Translation Users diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs index e0cd9e0459..ab278814fc 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs @@ -1,4 +1,5 @@ using System.Runtime.Serialization; +using System.Web; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Routing; @@ -54,6 +55,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers private MemberPasswordConfigurationSettings _memberPasswordConfigurationSettings; private DataTypesSettings _dataTypesSettings; private readonly ITempDataDictionaryFactory _tempDataDictionaryFactory; + private MarketplaceSettings _marketplaceSettings; [Obsolete("Use constructor that takes IOptionsMontior, scheduled for removal in V12")] public BackOfficeServerVariables( @@ -139,6 +141,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers { } + [Obsolete("Use constructor that takes IOptionsMonitor, scheduled for removal in V13")] public BackOfficeServerVariables( LinkGenerator linkGenerator, IRuntimeState runtimeState, @@ -159,6 +162,52 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers IOptionsMonitor memberPasswordConfigurationSettings, IOptionsMonitor dataTypesSettings, ITempDataDictionaryFactory tempDataDictionaryFactory) + : this( + linkGenerator, + runtimeState, + features, + globalSettings, + umbracoVersion, + contentSettings, + httpContextAccessor, + treeCollection, + hostingEnvironment, + runtimeSettings, + securitySettings, + runtimeMinifier, + externalLogins, + imageUrlGenerator, + previewRoutes, + emailSender, + memberPasswordConfigurationSettings, + dataTypesSettings, + tempDataDictionaryFactory, + StaticServiceProvider.Instance.GetRequiredService>() + ) + { + } + + public BackOfficeServerVariables( + LinkGenerator linkGenerator, + IRuntimeState runtimeState, + UmbracoFeatures features, + IOptionsMonitor globalSettings, + IUmbracoVersion umbracoVersion, + IOptionsMonitor contentSettings, + IHttpContextAccessor httpContextAccessor, + TreeCollection treeCollection, + IHostingEnvironment hostingEnvironment, + IOptionsMonitor runtimeSettings, + IOptionsMonitor securitySettings, + IRuntimeMinifier runtimeMinifier, + IBackOfficeExternalLoginProviders externalLogins, + IImageUrlGenerator imageUrlGenerator, + PreviewRoutes previewRoutes, + IEmailSender emailSender, + IOptionsMonitor memberPasswordConfigurationSettings, + IOptionsMonitor dataTypesSettings, + ITempDataDictionaryFactory tempDataDictionaryFactory, + IOptionsMonitor marketplaceSettings) { _linkGenerator = linkGenerator; _runtimeState = runtimeState; @@ -179,6 +228,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers _tempDataDictionaryFactory = tempDataDictionaryFactory; _memberPasswordConfigurationSettings = memberPasswordConfigurationSettings.CurrentValue; _dataTypesSettings = dataTypesSettings.CurrentValue; + _marketplaceSettings = marketplaceSettings.CurrentValue; globalSettings.OnChange(x => _globalSettings = x); contentSettings.OnChange(x => _contentSettings = x); @@ -186,6 +236,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers securitySettings.OnChange(x => _securitySettings = x); dataTypesSettings.OnChange(x => _dataTypesSettings = x); memberPasswordConfigurationSettings.OnChange(x => _memberPasswordConfigurationSettings = x); + marketplaceSettings.OnChange(x => _marketplaceSettings = x); } /// @@ -298,6 +349,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers {"gridConfig", _linkGenerator.GetPathByAction(nameof(BackOfficeController.GetGridConfig), backOfficeControllerName, new { area = Constants.Web.Mvc.BackOfficeArea })}, // TODO: This is ultra confusing! this same key is used for different things, when returning the full app when authenticated it is this URL but when not auth'd it's actually the ServerVariables address {"serverVarsJs", _linkGenerator.GetPathByAction(nameof(BackOfficeController.Application), backOfficeControllerName, new { area = Constants.Web.Mvc.BackOfficeArea })}, + {"marketplaceUrl", GetMarketplaceUrl()}, //API URLs { "packagesRestApiBaseUrl", Constants.PackageRepository.RestApiBaseUrl @@ -625,6 +677,25 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers return defaultVals; } + private string GetMarketplaceUrl() + { + var uriBuilder = new UriBuilder(Constants.Marketplace.Url); + + var query = HttpUtility.ParseQueryString(uriBuilder.Query); + + query["umbversion"] = _runtimeState.SemanticVersion.ToSemanticStringWithoutBuild(); + query["style"] = "backoffice"; + + foreach (var kvp in _marketplaceSettings.AdditionalParameters) + { + query[kvp.Key] = kvp.Value; + } + + uriBuilder.Query = query.ToString(); + + return uriBuilder.ToString(); + } + [DataContract] private class PluginTree { diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js index 430f05c2c4..60ceebb207 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js @@ -2,8 +2,9 @@ * @ngdoc service * @name umbraco.resources.ourPackageRepositoryResource * @description handles data for package installations + * @deprecated This resource is deprecated and will be removed in future versions. Umbraco no longer supports the Our Umbraco repository. **/ -function ourPackageRepositoryResource($q, $http, umbDataFormatter, umbRequestHelper) { +function ourPackageRepositoryResource($http, umbRequestHelper) { var baseurl = Umbraco.Sys.ServerVariables.umbracoUrls.packagesRestApiBaseUrl; diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less index 589a3bfe91..14cfa5f007 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less @@ -1,3 +1,41 @@ +[data-element="editor-packages"] { + .umb-pane { + height: 100%; + margin: 0; + + .umb-pane-content, + .umb-editor-sub-views { + height: 100%; + + .umb-editor-sub-view { + padding: 20px; + } + + .sub-view-Marketplace { + height: 100%; + margin: 0; + padding: 0; + + .umb-editor-sub-view__content { + height: 100%; + } + } + } + } +} + +.umb-marketplace-view-wrapper { + height: 100%; + display: flex; + align-items: stretch; +} + +.umb-marketplace-view { + width: 100%; + height: 100%; + overflow: hidden; +} + .umb-packages-view-title { font-size: 20px; font-weight: bold; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-container.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-container.html index aa1765f365..2def207c70 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-container.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-container.html @@ -6,6 +6,6 @@ - + diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html index a0f56ee883..56c7a9cf48 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html @@ -1,17 +1,12 @@ - - - - - - - - + + + diff --git a/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.info.controller.js b/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.info.controller.js index be8ddba592..2cb075e80d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.info.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.info.controller.js @@ -6,10 +6,9 @@ * @description * The controller for the info view of the datatype editor */ -function DataTypeInfoController($scope, $routeParams, dataTypeResource, eventsService, $timeout, editorService) { +function DataTypeInfoController($scope, $routeParams, dataTypeResource, $timeout, editorService) { var vm = this; - var evts = []; var referencesLoaded = false; vm.references = {}; @@ -48,7 +47,7 @@ function DataTypeInfoController($scope, $routeParams, dataTypeResource, eventsSe function open(id, event, type) { // targeting a new tab/window? - if (event.ctrlKey || + if (event.ctrlKey || event.shiftKey || event.metaKey || // apple (event.button && event.button === 1) // middle click, >IE9 + everyone else @@ -85,25 +84,7 @@ function DataTypeInfoController($scope, $routeParams, dataTypeResource, eventsSe } } - // load data type references when the references tab is activated - evts.push(eventsService.on("app.tabChange", function (event, args) { - $timeout(function () { - if (args.alias === "info") { - loadRelations(); - } - }); - })); - - //ensure to unregister from all events! - $scope.$on('$destroy', function () { - for (var e in evts) { - eventsService.unsubscribe(evts[e]); - } - }); - - - - + loadRelations(); } angular.module("umbraco").controller("Umbraco.Editors.DataType.InfoController", DataTypeInfoController); diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/overview.controller.js b/src/Umbraco.Web.UI.Client/src/views/packages/overview.controller.js index f5fd3bfd9c..d0de742205 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packages/overview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packages/overview.controller.js @@ -1,99 +1,99 @@ (function () { - "use strict"; + "use strict"; - function PackagesOverviewController($scope, $location, $routeParams, localizationService, localStorageService) { + function PackagesOverviewController($location, $routeParams, localizationService, localStorageService) { - //Hack! - // if there is a local storage value for packageInstallData then we need to redirect there, - // the issue is that we still have webforms and we cannot go to a hash location and then window.reload - // because it will double load it. - // we will refresh and then navigate there. + //Hack! + // if there is a local storage value for packageInstallData then we need to redirect there, + // the issue is that we still have webforms and we cannot go to a hash location and then window.reload + // because it will double load it. + // we will refresh and then navigate there. - let packageInstallData = localStorageService.get("packageInstallData"); - let packageUri = $routeParams.method; + let packageInstallData = localStorageService.get("packageInstallData"); + let packageUri = $routeParams.method; - if (packageInstallData) { - localStorageService.remove("packageInstallData"); + if (packageInstallData) { + localStorageService.remove("packageInstallData"); - if (packageInstallData.postInstallationPath) { - //navigate to the custom installer screen if set - $location.path(packageInstallData.postInstallationPath).search("packageId", packageInstallData.id); - return; - } + if (packageInstallData.postInstallationPath) { + //navigate to the custom installer screen if set + $location.path(packageInstallData.postInstallationPath).search("packageId", packageInstallData.id); + return; + } - //if it is "installed" then set the uri/path to that - if (packageInstallData === "installed") { - packageUri = "installed"; - } - } - - var vm = this; - vm.page = {}; - vm.page.labels = {}; - vm.page.name = ""; - vm.page.navigation = []; - - onInit(); - - function onInit() { - - loadNavigation(); - - setPageName(); - } - - function loadNavigation() { - - var labels = ["sections_packages", "packager_installed", "packager_installLocal", "packager_created"]; - - localizationService.localizeMany(labels).then(function (data) { - vm.page.labels.packages = data[0]; - vm.page.labels.installed = data[1]; - vm.page.labels.install = data[2]; - vm.page.labels.created = data[3]; - - vm.page.navigation = [ - { - "name": vm.page.labels.packages, - "icon": "icon-cloud", - "view": "views/packages/views/repo.html", - "active": !packageUri || packageUri === "repo", - "alias": "umbPackages", - "action": function () { - $location.path("/packages/packages/repo"); - } - }, - { - "name": vm.page.labels.installed, - "icon": "icon-box", - "view": "views/packages/views/installed.html", - "active": packageUri === "installed", - "alias": "umbInstalled", - "action": function () { - $location.path("/packages/packages/installed"); - } - }, - { - "name": vm.page.labels.created, - "icon": "icon-files", - "view": "views/packages/views/created.html", - "active": packageUri === "created", - "alias": "umbCreatedPackages", - "action": function () { - $location.path("/packages/packages/created"); - } - } - ]; - }); - } - - function setPageName() { - localizationService.localize("sections_packages").then(function (data) { - vm.page.name = data; - }) - } + //if it is "installed" then set the uri/path to that + if (packageInstallData === "installed") { + packageUri = "installed"; + } } - angular.module("umbraco").controller("Umbraco.Editors.Packages.OverviewController", PackagesOverviewController); + var vm = this; + vm.page = {}; + vm.page.labels = {}; + vm.page.name = ""; + vm.page.navigation = []; + + onInit(); + + function onInit() { + + loadNavigation(); + + setPageName(); + } + + function loadNavigation() { + + var labels = ["sections_marketplace", "packager_installed", "packager_installLocal", "packager_created"]; + + localizationService.localizeMany(labels).then(function (data) { + vm.page.labels.marketplace = data[0]; + vm.page.labels.installed = data[1]; + vm.page.labels.install = data[2]; + vm.page.labels.created = data[3]; + + vm.page.navigation = [ + { + "name": vm.page.labels.marketplace, + "icon": "icon-cloud", + "view": "views/packages/views/marketplace.html", + "active": !packageUri || packageUri === "repo", + "alias": "umbMarketplace", + "action": function () { + $location.path("/packages/packages/repo"); + } + }, + { + "name": vm.page.labels.installed, + "icon": "icon-box", + "view": "views/packages/views/installed.html", + "active": packageUri === "installed", + "alias": "umbInstalled", + "action": function () { + $location.path("/packages/packages/installed"); + } + }, + { + "name": vm.page.labels.created, + "icon": "icon-files", + "view": "views/packages/views/created.html", + "active": packageUri === "created", + "alias": "umbCreatedPackages", + "action": function () { + $location.path("/packages/packages/created"); + } + } + ]; + }); + } + + function setPageName() { + localizationService.localize("sections_marketplace").then(function (data) { + vm.page.name = data; + }) + } + } + + angular.module("umbraco").controller("Umbraco.Editors.Packages.OverviewController", PackagesOverviewController); })(); diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/views/marketplace.controller.js b/src/Umbraco.Web.UI.Client/src/views/packages/views/marketplace.controller.js new file mode 100644 index 0000000000..f2a4deb2c1 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/packages/views/marketplace.controller.js @@ -0,0 +1,18 @@ +(function () { + "use strict"; + + function MarketplaceController($sce) { + + var vm = this; + var marketplaceUrl = new URL(Umbraco.Sys.ServerVariables.umbracoUrls.marketplaceUrl); + + function init() { + vm.marketplaceUrl = $sce.trustAsResourceUrl(marketplaceUrl.toString()); + } + + init(); + } + + angular.module("umbraco").controller("Umbraco.Editors.Packages.MarketplaceController", MarketplaceController); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/views/marketplace.html b/src/Umbraco.Web.UI.Client/src/views/packages/views/marketplace.html new file mode 100644 index 0000000000..95a28061b4 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/packages/views/marketplace.html @@ -0,0 +1,13 @@ + + + diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.controller.js b/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.controller.js index 0c7a2bd91c..84de562cb9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.controller.js @@ -1,265 +1,265 @@ (function () { - "use strict"; + "use strict"; - function PackagesRepoController($scope, $timeout, ourPackageRepositoryResource, $q, localizationService, notificationsService) { + function PackagesRepoController($scope, $timeout, ourPackageRepositoryResource, $q, localizationService, notificationsService) { - var vm = this; + var vm = this; - vm.packageViewState = "packageList"; - vm.categories = []; - vm.loading = true; - vm.pagination = { - pageNumber: 1, - totalPages: 10, - pageSize: 24 - }; - vm.searchQuery = ""; - vm.selectCategory = selectCategory; - vm.showPackageDetails = showPackageDetails; - vm.setPackageViewState = setPackageViewState; - vm.nextPage = nextPage; - vm.prevPage = prevPage; - vm.goToPage = goToPage; - vm.openLightbox = openLightbox; - vm.closeLightbox = closeLightbox; - vm.search = search; - vm.installCompleted = false; - vm.highlightedPackageCollections = []; - vm.labels = {}; + vm.packageViewState = "packageList"; + vm.categories = []; + vm.loading = true; + vm.pagination = { + pageNumber: 1, + totalPages: 10, + pageSize: 24 + }; + vm.searchQuery = ""; + vm.selectCategory = selectCategory; + vm.showPackageDetails = showPackageDetails; + vm.setPackageViewState = setPackageViewState; + vm.nextPage = nextPage; + vm.prevPage = prevPage; + vm.goToPage = goToPage; + vm.openLightbox = openLightbox; + vm.closeLightbox = closeLightbox; + vm.search = search; + vm.installCompleted = false; + vm.highlightedPackageCollections = []; + vm.labels = {}; - var defaultSort = "Latest"; - var currSort = defaultSort; + var defaultSort = "Latest"; + var currSort = defaultSort; - //used to cancel any request in progress if another one needs to take it's place - var canceler = null; + //used to cancel any request in progress if another one needs to take it's place + var canceler = null; - function getActiveCategory() { - if (vm.searchQuery !== "") { - return ""; - } - for (var i = 0; i < vm.categories.length; i++) { - if (vm.categories[i].active === true) { - return vm.categories[i].name; - } - } - return ""; + function getActiveCategory() { + if (vm.searchQuery !== "") { + return ""; + } + for (var i = 0; i < vm.categories.length; i++) { + if (vm.categories[i].active === true) { + return vm.categories[i].name; } - - function init() { - - vm.loading = true; - localizationService.localizeMany(["packager_packagesPopular", "packager_packagesPromoted"]) - .then(function (labels) { - vm.labels.popularPackages = labels[0]; - vm.labels.promotedPackages = labels[1]; - - var popularPackages, promotedPackages; - $q.all([ - ourPackageRepositoryResource.getCategories() - .then(function (cats) { - vm.categories = cats.filter(function (cat) { - return cat.name !== "Umbraco Pro"; - }); - }), - ourPackageRepositoryResource.getPopular(10) - .then(function (pack) { - popularPackages = { title: vm.labels.popularPackages, packages: pack.packages }; - }), - ourPackageRepositoryResource.getPromoted(20) - .then(function (pack) { - promotedPackages = { title: vm.labels.promotedPackages, packages: pack.packages }; - }), - ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, vm.pagination.pageSize, currSort) - .then(function (pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - }) - ]) - .then(function () { - vm.highlightedPackageCollections = [popularPackages, promotedPackages]; - vm.loading = false; - }); - }); - } - - function selectCategory(selectedCategory, categories) { - - for (var i = 0; i < categories.length; i++) { - var category = categories[i]; - if (category.name === selectedCategory.name) { - //it's already selected, let's unselect to show all again - if (category.active === true) { - category.active = false; - } - else { - category.active = true; - } - } - else { - category.active = false; - } - } - - vm.loading = true; - vm.searchQuery = ""; - - var reset = selectedCategory.active === false; - var searchCategory = reset ? "" : selectedCategory.name; - - currSort = defaultSort; - - var popularPackages, promotedPackages; - $q.all([ - ourPackageRepositoryResource.getPopular(10, searchCategory) - .then(function (pack) { - popularPackages = { title: vm.labels.popularPackages, packages: pack.packages }; - }), - ourPackageRepositoryResource.getPromoted(20, searchCategory) - .then(function (pack) { - promotedPackages = { title: vm.labels.promotedPackages, packages: pack.packages }; - }), - ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, vm.pagination.pageSize, currSort, searchCategory, vm.searchQuery) - .then(function (pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - vm.pagination.pageNumber = 1; - }) - ]) - .then(function () { - vm.highlightedPackageCollections = [popularPackages, promotedPackages]; - vm.loading = false; - }); - } - - function showPackageDetails(selectedPackage) { - ourPackageRepositoryResource.getDetails(selectedPackage.id) - .then(function (pack) { - vm.package = pack; - vm.packageViewState = "packageDetails"; - }); - } - - function setPackageViewState(state) { - if (state) { - vm.packageViewState = state; - } - } - - function nextPage(pageNumber) { - ourPackageRepositoryResource.search(pageNumber - 1, vm.pagination.pageSize, currSort, getActiveCategory(), vm.searchQuery) - .then(function (pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - }); - } - - function prevPage(pageNumber) { - ourPackageRepositoryResource.search(pageNumber - 1, vm.pagination.pageSize, currSort, getActiveCategory(), vm.searchQuery) - .then(function (pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - }); - } - - function goToPage(pageNumber) { - ourPackageRepositoryResource.search(pageNumber - 1, vm.pagination.pageSize, currSort, getActiveCategory(), vm.searchQuery) - .then(function (pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - }); - } - var previousElement = null; - - function openLightbox(itemIndex, items) { - - previousElement = ( document.activeElement || document.body ); - - vm.lightbox = { - show: true, - items: items, - activeIndex: itemIndex, - focus: true - }; - } - - function closeLightbox() { - vm.lightbox.show = false; - vm.lightbox = null; - - if(previousElement){ - setTimeout(function(){ - previousElement.focus(); - previousElement = null; - }, 100) - } - document.activeElement.blur(); - } - - - var searchDebounced = _.debounce(function (e) { - //a canceler exists, so perform the cancelation operation and reset - if (canceler) { - canceler.resolve(); - } - - canceler = $q.defer(); - - $scope.$apply(function () { - currSort = vm.searchQuery ? "Default" : "Latest"; - - ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, - vm.pagination.pageSize, - currSort, - "", - vm.searchQuery, - canceler.promise) - .then(function (pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - vm.pagination.pageNumber = 1; - vm.loading = false; - //set back to null so it can be re-created - canceler = null; - }) - .catch(function (err) { - canceler = null; - - if (err) { - // If an abort happened, ignore it since it happened because of a new search - if (err.xhrStatus === 'abort') { - return; - } - - // Otherwise, show the error - if (err.errorMsg) { - notificationsService.error(err.errorMsg); - return; - } - } - - console.error(err); - }); - - }); - - }, 200); - - function search(searchQuery) { - vm.loading = true; - searchDebounced(); - } - - vm.reloadPage = function () { - //reload on next digest (after cookie) - $timeout(function () { - window.location.reload(true); - }); - } - - init(); - + } + return ""; } - angular.module("umbraco").controller("Umbraco.Editors.Packages.RepoController", PackagesRepoController); + function init() { + + vm.loading = true; + localizationService.localizeMany(["packager_packagesPopular", "packager_packagesPromoted"]) + .then(function (labels) { + vm.labels.popularPackages = labels[0]; + vm.labels.promotedPackages = labels[1]; + + var popularPackages, promotedPackages; + $q.all([ + ourPackageRepositoryResource.getCategories() + .then(function (cats) { + vm.categories = cats.filter(function (cat) { + return cat.name !== "Umbraco Pro"; + }); + }), + ourPackageRepositoryResource.getPopular(10) + .then(function (pack) { + popularPackages = { title: vm.labels.popularPackages, packages: pack.packages }; + }), + ourPackageRepositoryResource.getPromoted(20) + .then(function (pack) { + promotedPackages = { title: vm.labels.promotedPackages, packages: pack.packages }; + }), + ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, vm.pagination.pageSize, currSort) + .then(function (pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + }) + ]) + .then(function () { + vm.highlightedPackageCollections = [popularPackages, promotedPackages]; + vm.loading = false; + }); + }); + } + + function selectCategory(selectedCategory, categories) { + + for (var i = 0; i < categories.length; i++) { + var category = categories[i]; + if (category.name === selectedCategory.name) { + //it's already selected, let's unselect to show all again + if (category.active === true) { + category.active = false; + } + else { + category.active = true; + } + } + else { + category.active = false; + } + } + + vm.loading = true; + vm.searchQuery = ""; + + var reset = selectedCategory.active === false; + var searchCategory = reset ? "" : selectedCategory.name; + + currSort = defaultSort; + + var popularPackages, promotedPackages; + $q.all([ + ourPackageRepositoryResource.getPopular(10, searchCategory) + .then(function (pack) { + popularPackages = { title: vm.labels.popularPackages, packages: pack.packages }; + }), + ourPackageRepositoryResource.getPromoted(20, searchCategory) + .then(function (pack) { + promotedPackages = { title: vm.labels.promotedPackages, packages: pack.packages }; + }), + ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, vm.pagination.pageSize, currSort, searchCategory, vm.searchQuery) + .then(function (pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + vm.pagination.pageNumber = 1; + }) + ]) + .then(function () { + vm.highlightedPackageCollections = [popularPackages, promotedPackages]; + vm.loading = false; + }); + } + + function showPackageDetails(selectedPackage) { + ourPackageRepositoryResource.getDetails(selectedPackage.id) + .then(function (pack) { + vm.package = pack; + vm.packageViewState = "packageDetails"; + }); + } + + function setPackageViewState(state) { + if (state) { + vm.packageViewState = state; + } + } + + function nextPage(pageNumber) { + ourPackageRepositoryResource.search(pageNumber - 1, vm.pagination.pageSize, currSort, getActiveCategory(), vm.searchQuery) + .then(function (pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + }); + } + + function prevPage(pageNumber) { + ourPackageRepositoryResource.search(pageNumber - 1, vm.pagination.pageSize, currSort, getActiveCategory(), vm.searchQuery) + .then(function (pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + }); + } + + function goToPage(pageNumber) { + ourPackageRepositoryResource.search(pageNumber - 1, vm.pagination.pageSize, currSort, getActiveCategory(), vm.searchQuery) + .then(function (pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + }); + } + var previousElement = null; + + function openLightbox(itemIndex, items) { + + previousElement = ( document.activeElement || document.body ); + + vm.lightbox = { + show: true, + items: items, + activeIndex: itemIndex, + focus: true + }; + } + + function closeLightbox() { + vm.lightbox.show = false; + vm.lightbox = null; + + if(previousElement){ + setTimeout(function(){ + previousElement.focus(); + previousElement = null; + }, 100) + } + document.activeElement.blur(); + } + + + var searchDebounced = _.debounce(function (e) { + //a canceler exists, so perform the cancelation operation and reset + if (canceler) { + canceler.resolve(); + } + + canceler = $q.defer(); + + $scope.$apply(function () { + currSort = vm.searchQuery ? "Default" : "Latest"; + + ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, + vm.pagination.pageSize, + currSort, + "", + vm.searchQuery, + canceler.promise) + .then(function (pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + vm.pagination.pageNumber = 1; + vm.loading = false; + //set back to null so it can be re-created + canceler = null; + }) + .catch(function (err) { + canceler = null; + + if (err) { + // If an abort happened, ignore it since it happened because of a new search + if (err.xhrStatus === 'abort') { + return; + } + + // Otherwise, show the error + if (err.errorMsg) { + notificationsService.error(err.errorMsg); + return; + } + } + + console.error(err); + }); + + }); + + }, 200); + + function search(searchQuery) { + vm.loading = true; + searchDebounced(); + } + + vm.reloadPage = function () { + //reload on next digest (after cookie) + $timeout(function () { + window.location.reload(true); + }); + } + + init(); + + } + + angular.module("umbraco").controller("Umbraco.Editors.Packages.RepoController", PackagesRepoController); })(); diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html b/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html index 3d8a6f0b29..fe386a9550 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html +++ b/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html @@ -1,318 +1,318 @@ - + - - - - - - - Search for packages - - - - - - - - - {{category.name}} - - - - - - - - - {{highlightedPackageCollection.title}} - - - - - - - - - - - - {{package.name}} - {{package.excerpt | limitTo: 40}}... - - - - - {{package.downloads}} - - - - {{package.likes}} - - - - - - Verified to work on Umbraco Cloud - - - - - - - - - - - - - - - - New Releases - Results for '{{ vm.searchQuery }}' - - - - - - - - - - - - - {{ package.name }} - {{ package.excerpt | limitTo: 40 }}... - - - - - {{package.downloads}} - - - - {{package.likes}} - - - - - - Verified to work on Umbraco Cloud - - - - - - - - - - - - - - - - - - - - - - We couldn't find anything for '{{ vm.searchQuery }}' - Please try searching for another package or browse through the categories. - - - - Sorry, we can not find what you are looking for. - Please try searching for another package or browse through the categories. - - - + + + + + + Search for packages + + + + + + + {{category.name}} + + + - - + - - - ← Back - - + + + {{highlightedPackageCollection.title}} + - + + - + + + + - + + {{package.name}} + {{package.excerpt | limitTo: 40}}... - - - {{ vm.package.name }} - - - - - - - - - - - - - - - - - - - - - Install Instructions - - dotnet add package {{vm.package.nuGetPackageId}} + + + + {{package.downloads}} + + + + {{package.likes}} + + + + + + Verified to work on Umbraco Cloud - - - - - - - - - - - - - - {{ vm.package.ownerInfo.owner }} - - {{ vm.package.ownerInfo.owner }} has {{ vm.package.ownerInfo.karma }} karma points - - - - - - - - - Information - - - - Owner: - {{vm.package.ownerInfo.owner}} - - - - Contributors: - - {{ contributor }}, - - - - - Created: - {{vm.package.created | date:'yyyy-MM-dd HH:mm:ss'}} - - - - Current version: - {{vm.package.latestVersion}} - - - - .NET Version: - {{vm.package.information.netVersion}} - - - - License: - {{vm.package.licenseName}} - - - - Downloads: - {{vm.package.downloads}} - - - - Likes: - {{vm.package.likes}} - - - - Verified to work on Umbraco CLoud - - - - - - - - - Compatibility - This package is compatible with the following versions of Umbraco, as reported by community members. Full compatability cannot be guaranteed for versions reported below 100% - - - {{compatibility.version}} - ({{compatibility.percentage}}%) - - - - - - - - - - External sources - - - - - {{externalSource.name}} - - - - - + + - + + + + + + + + + New Releases + Results for '{{ vm.searchQuery }}' + + + + + + + + + + + + + {{ package.name }} + {{ package.excerpt | limitTo: 40 }}... + + + + + {{package.downloads}} + + + + {{package.likes}} + + + + + + Verified to work on Umbraco Cloud + + + + + + + + + + + + + + + + + + + + + + We couldn't find anything for '{{ vm.searchQuery }}' + Please try searching for another package or browse through the categories. + + + + Sorry, we can not find what you are looking for. + Please try searching for another package or browse through the categories. + + + + + + + + + + + ← Back + + + + + + + + + + + + {{ vm.package.name }} + + + + + + + + + + + + + + + + + + + + + Install Instructions + + dotnet add package {{vm.package.nuGetPackageId}} + + + + + + + + + + + + + + + {{ vm.package.ownerInfo.owner }} + + {{ vm.package.ownerInfo.owner }} has {{ vm.package.ownerInfo.karma }} karma points + + + + + + + + + Information + + + + Owner: + {{vm.package.ownerInfo.owner}} + + + + Contributors: + + {{ contributor }}, + + + + + Created: + {{vm.package.created | date:'yyyy-MM-dd HH:mm:ss'}} + + + + Current version: + {{vm.package.latestVersion}} + + + + .NET Version: + {{vm.package.information.netVersion}} + + + + License: + {{vm.package.licenseName}} + + + + Downloads: + {{vm.package.downloads}} + + + + Likes: + {{vm.package.likes}} + + + + Verified to work on Umbraco CLoud + + + + + + + + + Compatibility + This package is compatible with the following versions of Umbraco, as reported by community members. Full compatability cannot be guaranteed for versions reported below 100% + + + {{compatibility.version}} + ({{compatibility.percentage}}%) + + + + + + + + + + External sources + + + + + {{externalSource.name}} + + + + + + + + + + + + diff --git a/src/Umbraco.Web.UI.Client/src/views/relationTypes/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/relationTypes/edit.controller.js index 1f0c054257..43f33e0d32 100644 --- a/src/Umbraco.Web.UI.Client/src/views/relationTypes/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/relationTypes/edit.controller.js @@ -54,14 +54,7 @@ function RelationTypeEditController($scope, $routeParams, relationTypeResource, }); // load references when the 'relations' tab is first activated/switched to - var appTabChange = eventsService.on("app.tabChange", function (event, args) { - if (args.alias === "relations") { - loadRelations(); - } - }); - $scope.$on('$destroy', function () { - appTabChange(); - }); + loadRelations(); // Inital page/overview API call of relation type relationTypeResource.getById($routeParams.id)
Please try searching for another package or browse through the categories.