diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js index b8c1a203d6..e3a3ee4bf2 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditTemplate.js @@ -7,9 +7,9 @@ _opts: null, _openMacroModal: function(alias) { - + var self = this; - + UmbClientMgr.openAngularModalWindow({ template: "views/common/dialogs/insertmacro.html", dialogData: { @@ -66,7 +66,7 @@ constructor: function(opts) { // Merge options with default this._opts = $.extend({ - + // Default options go here }, opts); @@ -82,7 +82,7 @@ event.preventDefault(); self.doSubmit(); }); - + $("#sb").click(function() { self._insertCodeBlock(); }); @@ -112,7 +112,7 @@ }); }, - doSubmit: function() { + doSubmit: function() { this.save(jQuery('#' + this._opts.templateNameClientId).val(), jQuery('#' + this._opts.templateAliasClientId).val(), UmbEditor.GetCode()); }, @@ -134,7 +134,7 @@ self.submitFailure(e.message, e.header); } }); - + }, submitSuccess: function (args) { @@ -151,7 +151,10 @@ if (args.contents) { UmbEditor.SetCode(args.contents); } - + + var alias = args.alias; + this._opts.aliasTxtBox.val(alias); + top.UmbSpeechBubble.ShowMessage('save', header, msg); UmbClientMgr.mainTree().setActiveTreeType('templates'); if (pathChanged) { @@ -167,7 +170,7 @@ top.UmbSpeechBubble.ShowMessage('error', header, err); } }); - + //Set defaults for jQuery ajax calls. $.ajaxSetup({ dataType: 'json', diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js index 87b180ce2d..a93f4cf815 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js @@ -33,19 +33,19 @@ insertMacroMarkup: function(alias) { /// callback used to insert the markup for a macro with no parameters - + UmbEditor.Insert("@Umbraco.RenderMacro(\"" + alias + "\")", "", this._opts.codeEditorElementId); }, insertRenderBody: function() { UmbEditor.Insert("@RenderBody()", "", this._opts.codeEditorElementId); }, - + openMacroModal: function (alias) { /// callback used to display the modal dialog to insert a macro with parameters - + var self = this; - + UmbClientMgr.openAngularModalWindow({ template: "views/common/dialogs/insertmacro.html", dialogData: { @@ -141,7 +141,7 @@ }); } else { - //saving a partial view + //saving a partial view var actionName = this._opts.editorType === "PartialViewMacro" ? "SavePartialViewMacro" : "SavePartialView"; $.post(self._opts.restServiceLocation + actionName, @@ -159,9 +159,9 @@ }); } }, - + submitSuccess: function (args) { - + var msg = args.message; var header = args.header; var path = this._opts.treeSyncPath; @@ -183,6 +183,9 @@ if (this._opts.editorType == "Template") { + var alias = args.alias; + this._opts.aliasTxtBox.val(alias); + top.UmbSpeechBubble.ShowMessage('save', header, msg); //templates are different because they are ID based, whereas view files are file based without a static id @@ -194,12 +197,12 @@ else { UmbClientMgr.mainTree().syncTree(path, true); } - + } else { var newFilePath = this._opts.nameTxtBox.val(); - + function trimStart(str, trim) { if (str.startsWith(trim)) { return str.substring(trim.length); @@ -219,12 +222,12 @@ var newLocation = window.location.pathname + "?" + notFileParts.join("&") + "&file=" + newFilePath; UmbClientMgr.contentFrame(newLocation); - + //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done! top.UmbSpeechBubble.ShowMessage('save', header, msg); } else { - + top.UmbSpeechBubble.ShowMessage('save', header, msg); if (args && args.name) { @@ -235,15 +238,15 @@ } UmbClientMgr.mainTree().syncTree(path, true, null, newFilePath.split("/")[1]); - } + } } - + }, - + submitFailure: function (err, header) { - top.UmbSpeechBubble.ShowMessage('error', header, err); + top.UmbSpeechBubble.ShowMessage('error', header, err); }, - + changeMasterPageFile: function ( ) { //var editor = document.getElementById(this._opts.sourceEditorId); var templateDropDown = this._opts.masterPageDropDown.get(0); @@ -279,7 +282,7 @@ $.ajaxSetup({ dataType: 'json', cache: false, - contentType: 'application/json; charset=utf-8' + contentType: 'application/json; charset=utf-8' }); })(jQuery); \ No newline at end of file diff --git a/src/Umbraco.Web/WebServices/SaveFileController.cs b/src/Umbraco.Web/WebServices/SaveFileController.cs index 55e16a356e..871f1512ef 100644 --- a/src/Umbraco.Web/WebServices/SaveFileController.cs +++ b/src/Umbraco.Web/WebServices/SaveFileController.cs @@ -192,7 +192,8 @@ namespace Umbraco.Web.WebServices new { path = syncPath, - contents = t.Design + contents = t.Design, + alias = t.Alias // might have been updated! }); } catch (Exception ex)