Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 72503e7

Browse files
authored
Merge pull request #191 from skttl/develop
Preparing 1.2.1
2 parents a3ad8b5 + 7323c39 commit 72503e7

File tree

5 files changed

+54
-49
lines changed

5 files changed

+54
-49
lines changed

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
image: Visual Studio 2017
22

33
# version format
4-
version: 1.2.0.{build}
4+
version: 1.2.1.{build}
55

66
# UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha
77
# example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta
@@ -45,7 +45,7 @@ deploy:
4545

4646
# NuGet Deployment for releases
4747
- provider: NuGet
48-
server:
48+
server:
4949
skip_symbols: true
5050
api_key:
5151
secure: RYtJVVEuX1s2cy3Wo1Xly0yvp1n40wDdndhNsXQGgrAUmZDnlwujEycsLxUL8NsN

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Css/doctypegrideditor.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
border: 1px solid #bbbabf;
1919
}
2020

21+
.dtge-editor-preview-container {
22+
text-align: initial;
23+
}
2124
/*
2225
Style the doc type grid editor previews
2326

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Js/doctypegrideditor.controllers.js

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -93,54 +93,57 @@
9393
id: $scope.control.value.id
9494
};
9595
overlayOptions.close = function () {
96-
// ensure an empty doctype is not persisted
97-
if($scope.control.$initializing){
98-
$scope.removeControl($scope.area, $scope.control.$index -1);
96+
// ensure an empty DTGE without ContentType Alias is not persisted
97+
if ($scope.control.value && $scope.control.value.dtgeContentTypeAlias === "") {
98+
let indexOfThis = $scope.area.controls.map(function (control) { return control.$uniqueId }).indexOf($scope.control.$uniqueId);
99+
if (indexOfThis > -1) {
100+
$scope.removeControl($scope.area, indexOfThis);
101+
}
99102
}
100103

101104
editorService.close();
102105
}
103106
overlayOptions.submit = function (newModel) {
104107

105-
// Copy property values to scope model value
106-
if (newModel.node) {
107-
var value = {
108-
name: newModel.editorName
109-
};
110-
111-
for (var v = 0; v < newModel.node.variants.length; v++) {
112-
var variant = newModel.node.variants[v];
113-
for (var t = 0; t < variant.tabs.length; t++) {
114-
var tab = variant.tabs[t];
115-
for (var p = 0; p < tab.properties.length; p++) {
116-
var prop = tab.properties[p];
117-
if (typeof prop.value !== "function") {
118-
value[prop.alias] = prop.value;
119-
}
120-
}
121-
}
122-
}
108+
// Copy property values to scope model value
109+
if (newModel.node) {
110+
var value = {
111+
name: newModel.editorName
112+
};
123113

124-
if (newModel.nameExp) {
125-
var newName = newModel.nameExp(value); // Run it against the stored dictionary value, NOT the node object
126-
if (newName && (newName = $.trim(newName))) {
127-
value.name = newName;
114+
for (var v = 0; v < newModel.node.variants.length; v++) {
115+
var variant = newModel.node.variants[v];
116+
for (var t = 0; t < variant.tabs.length; t++) {
117+
var tab = variant.tabs[t];
118+
for (var p = 0; p < tab.properties.length; p++) {
119+
var prop = tab.properties[p];
120+
if (typeof prop.value !== "function") {
121+
value[prop.alias] = prop.value;
128122
}
129123
}
124+
}
125+
}
130126

131-
newModel.dialogData.value = value;
132-
} else {
133-
newModel.dialogData.value = null;
134-
127+
if (newModel.nameExp) {
128+
var newName = newModel.nameExp(value); // Run it against the stored dictionary value, NOT the node object
129+
if (newName && (newName = $.trim(newName))) {
130+
value.name = newName;
135131
}
132+
}
136133

137-
$scope.setValue({
138-
dtgeContentTypeAlias: newModel.dialogData.docTypeAlias,
139-
value: newModel.dialogData.value,
140-
id: newModel.dialogData.id
141-
});
142-
$scope.setPreview($scope.control.value);
143-
editorService.close();
134+
newModel.dialogData.value = value;
135+
} else {
136+
newModel.dialogData.value = null;
137+
138+
}
139+
140+
$scope.setValue({
141+
dtgeContentTypeAlias: newModel.dialogData.docTypeAlias,
142+
value: newModel.dialogData.value,
143+
id: newModel.dialogData.id
144+
});
145+
$scope.setPreview($scope.control.value);
146+
editorService.close();
144147
};
145148

146149
editorService.open(overlayOptions);
@@ -244,7 +247,7 @@ angular.module("umbraco").controller("Our.Umbraco.DocTypeGridEditor.Dialogs.DocT
244247
vm.blueprintConfig = blueprintConfig;
245248

246249
function cleanup() {
247-
if ($scope.model.node.id > 0){
250+
if ($scope.model.node && $scope.model.node.id > 0) {
248251
// delete any temporary blueprints used for validation
249252
contentResource.deleteBlueprint($scope.model.node.id);
250253
}
@@ -268,15 +271,15 @@ angular.module("umbraco").controller("Our.Umbraco.DocTypeGridEditor.Dialogs.DocT
268271
content: $scope.model.node,
269272
create: true,
270273
action: "save",
271-
showNotifications: true,
274+
showNotifications: false,
272275
softRedirect: true
273276
}
274277

275278
contentEditingHelper.contentEditorPerformSave(args).then(function (data) {
276-
$scope.model.submit($scope.model);
277-
},
279+
$scope.model.submit($scope.model);
280+
},
278281
function (err) {
279-
282+
280283
});
281284
}
282285
}

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Js/doctypegrideditor.resources.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
function ($q, $http, umbRequestHelper) {
33
return {
44
getContentTypeAliasByGuid: function (guid) {
5-
var url = umbRequestHelper.convertVirtualToAbsolutePath("~/umbraco/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetContentTypeAliasByGuid?guid=" + guid);
5+
var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetContentTypeAliasByGuid?guid=" + guid;
66
return umbRequestHelper.resourcePromise(
77
$http.get(url),
88
'Failed to retrieve content type alias by guid'
99
);
1010
},
1111
getContentTypes: function (allowedContentTypes) {
12-
var url = umbRequestHelper.convertVirtualToAbsolutePath("~/umbraco/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetContentTypes");
12+
var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetContentTypes";
1313
if (allowedContentTypes) {
1414
for (var i = 0; i < allowedContentTypes.length; i++) {
1515
url += (i == 0 ? "?" : "&") + "allowedContentTypes=" + allowedContentTypes[i];
@@ -21,21 +21,21 @@
2121
);
2222
},
2323
getContentType: function (contentTypeAlias) {
24-
var url = umbRequestHelper.convertVirtualToAbsolutePath("~/umbraco/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetContentType?contentTypeAlias=" + contentTypeAlias);
24+
var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetContentType?contentTypeAlias=" + contentTypeAlias;
2525
return umbRequestHelper.resourcePromise(
2626
$http.get(url),
2727
'Failed to retrieve content type icon'
2828
);
2929
},
3030
getDataTypePreValues: function (dtdId) {
31-
var url = umbRequestHelper.convertVirtualToAbsolutePath("~/umbraco/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetDataTypePreValues?dtdid=" + dtdId);
31+
var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetDataTypePreValues?dtdid=" + dtdId;
3232
return umbRequestHelper.resourcePromise(
3333
$http.get(url),
3434
'Failed to retrieve datatypes'
3535
);
3636
},
3737
getEditorMarkupForDocTypePartial: function (pageId, id, editorAlias, contentTypeAlias, value, viewPath, previewViewPath, published) {
38-
var url = umbRequestHelper.convertVirtualToAbsolutePath("~/umbraco/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetPreviewMarkup?dtgePreview=1&pageId=" + pageId);
38+
var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/DocTypeGridEditorApi/DocTypeGridEditorApi/GetPreviewMarkup?dtgePreview=1&pageId=" + pageId;
3939
return $http({
4040
method: 'POST',
4141
url: url,

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</div>
1313
<div ng-if="preview"
1414
class="dtge-editor-preview-container"
15-
style="text-align: left;"
1615
dtge-bind-html-compile="preview"
1716
prevent-default>
1817
</div>

0 commit comments

Comments
 (0)