From 66644104de951f8fe6eddab5022bcd88f1cfa4a2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 16 Jan 2018 17:26:37 +0100 Subject: [PATCH] Loader, bugs solved --- debian/changelog | 2 +- forms/ecomerce/ticket/ui.xml | 4 +- hedera-web.php | 1 - js/htk/htk.js | 1 + js/htk/loader.js | 79 ++++++++++++++++++++++++++++++++++++ js/htk/style.css | 8 +++- js/vn/mutators.js | 16 ++++---- package.json | 2 +- 8 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 js/htk/loader.js diff --git a/debian/changelog b/debian/changelog index f5bf8847..62d9d372 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.405.66) stable; urgency=low +hedera-web (1.405.67) stable; urgency=low * Initial Release. diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml index 6faa6287..c9bab81d 100644 --- a/forms/ecomerce/ticket/ui.xml +++ b/forms/ecomerce/ticket/ui.xml @@ -26,7 +26,7 @@
-
+

@ @@ -61,7 +61,7 @@

-
+ run (); - diff --git a/js/htk/htk.js b/js/htk/htk.js index 496b9777..6707c0f7 100644 --- a/js/htk/htk.js +++ b/js/htk/htk.js @@ -17,6 +17,7 @@ Htk = module.exports = { ,ImageEditor : require ('./image-editor') ,Assistant : require ('./assistant') ,AssistantBar : require ('./assistant-bar') + ,Loader : require ('./loader') ,Field : require ('./field') ,Column : require ('./column') }; diff --git a/js/htk/loader.js b/js/htk/loader.js new file mode 100644 index 00000000..8ca67313 --- /dev/null +++ b/js/htk/loader.js @@ -0,0 +1,79 @@ + +var Widget = require ('./widget'); + +module.exports = new Class +({ + Tag: 'htk-loader' + ,Extends: Widget + ,Properties: { + form: + { + type: Db.Form + ,set: function (x) + { + this.link ({_form: x}, {'status-changed': this.onFormChange}); + this.onFormChange (); + } + ,get: function () + { + return this._form; + } + } + } + + ,initialize: function () + { + var node = this.createRoot ('div'); + node.className = 'htk-loader'; + + var div = this.createElement ('div'); + div.className = 'spinner'; + + var spinner = new Htk.Spinner (); + div.appendChild (spinner.node); + + var childs = this.createElement ('div'); + + this.spinner = spinner; + this.div = div; + this.childs = childs; + this.isLoading = true; + this.stop (); + } + + ,appendChild: function (child) + { + this.childs.appendChild (child); + } + + ,stop: function () + { + if (!this.isLoading) + return; + + this.isLoading = false; + this.spinner.stop (); + Vn.Node.removeChilds (this.node); + this.node.appendChild (this.childs); + } + + ,start: function () + { + if (this.isLoading) + return; + + this.isLoading = true; + this.spinner.start (); + Vn.Node.removeChilds (this.node); + this.node.appendChild (this.div); + } + + ,onFormChange: function () + { + if (this._form.ready) + this.stop (); + else + this.start (); + } +}); + diff --git a/js/htk/style.css b/js/htk/style.css index 62231a33..6d9f836b 100644 --- a/js/htk/style.css +++ b/js/htk/style.css @@ -593,7 +593,7 @@ td.cell-image .htk-image background-color: initial; } -/* Loader */ +/* Spinner */ .htk-spinner { @@ -630,3 +630,9 @@ td.cell-image .htk-image to {-webkit-transform: rotate(360deg);} } +/* Loader */ + +.htk-loader > .spinner +{ + text-align: center; +} diff --git a/js/vn/mutators.js b/js/vn/mutators.js index 85ca1531..6ee6576e 100644 --- a/js/vn/mutators.js +++ b/js/vn/mutators.js @@ -3,17 +3,17 @@ vnCustomTags = {}; var Mutators = Class.Mutators; +var _Extends = Mutators.Extends; + +Mutators.Extends = function () +{ + _Extends.apply (this, arguments); + this.implement ({Properties: {}}); +} + Mutators.Tag = function (tagName) { vnCustomTags[tagName] = this; - - if (this.parent) - { - this.implement ({Parent: this.parent.Parent}); - this.implement ({Child: this.parent.Child}); - this.implement ({Properties: {}}); - } - this.extend ({Tag: tagName}); }; diff --git a/package.json b/package.json index ac38d638..cd6acb2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "1.405.66", + "version": "1.405.67", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": {