Skip to content

Commit

Permalink
Merge pull request #35 from UNC-Libraries/fix-click-assign
Browse files Browse the repository at this point in the history
Supporting already created submit buttons, assigning click handlers to t...
  • Loading branch information
bbpennel committed Apr 20, 2015
2 parents bda2973 + 886e02c commit 04c57db
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
23 changes: 13 additions & 10 deletions jquery.xmleditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2211,24 +2211,27 @@ ModifyMenuPanel.prototype.initialize = function (parentContainer) {

if (self.editor.submitButtonConfigs != null){
$.each(self.editor.submitButtonConfigs, function(index, config){
if (!('createDomElement' in config) || config.createDomElement){
var submitButton = $("<input/>").attr({
var submitButton;
if (config.id && ('createDomElement' in config) && !config.createDomElement) {
submitButton = $("#" + config.id);
} else {
submitButton = $("<input/>").attr({
id : config.id,
'type' : 'button',
'class' : config.cssClass || submitButtonClass,
name : config.name || 'submit',
value : config.label || 'Submit'
}).appendTo(documentStatusPanel);
}

if (!('responseHandler' in config) && config.url) {
config.responseHandler = this.options.submitResponseHandler
|| this.swordSubmitResponseHandler;
}

submitButton.click(function() {
self.editor.submitXML(config);
});
if (!('responseHandler' in config) && config.url) {
config.responseHandler = this.options.submitResponseHandler
|| this.swordSubmitResponseHandler;
}

submitButton.click(function() {
self.editor.submitXML(config);
});
});
}
documentStatusPanel.appendTo(this.menuColumn);
Expand Down
23 changes: 13 additions & 10 deletions src/modify_menu_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,27 @@ ModifyMenuPanel.prototype.initialize = function (parentContainer) {

if (self.editor.submitButtonConfigs != null){
$.each(self.editor.submitButtonConfigs, function(index, config){
if (!('createDomElement' in config) || config.createDomElement){
var submitButton = $("<input/>").attr({
var submitButton;
if (config.id && ('createDomElement' in config) && !config.createDomElement) {
submitButton = $("#" + config.id);
} else {
submitButton = $("<input/>").attr({
id : config.id,
'type' : 'button',
'class' : config.cssClass || submitButtonClass,
name : config.name || 'submit',
value : config.label || 'Submit'
}).appendTo(documentStatusPanel);
}

if (!('responseHandler' in config) && config.url) {
config.responseHandler = this.options.submitResponseHandler
|| this.swordSubmitResponseHandler;
}

submitButton.click(function() {
self.editor.submitXML(config);
});
if (!('responseHandler' in config) && config.url) {
config.responseHandler = this.options.submitResponseHandler
|| this.swordSubmitResponseHandler;
}

submitButton.click(function() {
self.editor.submitXML(config);
});
});
}
documentStatusPanel.appendTo(this.menuColumn);
Expand Down

0 comments on commit 04c57db

Please sign in to comment.