Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fdcd6b542c | |||
| f5e8675c97 | |||
| 5f83a9f006 | |||
| 8b10808d40 | |||
| 5cffd43db0 | |||
| 0589a65281 | |||
| 4f6809173a | |||
| 591a4fbf1b | |||
| e0c4fc913b | |||
| 15468d3bdc | |||
| 4c1d3b4b27 |
@@ -637,4 +637,4 @@ namespace Umbraco.Core.Services
|
||||
public static event TypedEventHandler<IDataTypeService, MoveEventArgs<IDataTypeDefinition>> Moved;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String></wpf:ResourceDictionary>
|
||||
+684
-604
File diff suppressed because it is too large
Load Diff
@@ -357,16 +357,37 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
"PostCreateContainer",
|
||||
{ parentId: parentId, name: name })),
|
||||
'Failed to create a folder under parent id ' + parentId);
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
renameContainer: function (id, name) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post
|
||||
(umbRequestHelper.getApiUrl(
|
||||
$http.post
|
||||
(umbRequestHelper.getApiUrl(
|
||||
"dataTypeApiBaseUrl",
|
||||
"PostRenameContainer",
|
||||
{ id: id, name: name })),
|
||||
"Failed to rename the folder with id " + id);
|
||||
},
|
||||
|
||||
getContainer: function (name) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dataTypeApiBaseUrl",
|
||||
"GetContainer",
|
||||
{ name: name })),
|
||||
'No container found with name: ' + name);
|
||||
|
||||
},
|
||||
|
||||
containerExist: function (name) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dataTypeApiBaseUrl",
|
||||
"ContainerExist",
|
||||
{ name: name })));
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -223,16 +223,14 @@ input.umb-group-builder__group-title-input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.umb-group-builder__property-meta-alias {
|
||||
font-size: 10px;
|
||||
color: @gray-3;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 5px;
|
||||
.umb-group-builder__property-meta .umb-locked-field__input {
|
||||
font-size: 12px !important;
|
||||
word-break: break-word;
|
||||
margin-bottom: 2px !important;
|
||||
}
|
||||
|
||||
.umb-group-builder__property-meta-label textarea {
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0;
|
||||
color: @gray-1;
|
||||
|
||||
+51
-23
@@ -7,7 +7,7 @@
|
||||
* The controller for the content type editor property dialog
|
||||
*/
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function EditorPickerOverlay($scope, dataTypeResource, dataTypeHelper, contentTypeResource, localizationService) {
|
||||
@@ -24,6 +24,7 @@
|
||||
vm.typesAndEditors = [];
|
||||
vm.userConfigured = [];
|
||||
vm.loading = false;
|
||||
vm.property = $scope.model.property;
|
||||
vm.tabs = [{
|
||||
active: true,
|
||||
id: 1,
|
||||
@@ -55,7 +56,7 @@
|
||||
|
||||
vm.loading = true;
|
||||
|
||||
dataTypeResource.getGroupedPropertyEditors().then(function(data) {
|
||||
dataTypeResource.getGroupedPropertyEditors().then(function (data) {
|
||||
vm.tabs[0].typesAndEditors = data;
|
||||
vm.typesAndEditors = data;
|
||||
vm.tabsLoaded = vm.tabsLoaded + 1;
|
||||
@@ -68,7 +69,7 @@
|
||||
|
||||
vm.loading = true;
|
||||
|
||||
dataTypeResource.getGroupedDataTypes().then(function(data) {
|
||||
dataTypeResource.getGroupedDataTypes().then(function (data) {
|
||||
vm.tabs[1].userConfigured = data;
|
||||
vm.userConfigured = data;
|
||||
vm.tabsLoaded = vm.tabsLoaded + 1;
|
||||
@@ -116,7 +117,7 @@
|
||||
|
||||
var parentId = -1;
|
||||
|
||||
dataTypeResource.getScaffold(parentId).then(function(dataType) {
|
||||
dataTypeResource.getScaffold(parentId).then(function (dataType) {
|
||||
|
||||
// set alias
|
||||
dataType.selectedEditor = editor.alias;
|
||||
@@ -124,7 +125,11 @@
|
||||
// set name
|
||||
var nameArray = [];
|
||||
|
||||
// content type name (if you add properties before filling out a name for the content type, we need a temp name)
|
||||
var contentTypeName = "Unnamed Content Type";
|
||||
|
||||
if ($scope.model.contentTypeName) {
|
||||
contentTypeName = $scope.model.contentTypeName;
|
||||
nameArray.push($scope.model.contentTypeName);
|
||||
}
|
||||
|
||||
@@ -138,13 +143,48 @@
|
||||
|
||||
// make name
|
||||
dataType.name = nameArray.join(" - ");
|
||||
dataType.containerName = contentTypeName;
|
||||
|
||||
// get pre values
|
||||
dataTypeResource.getPreValues(dataType.selectedEditor).then(function(preValues) {
|
||||
dataTypeResource.getPreValues(dataType.selectedEditor).then(function (preValues) {
|
||||
// if there's any configuration settings then open the dialog, else just save the editor immediately
|
||||
if (preValues.length > 0) {
|
||||
dataType.preValues = preValues;
|
||||
openEditorSettingsOverlay(dataType, true);
|
||||
} else {
|
||||
saveDataTypeWithContainerCheck(dataType.containerName, dataType, preValues, true);
|
||||
}
|
||||
});
|
||||
|
||||
dataType.preValues = preValues;
|
||||
});
|
||||
|
||||
openEditorSettingsOverlay(dataType, true);
|
||||
}
|
||||
|
||||
function saveDataTypeWithContainerCheck(containerName, dataType, preValues, isNew) {
|
||||
// check if a container for the doctype already exist
|
||||
dataTypeResource.containerExist(containerName).then(function (container) {
|
||||
if (container == "true") {
|
||||
dataTypeResource.getContainer(containerName).then(
|
||||
function (container) {
|
||||
dataType.parentId = container.Id;
|
||||
saveDataType(dataType, preValues, isNew);
|
||||
});
|
||||
} else {
|
||||
dataTypeResource.createContainer(-1, containerName).then(
|
||||
function (container) {
|
||||
dataType.parentId = container.Entity.Id;
|
||||
saveDataType(dataType, preValues, isNew);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveDataType(dataType, preValues, isNew) {
|
||||
dataTypeResource.save(dataType, preValues, isNew).then(function (newDataType) {
|
||||
|
||||
contentTypeResource.getPropertyTypeScaffold(newDataType.id).then(function (propertyType) {
|
||||
|
||||
submitOverlay(newDataType, propertyType, true);
|
||||
|
||||
});
|
||||
|
||||
@@ -154,8 +194,8 @@
|
||||
|
||||
function pickDataType(selectedDataType) {
|
||||
|
||||
dataTypeResource.getById(selectedDataType.id).then(function(dataType) {
|
||||
contentTypeResource.getPropertyTypeScaffold(dataType.id).then(function(propertyType) {
|
||||
dataTypeResource.getById(selectedDataType.id).then(function (dataType) {
|
||||
contentTypeResource.getPropertyTypeScaffold(dataType.id).then(function (propertyType) {
|
||||
submitOverlay(dataType, propertyType, false);
|
||||
});
|
||||
});
|
||||
@@ -168,21 +208,9 @@
|
||||
dataType: dataType,
|
||||
view: "views/common/overlays/contenttypeeditor/editorsettings/editorsettings.html",
|
||||
show: true,
|
||||
submit: function(model) {
|
||||
submit: function (model) {
|
||||
var preValues = dataTypeHelper.createPreValueProps(model.dataType.preValues);
|
||||
|
||||
dataTypeResource.save(model.dataType, preValues, isNew).then(function(newDataType) {
|
||||
|
||||
contentTypeResource.getPropertyTypeScaffold(newDataType.id).then(function(propertyType) {
|
||||
|
||||
submitOverlay(newDataType, propertyType, true);
|
||||
|
||||
vm.editorSettingsOverlay.show = false;
|
||||
vm.editorSettingsOverlay = null;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
saveDataTypeWithContainerCheck(dataType.containerName, dataType, preValues, isNew);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-12
@@ -4,18 +4,7 @@
|
||||
<i class="icon-alert red"></i>
|
||||
<strong class="red"><localize key="contentTypeEditor_allDocumentTypes"></localize></strong> using this editor will get updated with the new settings.
|
||||
</div>
|
||||
|
||||
<div class="control-group umb-control-group">
|
||||
<div class="umb-el-wrap">
|
||||
<label class="control-label" for="dataTypeName">
|
||||
<localize key="name"></localize>
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" ng-model="model.dataType.name" class="umb-editor" umb-auto-focus focus-on-filled="true" required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h5><localize key="contentTypeEditor_configuration"></localize></h5>
|
||||
|
||||
<umb-property property="preValue" ng-repeat="preValue in model.dataType.preValues">
|
||||
|
||||
+5
-1
@@ -110,7 +110,10 @@
|
||||
vm.editorSettingsOverlay.title = "Editor settings";
|
||||
vm.editorSettingsOverlay.view = "views/common/overlays/contenttypeeditor/editorsettings/editorsettings.html";
|
||||
vm.editorSettingsOverlay.dataType = dataType;
|
||||
vm.editorSettingsOverlay.show = true;
|
||||
|
||||
if (dataType.preValues.length > 0) {
|
||||
vm.editorSettingsOverlay.show = true;
|
||||
}
|
||||
|
||||
vm.editorSettingsOverlay.submit = function (model) {
|
||||
|
||||
@@ -150,6 +153,7 @@
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function matchValidationType() {
|
||||
|
||||
|
||||
-21
@@ -1,26 +1,5 @@
|
||||
<div class="content-type-editor-dialog edit-property-settings" ng-controller="Umbraco.Overlay.PropertySettingsOverlay as vm">
|
||||
|
||||
<div class="umb-control-group" ng-if="!model.property.locked">
|
||||
<div class="control-group">
|
||||
<textarea class="editor-label"
|
||||
data-element="property-name"
|
||||
name="propertyLabel"
|
||||
ng-model="model.property.label"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_entername"
|
||||
umb-auto-focus
|
||||
focus-on-filled="true"
|
||||
umb-auto-resize
|
||||
required
|
||||
overlay-submit-on-enter>
|
||||
</textarea>
|
||||
<div class="umb-validation-label" val-msg-for="propertyLabel" val-toggle-msg="required">Required label</div>
|
||||
</div>
|
||||
<div class="control-group -no-margin">
|
||||
<umb-generate-alias enable-lock="true" alias-from="model.property.label" alias="model.property.alias"></umb-generate-alias>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-control-group control-group">
|
||||
<textarea
|
||||
data-element="property-description"
|
||||
|
||||
@@ -4,24 +4,22 @@
|
||||
|
||||
<umb-editor-sub-header-content-right>
|
||||
|
||||
<umb-button
|
||||
alias="compositions"
|
||||
ng-if="compositions !== false"
|
||||
type="button"
|
||||
button-style="link"
|
||||
label-key="contentTypeEditor_compositions"
|
||||
icon="icon-merge"
|
||||
action="openCompositionsDialog()">
|
||||
<umb-button alias="compositions"
|
||||
ng-if="compositions !== false"
|
||||
type="button"
|
||||
button-style="link"
|
||||
label-key="contentTypeEditor_compositions"
|
||||
icon="icon-merge"
|
||||
action="openCompositionsDialog()">
|
||||
</umb-button>
|
||||
|
||||
<umb-button
|
||||
alias="reorder"
|
||||
ng-if="sorting !== false"
|
||||
type="button"
|
||||
button-style="link"
|
||||
label-key="{{sortingButtonKey}}"
|
||||
icon="icon-navigation"
|
||||
action="toggleSortingMode();">
|
||||
<umb-button alias="reorder"
|
||||
ng-if="sorting !== false"
|
||||
type="button"
|
||||
button-style="link"
|
||||
label-key="{{sortingButtonKey}}"
|
||||
icon="icon-navigation"
|
||||
action="toggleSortingMode();">
|
||||
</umb-button>
|
||||
|
||||
</umb-editor-sub-header-content-right>
|
||||
@@ -40,7 +38,7 @@
|
||||
<a href="" class="umb-group-builder__group -placeholder" hotkey="alt+shift+t" ng-click="addGroup(tab)" ng-if="tab.tabState=='init' && !sortingMode" data-element="group-add">
|
||||
|
||||
<div class="umb-group-builder__group-title-wrapper -placeholder">
|
||||
<div class="umb-group-builder__group-title -placeholder"></div>
|
||||
<div class="umb-group-builder__group-title -placeholder"></div>
|
||||
</div>
|
||||
|
||||
<localize ng-if="model.groups.length === 1" key="contentTypeEditor_addNewTab"></localize>
|
||||
@@ -53,11 +51,10 @@
|
||||
|
||||
<div class="umb-group-builder__group-remove" ng-if="!sortingMode && tab.properties.length <= 1">
|
||||
<i class="icon-trash" ng-click="togglePrompt(tab)"></i>
|
||||
<umb-confirm-action
|
||||
ng-if="tab.deletePrompt"
|
||||
direction="left"
|
||||
on-confirm="removeGroup($index)"
|
||||
on-cancel="hidePrompt(tab)">
|
||||
<umb-confirm-action ng-if="tab.deletePrompt"
|
||||
direction="left"
|
||||
on-confirm="removeGroup($index)"
|
||||
on-cancel="hidePrompt(tab)">
|
||||
</umb-confirm-action>
|
||||
</div>
|
||||
|
||||
@@ -114,15 +111,15 @@
|
||||
|
||||
<!-- Init property / Property placeholder / add new property -->
|
||||
<a href=""
|
||||
data-element="property-add"
|
||||
class="umb-group-builder__property -placeholder"
|
||||
ng-if="property.propertyState=='init' && !sortingMode"
|
||||
ng-class="{'-placeholder': property.propertyState=='init'}"
|
||||
hotkey="alt+shift+p"
|
||||
hotkey-when="{{tab.tabState === 'active' && property.propertyState=='init'}}"
|
||||
ng-click="addProperty(property, tab)"
|
||||
on-focus="activateGroup(tab)"
|
||||
focus-when="{{property.focus}}">
|
||||
data-element="property-add"
|
||||
class="umb-group-builder__property -placeholder"
|
||||
ng-if="property.propertyState=='init' && !sortingMode"
|
||||
ng-class="{'-placeholder': property.propertyState=='init'}"
|
||||
hotkey="alt+shift+p"
|
||||
hotkey-when="{{tab.tabState === 'active' && property.propertyState=='init'}}"
|
||||
ng-click="addProperty(property, tab)"
|
||||
on-focus="activateGroup(tab)"
|
||||
focus-when="{{property.focus}}">
|
||||
|
||||
<div class="umb-group-builder__property-meta">
|
||||
<div class="umb-group-builder__placeholder-box -input-small"></div>
|
||||
@@ -151,24 +148,25 @@
|
||||
<div class="control-group -no-margin" ng-if="!sortingMode">
|
||||
|
||||
<div class="umb-group-builder__property-meta-alias" ng-if="property.inherited || property.locked">{{ property.alias }}</div>
|
||||
<umb-locked-field
|
||||
ng-if="!property.inherited && !property.locked"
|
||||
locked="locked"
|
||||
ng-model="property.alias"
|
||||
placeholder-text="'Alias...'"
|
||||
server-validation-field="{{'Groups[' + $parent.$parent.$parent.$parent.$index + '].Properties[' + $index + '].Alias'}}">
|
||||
<umb-locked-field ng-if="!property.inherited && !property.locked"
|
||||
locked="locked"
|
||||
ng-model="property.alias"
|
||||
placeholder-text="'Alias...'"
|
||||
server-validation-field="{{'Groups[' + $parent.$parent.$parent.$parent.$index + '].Properties[' + $index + '].Alias'}}">
|
||||
</umb-locked-field>
|
||||
|
||||
<div class="umb-group-builder__property-meta-label">
|
||||
<textarea
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_label"
|
||||
ng-model="property.label"
|
||||
ng-disabled="property.inherited || property.locked"
|
||||
name="groupName"
|
||||
umb-auto-resize
|
||||
required
|
||||
val-server-field="{{'Groups[' + $parent.$parent.$parent.$parent.$index + '].Properties[' + $index + '].Label'}}">
|
||||
<textarea localize="placeholder"
|
||||
placeholder="@placeholders_label"
|
||||
ng-model="property.label"
|
||||
ng-disabled="property.inherited || property.locked"
|
||||
name="groupName"
|
||||
ng-change="updateAlias(property)"
|
||||
umb-auto-resize
|
||||
select-on-focus
|
||||
umb-select-when="{{property.tempAlias}}"
|
||||
required
|
||||
val-server-field="{{'Groups[' + $parent.$parent.$parent.$parent.$index + '].Properties[' + $index + '].Label'}}">
|
||||
</textarea>
|
||||
|
||||
<div class="umb-validation-label" val-msg-for="groupName" val-toggle-msg="valServerField"></div>
|
||||
@@ -176,12 +174,11 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-group-builder__property-meta-description">
|
||||
<textarea
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_enterDescription"
|
||||
ng-model="property.description"
|
||||
ng-disabled="property.inherited || property.locked"
|
||||
umb-auto-resize>
|
||||
<textarea localize="placeholder"
|
||||
placeholder="@placeholders_enterDescription"
|
||||
ng-model="property.description"
|
||||
ng-disabled="property.inherited || property.locked"
|
||||
umb-auto-resize>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
@@ -244,10 +241,9 @@
|
||||
</div>
|
||||
|
||||
<ng-form name="propertyEditorPreviewForm" umb-disable-form-validation>
|
||||
<umb-property-editor
|
||||
ng-if="property.view !== undefined"
|
||||
model="property"
|
||||
preview="true">
|
||||
<umb-property-editor ng-if="property.view !== undefined"
|
||||
model="property"
|
||||
preview="true">
|
||||
</umb-property-editor>
|
||||
</ng-form>
|
||||
|
||||
@@ -266,11 +262,10 @@
|
||||
<!-- delete property -->
|
||||
<div ng-if="!property.locked" class="umb-group-builder__property-action">
|
||||
<i class="icon-trash" ng-click="togglePrompt(property)"></i>
|
||||
<umb-confirm-action
|
||||
ng-if="property.deletePrompt"
|
||||
direction="left"
|
||||
on-confirm="deleteProperty(tab, $index)"
|
||||
on-cancel="hidePrompt(property)">
|
||||
<umb-confirm-action ng-if="property.deletePrompt"
|
||||
direction="left"
|
||||
on-confirm="deleteProperty(tab, $index)"
|
||||
on-cancel="hidePrompt(property)">
|
||||
</umb-confirm-action>
|
||||
</div>
|
||||
|
||||
@@ -292,20 +287,25 @@
|
||||
|
||||
</ul>
|
||||
|
||||
<umb-overlay
|
||||
data-element="overlay-compositions"
|
||||
ng-if="compositionsDialogModel.show"
|
||||
model="compositionsDialogModel"
|
||||
position="right"
|
||||
view="compositionsDialogModel.view">
|
||||
<umb-overlay data-element="overlay-compositions"
|
||||
ng-if="compositionsDialogModel.show"
|
||||
model="compositionsDialogModel"
|
||||
position="right"
|
||||
view="compositionsDialogModel.view">
|
||||
</umb-overlay>
|
||||
|
||||
<umb-overlay
|
||||
data-element="overlay-property-settings"
|
||||
ng-if="propertySettingsDialogModel.show"
|
||||
model="propertySettingsDialogModel"
|
||||
position="right"
|
||||
view="propertySettingsDialogModel.view">
|
||||
<umb-overlay data-element="overlay-property-settings"
|
||||
ng-if="propertySettingsDialogModel.show"
|
||||
model="propertySettingsDialogModel"
|
||||
position="right"
|
||||
view="propertySettingsDialogModel.view">
|
||||
</umb-overlay>
|
||||
|
||||
<umb-overlay data-element="overlay-editor-picker"
|
||||
ng-if="editorPickerOverlay.show"
|
||||
model="editorPickerOverlay"
|
||||
position="right"
|
||||
view="editorPickerOverlay.view">
|
||||
</umb-overlay>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -188,6 +188,23 @@ namespace Umbraco.Web.Editors
|
||||
: Request.CreateNotificationValidationErrorResponse(result.Exception.Message);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public bool ContainerExist(string name)
|
||||
{
|
||||
var result = Services.DataTypeService.GetContainers(name, 1);
|
||||
|
||||
return result.Any();
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetContainer(string name)
|
||||
{
|
||||
var result = Services.DataTypeService.GetContainers(name, 1);
|
||||
|
||||
return result.Any()
|
||||
? Request.CreateResponse(HttpStatusCode.OK, result.First())
|
||||
: Request.CreateResponse(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data type
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user