* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Acp/Ui/Template/Group/Copy
*/
-define(['Ajax', 'EventKey', 'Language', 'Ui/Dialog', 'Ui/Notification'], function(Ajax, EventKey, Language, UiDialog, UiNotification) {
+define(['Ajax', 'Language', 'Ui/Dialog', 'Ui/Notification'], function(Ajax, Language, UiDialog, UiNotification) {
"use strict";
var _name = null;
UiDialog.open(this);
},
- /**
- * Submits the values for the new template group.
- *
- * @param {Event} event
- * @protected
- */
- _submit: function (event) {
- event.preventDefault();
-
- var valid = true;
- [_name, _folderName].forEach(function (input) {
- if (input.value.trim() === '') {
- elInnerError(input, Language.get('wcf.global.form.error.empty'));
- valid = false;
- }
- else {
- elInnerError(input, false);
+ _dialogSubmit: function () {
+ Ajax.api(this, {
+ parameters: {
+ templateGroupName: _name.value,
+ templateGroupFolderName: _folderName.value
}
});
-
- if (valid) {
- Ajax.api(this, {
- parameters: {
- templateGroupName: _name.value,
- templateGroupFolderName: _folderName.value
- }
- });
- }
},
_ajaxSuccess: function (data) {
return {
id: 'templateGroupCopy',
options: {
- onSetup: (function (content) {
+ onSetup: (function () {
['Name', 'FolderName'].forEach((function(type) {
var input = elById('copyTemplateGroup' + type);
input.value = elById('templateGroup' + type).value;
if (type === 'Name') _name = input;
else _folderName = input;
-
- input.addEventListener('keydown', (function (event) {
- if (EventKey.Enter(event)) {
- this._submit(event);
- }
- }).bind(this));
}).bind(this));
-
- elBySel('.formSubmit > button[data-type="submit"]', content).addEventListener(WCF_CLICK_EVENT, this._submit.bind(this));
}).bind(this),
title: Language.get('wcf.acp.template.group.copy')
},
source: '<dl>' +
'<dt><label for="copyTemplateGroupName">' + Language.get('wcf.global.name') + '</label></dt>' +
- '<dd><input type="text" id="copyTemplateGroupName" class="long"></dd>' +
+ '<dd><input type="text" id="copyTemplateGroupName" class="long" data-dialog-submit-on-enter="true" required></dd>' +
'</dl>' +
'<dl>' +
'<dt><label for="copyTemplateGroupFolderName">' + Language.get('wcf.acp.template.group.folderName') + '</label></dt>' +
- '<dd><input type="text" id="copyTemplateGroupFolderName" class="long"></dd>' +
+ '<dd><input type="text" id="copyTemplateGroupFolderName" class="long" data-dialog-submit-on-enter="true" required></dd>' +
'</dl>' +
'<div class="formSubmit">' +
'<button class="buttonPrimary" data-type="submit">' + Language.get('wcf.global.button.submit') + '</button>' +
_bbcodeCode: function() {},
_observeLoad: function() {},
_edit: function() {},
- _save: function() {},
_setTitle: function() {},
_delete: function() {},
- _dialogSetup: function() {}
+ _dialogSetup: function() {},
+ _dialogSubmit: function() {}
};
return Fake;
}
/**
* Saves the changes to the code's properties.
*
- * @param {Event} event event object
* @protected
*/
- _save: function(event) {
- event.preventDefault();
-
+ _dialogSubmit: function() {
var id = 'redactor-code-' + this._elementId;
['file', 'highlighter', 'line'].forEach((function (attr) {
}).bind(this),
onSetup: (function() {
- elById(idButtonSave).addEventListener(WCF_CLICK_EVENT, this._save.bind(this));
elById(idButtonDelete).addEventListener(WCF_CLICK_EVENT, this._delete.bind(this));
// set highlighters
var highlighters = '<option value="">' + Language.get('wcf.editor.code.highlighter.detect') + '</option>';
- var value, values = [];
+ var values = [];
//noinspection JSUnresolvedVariable
for (var highlighter in this._editor.opts.woltlab.highlighters) {
//noinspection JSUnresolvedVariable
+ '<dl>'
+ '<dt><label for="' + idLine + '">' + Language.get('wcf.editor.code.line') + '</label></dt>'
+ '<dd>'
- + '<input type="number" id="' + idLine + '" min="0" value="1" class="long">'
+ + '<input type="number" id="' + idLine + '" min="0" value="1" class="long" data-dialog-submit-on-enter="true">'
+ '<small>' + Language.get('wcf.editor.code.line.description') + '</small>'
+ '</dd>'
+ '</dl>'
+ '<dl>'
+ '<dt><label for="' + idFile + '">' + Language.get('wcf.editor.code.file') + '</label></dt>'
+ '<dd>'
- + '<input type="text" id="' + idFile + '" class="long">'
+ + '<input type="text" id="' + idFile + '" class="long" data-dialog-submit-on-enter="true">'
+ '<small>' + Language.get('wcf.editor.code.file.description') + '</small>'
+ '</dd>'
+ '</dl>'
+ '</div>'
+ '<div class="formSubmit">'
- + '<button id="' + idButtonSave + '" class="buttonPrimary">' + Language.get('wcf.global.button.save') + '</button>'
+ + '<button id="' + idButtonSave + '" class="buttonPrimary" data-type="submit">' + Language.get('wcf.global.button.save') + '</button>'
+ '<button id="' + idButtonDelete + '">' + Language.get('wcf.global.button.delete') + '</button>'
+ '</div>'
};
_save: function() {},
_setTitle: function() {},
_delete: function() {},
- _dialogSetup: function() {}
+ _dialogSetup: function() {},
+ _dialogSubmit: function() {}
};
return Fake;
}
/**
* Saves the changes to the quote's properties.
*
- * @param {Event} event event object
* @protected
*/
- _save: function(event) {
- event.preventDefault();
-
+ _dialogSubmit: function() {
var id = 'redactor-quote-' + this._elementId;
var urlInput = elById(id + '-url');
}).bind(this),
onSetup: (function() {
- elById(idButtonSave).addEventListener(WCF_CLICK_EVENT, this._save.bind(this));
elById(idButtonDelete).addEventListener(WCF_CLICK_EVENT, this._delete.bind(this));
}).bind(this),
+ '<dl>'
+ '<dt><label for="' + idAuthor + '">' + Language.get('wcf.editor.quote.author') + '</label></dt>'
+ '<dd>'
- + '<input type="text" id="' + idAuthor + '" class="long">'
+ + '<input type="text" id="' + idAuthor + '" class="long" data-dialog-submit-on-enter="true">'
+ '</dd>'
+ '</dl>'
+ '<dl>'
+ '<dt><label for="' + idUrl + '">' + Language.get('wcf.editor.quote.url') + '</label></dt>'
+ '<dd>'
- + '<input type="text" id="' + idUrl + '" class="long">'
+ + '<input type="text" id="' + idUrl + '" class="long" data-dialog-submit-on-enter="true">'
+ '<small>' + Language.get('wcf.editor.quote.url.description') + '</small>'
+ '</dd>'
+ '</dl>'
+ '</div>'
+ '<div class="formSubmit">'
- + '<button id="' + idButtonSave + '" class="buttonPrimary">' + Language.get('wcf.global.button.save') + '</button>'
+ + '<button id="' + idButtonSave + '" class="buttonPrimary" data-type="submit">' + Language.get('wcf.global.button.save') + '</button>'
+ '<button id="' + idButtonDelete + '">' + Language.get('wcf.global.button.delete') + '</button>'
+ '</div>'
};
_bbcodeSpoiler: function() {},
_observeLoad: function() {},
_edit: function() {},
- _save: function() {},
_setTitle: function() {},
_delete: function() {},
- _dialogSetup: function() {}
+ _dialogSetup: function() {},
+ _dialogSubmit: function() {}
};
return Fake;
}
/**
* Saves the changes to the spoiler's properties.
*
- * @param {Event} event event object
* @protected
*/
- _save: function(event) {
- event.preventDefault();
-
+ _dialogSubmit: function() {
elData(this._spoiler, 'label', elById('redactor-spoiler-' + this._elementId + '-label').value);
this._setTitle(this._spoiler);
}).bind(this),
onSetup: (function() {
- elById(idButtonSave).addEventListener(WCF_CLICK_EVENT, this._save.bind(this));
elById(idButtonDelete).addEventListener(WCF_CLICK_EVENT, this._delete.bind(this));
}).bind(this),
+ '<dl>'
+ '<dt><label for="' + idLabel + '">' + Language.get('wcf.editor.spoiler.label') + '</label></dt>'
+ '<dd>'
- + '<input type="text" id="' + idLabel + '" class="long">'
+ + '<input type="text" id="' + idLabel + '" class="long" data-dialog-submit-on-enter="true">'
+ '<small>' + Language.get('wcf.editor.spoiler.label.description') + '</small>'
+ '</dd>'
+ '</dl>'
+ '</div>'
+ '<div class="formSubmit">'
- + '<button id="' + idButtonSave + '" class="buttonPrimary">' + Language.get('wcf.global.button.save') + '</button>'
+ + '<button id="' + idButtonSave + '" class="buttonPrimary" data-type="submit">' + Language.get('wcf.global.button.save') + '</button>'
+ '<button id="' + idButtonDelete + '">' + Language.get('wcf.global.button.delete') + '</button>'
+ '</div>'
};
return Fake;
}
- var _boundListener = false;
var _callback = null;
return {
UiDialog.open(this);
_callback = options.submitCallback;
-
- if (!_boundListener) {
- _boundListener = true;
-
- elById('redactor-modal-button-action').addEventListener(WCF_CLICK_EVENT, this._submit.bind(this));
- }
},
- _submit: function() {
+ _dialogSubmit: function() {
// check if rows and cols are within the boundaries
var isValid = true;
['rows', 'cols'].forEach(function(type) {
},
source: '<dl>'
+ '<dt><label for="redactor-table-rows">' + Language.get('wcf.editor.table.rows') + '</label></dt>'
- + '<dd><input type="number" id="redactor-table-rows" class="small" min="1" max="100" value="2"></dd>'
+ + '<dd><input type="number" id="redactor-table-rows" class="small" min="1" max="100" value="2" data-dialog-submit-on-enter="true"></dd>'
+ '</dl>'
+ '<dl>'
+ '<dt><label for="redactor-table-cols">' + Language.get('wcf.editor.table.cols') + '</label></dt>'
- + '<dd><input type="number" id="redactor-table-cols" class="small" min="1" max="100" value="3"></dd>'
+ + '<dd><input type="number" id="redactor-table-cols" class="small" min="1" max="100" value="3" data-dialog-submit-on-enter="true"></dd>'
+ '</dl>'
+ '<div class="formSubmit">'
- + '<button id="redactor-modal-button-action" class="buttonPrimary">' + Language.get('wcf.global.button.insert') + '</button>'
+ + '<button id="redactor-modal-button-action" class="buttonPrimary" data-type="submit">' + Language.get('wcf.global.button.insert') + '</button>'
+ '</div>'
};
}