Fixed duplicated dialog response
gitea/hedera-web/pipeline/head This commit looks good
Details
gitea/hedera-web/pipeline/head This commit looks good
Details
This commit is contained in:
parent
54966582b5
commit
8e916d376a
|
@ -1,4 +1,4 @@
|
||||||
hedera-web (1.407.13) stable; urgency=low
|
hedera-web (1.407.14) stable; urgency=low
|
||||||
|
|
||||||
* Initial Release.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
103
js/htk/dialog.js
103
js/htk/dialog.js
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
var Popup = require ('./popup');
|
var Popup = require('./popup');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to show message dialogs with buttons.
|
* Class to show message dialogs with buttons.
|
||||||
**/
|
**/
|
||||||
var Dialog = new Class ();
|
var Dialog = new Class();
|
||||||
module.exports = Dialog;
|
module.exports = Dialog;
|
||||||
|
|
||||||
var Button =
|
var Button =
|
||||||
|
@ -42,13 +42,11 @@ Button.CANCEL_ACCEPT = Button.CANCEL | Button.ACCEPT;
|
||||||
Button.ACCEPT_RETRY = Button.ACCEPT | Button.RETRY;
|
Button.ACCEPT_RETRY = Button.ACCEPT | Button.RETRY;
|
||||||
Button.YES_NO = Button.YES | Button.NO;
|
Button.YES_NO = Button.YES | Button.NO;
|
||||||
|
|
||||||
Dialog.extend
|
Dialog.extend({
|
||||||
({
|
|
||||||
Button: Button
|
Button: Button
|
||||||
});
|
});
|
||||||
|
|
||||||
Dialog.implement
|
Dialog.implement({
|
||||||
({
|
|
||||||
Extends: Popup
|
Extends: Popup
|
||||||
,Tag: 'htk-dialog'
|
,Tag: 'htk-dialog'
|
||||||
,Properties:
|
,Properties:
|
||||||
|
@ -59,12 +57,10 @@ Dialog.implement
|
||||||
message:
|
message:
|
||||||
{
|
{
|
||||||
type: String
|
type: String
|
||||||
,set: function (x)
|
,set: function(x) {
|
||||||
{
|
|
||||||
this._message = x;
|
this._message = x;
|
||||||
}
|
}
|
||||||
,get: function ()
|
,get: function() {
|
||||||
{
|
|
||||||
return this._message;
|
return this._message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,12 +70,10 @@ Dialog.implement
|
||||||
,icon:
|
,icon:
|
||||||
{
|
{
|
||||||
type: String
|
type: String
|
||||||
,set: function (x)
|
,set: function(x) {
|
||||||
{
|
|
||||||
this._icon = x;
|
this._icon = x;
|
||||||
}
|
}
|
||||||
,get: function ()
|
,get: function() {
|
||||||
{
|
|
||||||
return this._icon;
|
return this._icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,12 +83,10 @@ Dialog.implement
|
||||||
,buttons:
|
,buttons:
|
||||||
{
|
{
|
||||||
enumType: Button
|
enumType: Button
|
||||||
,set: function (x)
|
,set: function(x) {
|
||||||
{
|
|
||||||
this._buttons = x;
|
this._buttons = x;
|
||||||
}
|
}
|
||||||
,get: function ()
|
,get: function() {
|
||||||
{
|
|
||||||
return this._buttons;
|
return this._buttons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,81 +96,66 @@ Dialog.implement
|
||||||
,_icon: 'info'
|
,_icon: 'info'
|
||||||
,_buttons: Button.ACCEPT
|
,_buttons: Button.ACCEPT
|
||||||
|
|
||||||
,initialize: function (props)
|
,open: function() {
|
||||||
{
|
this.parent();
|
||||||
this.parent (props);
|
|
||||||
this.on ('closed', this._onClosed, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
,open: function ()
|
|
||||||
{
|
|
||||||
this.parent ();
|
|
||||||
|
|
||||||
// Dialog body
|
// Dialog body
|
||||||
|
|
||||||
var root = this.createElement ('div');
|
var root = this.createElement('div');
|
||||||
root.className = 'htk-dialog';
|
root.className = 'htk-dialog';
|
||||||
|
|
||||||
var body = this.createElement ('div');
|
var body = this.createElement('div');
|
||||||
root.appendChild (body);
|
root.appendChild(body);
|
||||||
|
|
||||||
if (this._icon)
|
if (this._icon) {
|
||||||
{
|
var icon = new Htk.Icon({
|
||||||
var icon = new Htk.Icon ({
|
|
||||||
doc: this.doc,
|
doc: this.doc,
|
||||||
icon: this._icon
|
icon: this._icon
|
||||||
});
|
});
|
||||||
body.appendChild (icon.node);
|
body.appendChild(icon.node);
|
||||||
}
|
}
|
||||||
|
|
||||||
var p = this.createElement ('p');
|
var p = this.createElement('p');
|
||||||
body.appendChild (p);
|
body.appendChild(p);
|
||||||
|
|
||||||
if (this._message)
|
if (this._message)
|
||||||
p.appendChild (this.createTextNode (this._message));
|
p.appendChild(this.createTextNode(this._message));
|
||||||
|
|
||||||
var clear = this.createElement ('div');
|
var clear = this.createElement('div');
|
||||||
clear.style.clear = 'both';
|
clear.style.clear = 'both';
|
||||||
body.appendChild (clear);
|
body.appendChild(clear);
|
||||||
|
|
||||||
// Button bar
|
// Button bar
|
||||||
|
|
||||||
var buttonBar = this._buttonBar = this.createElement ('div');
|
var buttonBar = this._buttonBar = this.createElement('div');
|
||||||
buttonBar.className = 'button-bar';
|
buttonBar.className = 'button-bar';
|
||||||
root.appendChild (buttonBar);
|
root.appendChild(buttonBar);
|
||||||
|
|
||||||
var i = labels.length;
|
var i = labels.length;
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
if (this._buttons & labels[i].response)
|
if (this._buttons & labels[i].response)
|
||||||
this.createButton (_(labels[i].label), labels[i].response);
|
this.createButton(_(labels[i].label), labels[i].response);
|
||||||
|
|
||||||
var clear = this.createElement ('div');
|
var clear = this.createElement('div');
|
||||||
clear.style.clear = 'both';
|
clear.style.clear = 'both';
|
||||||
root.appendChild (clear);
|
root.appendChild(clear);
|
||||||
|
|
||||||
this.childNode = root;
|
this.childNode = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
,createButton: function (label, response)
|
,hide(response) {
|
||||||
{
|
if (!this._isOpen) return;
|
||||||
var button = this.createElement ('button');
|
this.parent();
|
||||||
|
this.signalEmit('response', response);
|
||||||
|
}
|
||||||
|
|
||||||
|
,createButton: function(label, response) {
|
||||||
|
var button = this.createElement('button');
|
||||||
button.className = 'thin';
|
button.className = 'thin';
|
||||||
button.appendChild (this.createTextNode (label));
|
button.appendChild(this.createTextNode(label));
|
||||||
button.addEventListener ('click',
|
button.addEventListener('click',
|
||||||
this._onButtonClick.bind (this, response));
|
this.hide.bind(this, response));
|
||||||
this._buttonBar.appendChild (button);
|
this._buttonBar.appendChild(button);
|
||||||
}
|
|
||||||
|
|
||||||
,_onButtonClick: function (response)
|
|
||||||
{
|
|
||||||
this.hide ();
|
|
||||||
this.signalEmit ('response', response);
|
|
||||||
}
|
|
||||||
|
|
||||||
,_onClosed: function ()
|
|
||||||
{
|
|
||||||
this.signalEmit ('response', null);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hedera-web",
|
"name": "hedera-web",
|
||||||
"version": "1.407.13",
|
"version": "1.407.14",
|
||||||
"description": "Verdnatura web page",
|
"description": "Verdnatura web page",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Reference in New Issue