Fixes template editor to re-enable ajax saving - might need back porting to 6.2

This commit is contained in:
Shannon
2013-10-15 15:38:08 +11:00
parent e7162d46ce
commit 0312b947e1
3 changed files with 22 additions and 17 deletions

View File

@@ -15,12 +15,13 @@
<umb:JsInclude ID="JsInclude" runat="server" FilePath="splitbutton/jquery.splitbutton.js" PathNameAlias="UmbracoClient" />
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="Editors/EditTemplate.js" PathNameAlias="UmbracoClient" />
<script type="text/javascript">
//this needs to be a global object for the doSubmit() to work
var editor;
jQuery(document).ready(function() {
//create the editor
editor = new Umbraco.Editors.EditTemplate({
var editor = new Umbraco.Editors.EditTemplate({
templateAliasClientId: '<%= AliasTxt.ClientID %>',
templateNameClientId: '<%= NameTxt.ClientID %>',
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
restServiceLocation: "<%= Url.GetSaveFileServicePath() %>",
umbracoPath: '<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>',
editorClientId: '<%= editorSource.ClientID %>',
@@ -39,12 +40,7 @@
editor.init();
});
function doSubmit() {
//this is called when the save button is clicked or invoked
editor.save(jQuery('#<%= NameTxt.ClientID %>').val(), jQuery('#<%= AliasTxt.ClientID %>').val(), UmbEditor.GetCode());
}
//TODO: the below should be refactored into being part of the EditTemplate.js class but have left it here for now since i don't have time.
function umbracoTemplateInsertMasterPageContentContainer() {

View File

@@ -77,6 +77,12 @@
var self = this;
//bind to the save event
this._opts.saveButton.click(function (event) {
event.preventDefault();
self.doSubmit();
});
$("#sb").click(function() {
self._insertCodeBlock();
});
@@ -106,6 +112,10 @@
});
},
doSubmit: function() {
this.save(jQuery('#' + this._opts.templateNameClientId).val(), jQuery('#' + this._opts.templateAliasClientId).val(), UmbEditor.GetCode());
},
save: function(templateName, templateAlias, codeVal) {
var self = this;