Gets data type folders working/creating, data types being able to be created in folders, tree syncing with data type paths, fixes up some localization stuff and fixes up some issues with media type folders with parent ids
This commit is contained in:
@@ -49,8 +49,6 @@ namespace Umbraco.Core.Models
|
||||
_additionalData = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
[Obsolete("Don't use this, parentId is always -1 for data types")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public DataTypeDefinition(int parentId, string propertyEditorAlias)
|
||||
{
|
||||
_parentId = parentId;
|
||||
|
||||
@@ -181,13 +181,13 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
* @returns {Promise} resourcePromise object containing the data type scaffold.
|
||||
*
|
||||
*/
|
||||
getScaffold: function () {
|
||||
getScaffold: function (parentId) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dataTypeApiBaseUrl",
|
||||
"GetEmpty")),
|
||||
"GetEmpty", { parentId: parentId })),
|
||||
"Failed to retrieve data for empty datatype");
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -108,7 +108,7 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
|
||||
* @param {String} source The URL to load into the iframe
|
||||
*/
|
||||
loadLegacyIFrame: function (source) {
|
||||
$location.path("/" + appState.getSectionState("currentSection") + "/framed/" + encodeURIComponent(source));
|
||||
$location.path("/" + appState.getSectionState("currentSection").toLowerCase() + "/framed/" + encodeURIComponent(source));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
|
||||
appState.setSectionState("currentSection", sectionAlias);
|
||||
this.showTree(sectionAlias);
|
||||
|
||||
$location.path(sectionAlias);
|
||||
$location.path(sectionAlias.toLowerCase());
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -250,10 +250,10 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
|
||||
appState.setMenuState("currentNode", args.node);
|
||||
|
||||
//not legacy, lets just set the route value and clear the query string if there is one.
|
||||
$location.path(n.routePath).search("");
|
||||
$location.path(n.routePath.toLowerCase()).search("");
|
||||
}
|
||||
else if (args.element.section) {
|
||||
$location.path(args.element.section).search("");
|
||||
$location.path(args.element.section.toLowerCase()).search("");
|
||||
}
|
||||
|
||||
service.hideNavigation();
|
||||
@@ -446,7 +446,7 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
|
||||
if (action.metaData && action.metaData["actionRoute"] && angular.isString(action.metaData["actionRoute"])) {
|
||||
//first check if the menu item simply navigates to a route
|
||||
var parts = action.metaData["actionRoute"].split("?");
|
||||
$location.path(parts[0]).search(parts.length > 1 ? parts[1] : "");
|
||||
$location.path(parts[0].toLowerCase()).search(parts.length > 1 ? parts[1] : "");
|
||||
this.hideNavigation();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ function umbDataFormatter() {
|
||||
/** formats the display model used to display the data type to the model used to save the data type */
|
||||
formatDataTypePostData: function(displayModel, preValues, action) {
|
||||
var saveModel = {
|
||||
parentId: -1,
|
||||
parentId: displayModel.parentId,
|
||||
id: displayModel.id,
|
||||
name: displayModel.name,
|
||||
selectedEditor: displayModel.selectedEditor,
|
||||
|
||||
@@ -40,7 +40,7 @@ function DataTypeCreateController($scope, $location, navigationService, dataType
|
||||
|
||||
$scope.createDataType = function() {
|
||||
$location.search('create', null);
|
||||
$location.path("/settings/datatype/edit/" + node.id).search("create", "true");
|
||||
$location.path("/developer/datatypes/edit/" + node.id).search("create", "true");
|
||||
navigationService.hideMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<li>
|
||||
<a href="" ng-click="createDataType()">
|
||||
|
||||
<i class="large icon-item-arrangement"></i>
|
||||
<i class="large icon-autofill"></i>
|
||||
|
||||
<span class="menu-label">
|
||||
<localize key="general_new">New</localize> Data type
|
||||
|
||||
@@ -25,6 +25,23 @@ function DataTypeDeleteController($scope, dataTypeResource, treeService, navigat
|
||||
|
||||
};
|
||||
|
||||
$scope.performContainerDelete = function () {
|
||||
|
||||
//mark it for deletion (used in the UI)
|
||||
$scope.currentNode.loading = true;
|
||||
dataTypeResource.deleteContainerById($scope.currentNode.id).then(function () {
|
||||
$scope.currentNode.loading = false;
|
||||
|
||||
//get the root node before we remove it
|
||||
var rootNode = treeService.getTreeRoot($scope.currentNode);
|
||||
|
||||
//TODO: Need to sync tree, etc...
|
||||
treeService.removeNode($scope.currentNode);
|
||||
navigationService.hideMenu();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
navigationService.hideDialog();
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
|
||||
$scope.page.loading = true;
|
||||
|
||||
//we are creating so get an empty data type item
|
||||
dataTypeResource.getScaffold()
|
||||
dataTypeResource.getScaffold($routeParams.id)
|
||||
.then(function(data) {
|
||||
|
||||
$scope.preValuesLoaded = true;
|
||||
@@ -91,7 +91,7 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
|
||||
// if there are any and then clear them so the collection no longer persists them.
|
||||
serverValidationManager.executeAndClearAllSubscriptions();
|
||||
|
||||
navigationService.syncTree({ tree: "datatypes", path: [String(data.id)] }).then(function (syncArgs) {
|
||||
navigationService.syncTree({ tree: "datatypes", path: data.path }).then(function (syncArgs) {
|
||||
$scope.page.menu.currentNode = syncArgs.node;
|
||||
});
|
||||
|
||||
@@ -152,7 +152,7 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
|
||||
//share state
|
||||
editorState.set($scope.content);
|
||||
|
||||
navigationService.syncTree({ tree: "datatypes", path: [String(data.id)], forceReload: true }).then(function (syncArgs) {
|
||||
navigationService.syncTree({ tree: "datatypes", path: data.path, forceReload: true }).then(function (syncArgs) {
|
||||
$scope.page.menu.currentNode = syncArgs.node;
|
||||
});
|
||||
|
||||
|
||||
@@ -2,11 +2,35 @@
|
||||
<div class="umb-dialog-body">
|
||||
|
||||
<p class="umb-abstract">
|
||||
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong> ?
|
||||
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong> ?
|
||||
</p>
|
||||
|
||||
<umb-confirm on-confirm="performDelete" on-cancel="cancel">
|
||||
</umb-confirm>
|
||||
<ng-switch on="currentNode.nodeType">
|
||||
<div ng-switch-when="container">
|
||||
<p>Any item that exists in this folder will be moved to the parent folder</p>
|
||||
|
||||
<umb-confirm on-confirm="performContainerDelete"
|
||||
on-cancel="cancel">
|
||||
</umb-confirm>
|
||||
</div>
|
||||
|
||||
<div ng-switch-default>
|
||||
<p>
|
||||
<i class="icon-alert red"></i> <strong class="red">All property types & property data</strong>
|
||||
using this data type will be deleted permanently, please confirm you want to delete these as well.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" ng-model="confirmed" />
|
||||
Yes, delete {{currentNode.name}} and all property types & property data using this data type
|
||||
</label>
|
||||
|
||||
<umb-confirm ng-if="confirmed" on-confirm="performDelete" on-cancel="cancel">
|
||||
</umb-confirm>
|
||||
</div>
|
||||
</ng-switch>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<div class="umb-dialog-body">
|
||||
|
||||
<p class="umb-abstract">
|
||||
Are you sure you want to delete <strong>{{currentNode.name}}</strong> ?
|
||||
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong> ?
|
||||
</p>
|
||||
|
||||
<ng-switch on="currentNode.nodeType">
|
||||
<div ng-switch-when="container">
|
||||
<p>This action cannot be undone, click ok to delete.</p>
|
||||
<p>Any item that exists in this folder will be moved to the parent folder</p>
|
||||
|
||||
<umb-confirm
|
||||
on-confirm="performContainerDelete"
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace Umbraco.Web.Editors
|
||||
return Request.CreateResponse(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
public DataTypeDisplay GetEmpty()
|
||||
public DataTypeDisplay GetEmpty(int parentId)
|
||||
{
|
||||
var dt = new DataTypeDefinition("");
|
||||
var dt = new DataTypeDefinition(parentId, "");
|
||||
return Mapper.Map<IDataTypeDefinition, DataTypeDisplay>(dt);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ namespace Umbraco.Web.Editors
|
||||
return Request.CreateResponse(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
public ContentTypeCompositionDisplay GetEmpty()
|
||||
public ContentTypeCompositionDisplay GetEmpty(int parentId)
|
||||
{
|
||||
var ct = new MediaType(-1);
|
||||
var ct = new MediaType(parentId);
|
||||
ct.Icon = "icon-picture";
|
||||
|
||||
var dto = Mapper.Map<IMediaType, ContentTypeCompositionDisplay>(ct);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -71,7 +70,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(x => x.Notifications, expression => expression.Ignore())
|
||||
.ForMember(x => x.Icon, expression => expression.Ignore())
|
||||
.ForMember(x => x.Alias, expression => expression.Ignore())
|
||||
.ForMember(x => x.Group, expression => expression.Ignore())
|
||||
.ForMember(x => x.Group, expression => expression.Ignore())
|
||||
.ForMember(x => x.IsSystemDataType, expression => expression.MapFrom(definition => systemIds.Contains(definition.Id)))
|
||||
.AfterMap((def, basic) =>
|
||||
{
|
||||
@@ -99,7 +98,6 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(definition => definition.Key, expression => expression.Ignore())
|
||||
.ForMember(definition => definition.Path, expression => expression.Ignore())
|
||||
.ForMember(definition => definition.PropertyEditorAlias, expression => expression.MapFrom(save => save.SelectedEditor))
|
||||
.ForMember(definition => definition.ParentId, expression => expression.MapFrom(save => -1))
|
||||
.ForMember(definition => definition.DatabaseType, expression => expression.ResolveUsing<DatabaseTypeResolver>())
|
||||
.ForMember(x => x.ControlId, expression => expression.Ignore())
|
||||
.ForMember(x => x.CreatorId, expression => expression.Ignore())
|
||||
|
||||
@@ -12,6 +12,7 @@ using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using umbraco;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Services;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
@@ -32,7 +33,7 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
//Folders first
|
||||
nodes.AddRange(
|
||||
Services.EntityService.GetChildren(intId.Result, UmbracoObjectTypes.MediaTypeContainer)
|
||||
Services.EntityService.GetChildren(intId.Result, UmbracoObjectTypes.DataTypeContainer)
|
||||
.OrderBy(entity => entity.Name)
|
||||
.Select(dt =>
|
||||
{
|
||||
@@ -46,10 +47,20 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
//Normal nodes
|
||||
var sysIds = GetSystemIds();
|
||||
|
||||
nodes.AddRange(
|
||||
Services.DataTypeService.GetAllDataTypeDefinitions()
|
||||
.OrderBy(x => x.Name)
|
||||
.Select(dt => CreateTreeNode(id, queryStrings, sysIds, dt)));
|
||||
Services.EntityService.GetChildren(intId.Result, UmbracoObjectTypes.DataType)
|
||||
.OrderBy(entity => entity.Name)
|
||||
.Select(dt =>
|
||||
{
|
||||
var node = CreateTreeNode(dt.Id.ToInvariantString(), id, queryStrings, dt.Name, "icon-autofill", false);
|
||||
node.Path = dt.Path;
|
||||
if (sysIds.Contains(dt.Id))
|
||||
{
|
||||
node.Icon = "icon-thumbnail-list";
|
||||
}
|
||||
return node;
|
||||
}));
|
||||
|
||||
return nodes;
|
||||
}
|
||||
@@ -64,25 +75,7 @@ namespace Umbraco.Web.Trees
|
||||
};
|
||||
return systemIds;
|
||||
}
|
||||
|
||||
private TreeNode CreateTreeNode(string id, FormDataCollection queryStrings, IEnumerable<int> systemIds, IDataTypeDefinition dt)
|
||||
{
|
||||
var node = CreateTreeNode(
|
||||
dt.Id.ToInvariantString(),
|
||||
id,
|
||||
queryStrings,
|
||||
dt.Name,
|
||||
"icon-autofill",
|
||||
false);
|
||||
|
||||
if (systemIds.Contains(dt.Id))
|
||||
{
|
||||
node.Icon = "icon-thumbnail-list";
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var menu = new MenuItemCollection();
|
||||
|
||||
Reference in New Issue
Block a user