diff --git a/app.js b/app.js index cbd7e0e4..59f87a87 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,6 @@ -var Hedera = require ('hedera/hedera'); +require ('./env.js' ); +require ('hedera/hedera'); window.onload = function () { diff --git a/env.js b/env.js new file mode 100644 index 00000000..babad2f8 --- /dev/null +++ b/env.js @@ -0,0 +1,8 @@ + +var host = window.location.host.split(':')[0]; + +if (_DEV_MODE) + host = host +':8080'; + +__webpack_public_path__ = '//'+ host +'/build/'; + diff --git a/forms/cms/home/style.css b/forms/cms/home/style.css index 4869b367..e5c58cd1 100644 --- a/forms/cms/home/style.css +++ b/forms/cms/home/style.css @@ -33,13 +33,14 @@ .new .top { padding: 1.5em; - padding-bottom: 1em; + padding-bottom: 0; } .new h2 { font-size: 1.6em; color: black; font-weight: normal; + padding: 0; } .new-info { @@ -50,7 +51,12 @@ } .new-text { - margin-top: 2em; + margin: 1.5em 0; +} +.new-text a +{ + color: blue; + text-decoration: underline; } .new-text li { diff --git a/forms/cms/training/style.css b/forms/cms/training/style.css index a73e03f0..6ee17b0d 100644 --- a/forms/cms/training/style.css +++ b/forms/cms/training/style.css @@ -22,13 +22,14 @@ .new .top { padding: 1.5em; - padding-bottom: 1em; + padding-bottom: 0; } .new h2 { font-size: 1.6em; color: black; font-weight: normal; + padding: 0; } .new-info { @@ -39,7 +40,12 @@ } .new-text { - margin-top: 2em; + margin: 1.5em 0; +} +.new-text a +{ + color: blue; + text-decoration: underline; } .new-text li { @@ -51,3 +57,4 @@ margin: auto; width: 100%; } + diff --git a/forms/ecomerce/catalog/style.css b/forms/ecomerce/catalog/style.css index dec55c0d..d9a93979 100644 --- a/forms/ecomerce/catalog/style.css +++ b/forms/ecomerce/catalog/style.css @@ -3,13 +3,6 @@ margin-right: 17em; } -/* Main */ - -.htk-toast -{ - margin-left: -10.5em; -} - /* Topbar */ .catalog-actions > .htk-search-entry diff --git a/image/favicon.ico b/image/favicon.ico deleted file mode 100755 index c26fb996..00000000 Binary files a/image/favicon.ico and /dev/null differ diff --git a/image/favicon/apple-touch-icon.png b/image/favicon/apple-touch-icon.png new file mode 100644 index 00000000..85e8a90b Binary files /dev/null and b/image/favicon/apple-touch-icon.png differ diff --git a/image/favicon/favicon.ico b/image/favicon/favicon.ico new file mode 100644 index 00000000..0de7b90c Binary files /dev/null and b/image/favicon/favicon.ico differ diff --git a/image/favicon/favicon.png b/image/favicon/favicon.png new file mode 100644 index 00000000..ef30c896 Binary files /dev/null and b/image/favicon/favicon.png differ diff --git a/image/icon.svg b/image/icon.svg new file mode 100644 index 00000000..738c8157 --- /dev/null +++ b/image/icon.svg @@ -0,0 +1,72 @@ + + + + \ No newline at end of file diff --git a/js/db/model.js b/js/db/model.js index 600bcf7d..0181257a 100644 --- a/js/db/model.js +++ b/js/db/model.js @@ -849,14 +849,16 @@ Model.implement ,_onOperationsDone: function (ops, resultSet) { - if (resultSet.getError ()) + var error = resultSet.getError (); + + if (error) { this._operations = this._operations.concat (ops); for (var i = 0; i < ops.length; i++) this._operationsMap[ops[i].row.index] = ops[i]; - return; + throw error; } resultSet.fetchResult (); @@ -1163,7 +1165,7 @@ Model.implement case Connection.Type.DATE: { for (var i = 0; i < data.length; i++) - if (value === data[i][col].toString ()); + if (value === data[i][col].toString ()) return i; break; diff --git a/js/hedera/gui.css b/js/hedera/gui.css index 3ae789f7..7885b3ac 100644 --- a/js/hedera/gui.css +++ b/js/hedera/gui.css @@ -282,29 +282,20 @@ { position: relative; height: inherit; - opacity: 0; + opacity: 0; transform: translateZ(0) translateX(-2em); -webkit-transform: translateZ(0) translateX(-2em); + + transition-property: opacity, transform; + transition-duration: 200ms; + transition-timing-function: ease-out; } .vn-gui .form-holder.show { opacity: 1; transform: translateZ(0) translateX(0em); -webkit-transform: translateZ(0) translateX(0em); - - transition: all 250ms ease-out; - -webkit-transition: all 250ms ease-out; -} - -/* Desktop */ - -@media (min-width: 951px) -{ - .htk-toast - { - margin-left: -3em; - } } /* Mobile */ @@ -363,10 +354,5 @@ { max-height: 20em; } - - .htk-toast - { - margin-left: -10.5em; - } } diff --git a/js/hedera/gui.js b/js/hedera/gui.js index 66e9e845..a4285b17 100644 --- a/js/hedera/gui.js +++ b/js/hedera/gui.js @@ -1,5 +1,6 @@ var Module = require ('./module'); +var Css = require ('./gui.css'); var Tpl = require ('./gui.xml'); module.exports = new Class @@ -68,9 +69,8 @@ module.exports = new Class return; this._shown = true; - - Vn.includeCss ('js/hedera/gui.css'); this.doc.body.appendChild (this.node); + Htk.Toast.pushTop (this.$('form-holder')); if (Vn.isMobile ()) { @@ -99,11 +99,11 @@ module.exports = new Class if (Vn.isMobile ()) window.removeEventListener ('scroll', this._onScrollHandler); + Htk.Toast.popTop (); this.formParam.unref (); this.closeForm (); this.hideMenu (); Vn.Node.remove (this.node); - Vn.excludeCss ('js/hedera/gui.css'); } ,logout: function () diff --git a/js/hedera/hedera.js b/js/hedera/hedera.js index 0a88c251..051c3cb2 100644 --- a/js/hedera/hedera.js +++ b/js/hedera/hedera.js @@ -1,7 +1,6 @@ require ('htk/htk'); - -Vn.includeCss ('js/hedera/style.css'); +require ('./style.css'); Hedera = module.exports = { Login : require ('./login') diff --git a/js/htk/popup.js b/js/htk/popup.js index 55852615..66393a93 100644 --- a/js/htk/popup.js +++ b/js/htk/popup.js @@ -108,6 +108,7 @@ module.exports = new Class var bg = this._bg = this.createElement ('div'); bg.className = 'htk-background'; bg.addEventListener ('mousedown', this._bgMouseDownHandler); + Htk.Toast.pushTop (bg); Vn.Node.addClass (this.node, 'modal'); bg.appendChild (this.node); @@ -141,15 +142,17 @@ module.exports = new Class { if (!this._isOpen) return; + + var node = this._node; - var style = this.node.style; + var style = node.style; style.height = ''; style.width = ''; var margin = 20; var dblMargin = margin * 2; - var width = this.node.offsetWidth; - var height = this.node.offsetHeight; + var width = node.offsetWidth; + var height = node.offsetHeight; var innerWidth = Vn.Browser.getInnerWidth (); var innerHeight = Vn.Browser.getInnerHeight (); @@ -169,8 +172,8 @@ module.exports = new Class style.top = '50%'; style.left = '50%'; - style.marginLeft = (-this.node.offsetWidth / 2) +'px'; - style.marginTop = (-this.node.offsetHeight / 2) +'px'; + style.marginLeft = (-node.offsetWidth / 2) +'px'; + style.marginTop = (-node.offsetHeight / 2) +'px'; } else { @@ -201,14 +204,15 @@ module.exports = new Class if (this._bg) { + Htk.Toast.popTop (); Vn.Node.remove (this._bg); - Vn.Node.removeClass (this.node, 'modal'); + Vn.Node.removeClass (this._node, 'modal'); this._bg = null; } else this.doc.removeEventListener ('mousedown', this._bgMouseDownHandler); - Vn.Node.remove (this.node); + Vn.Node.remove (this._node); this._parent = null; this._isOpen = false; this.signalEmit ('closed'); diff --git a/js/htk/style.css b/js/htk/style.css index 99aa58b9..c0d54000 100644 --- a/js/htk/style.css +++ b/js/htk/style.css @@ -395,6 +395,20 @@ td.cell-image .htk-image border-radius: 0.1em; box-shadow: 0 0 0.4em rgba(1, 1, 1, 0.6); width: 96%; + + opacity: 0; + transform: translateZ(0) translateY(-1em); + -webkit-transform: translateZ(0) translateY(-1em); + + transition-property: opacity, transform; + transition-duration: 200ms; + transition-timing-function: ease-out; +} +.htk-toast > div.show +{ + opacity: 1; + transform: translateZ(0) translateY(0em); + -webkit-transform: translateZ(0) translateY(0em); } .htk-toast > .message { diff --git a/js/htk/toast.js b/js/htk/toast.js index 785ff267..5585cdf0 100644 --- a/js/htk/toast.js +++ b/js/htk/toast.js @@ -7,6 +7,7 @@ module.exports = ,timeout: 10 /* Seconds */ ,_container: null ,_timeouts: null + ,_topHeap: [] /** * Shows a normal toast message. @@ -38,6 +39,16 @@ module.exports = this._showText (message, 'error'); } + ,pushTop: function (top) + { + this._topHeap.push (top); + } + + ,popTop: function () + { + return this._topHeap.pop (); + } + /** * Hides all currently displayed toast messages. **/ @@ -60,18 +71,28 @@ module.exports = ,_createContainer: function () { - if (this._container) - return; - - var container = document.createElement ('div'); - container.className = 'htk-toast'; - document.body.appendChild (container); + if (!this._container) + { + var container = document.createElement ('div'); + container.className = 'htk-toast'; + document.body.appendChild (container); - this.hideHandler = this.hide.bind (this); - document.addEventListener ('mousedown', this.hideHandler); + this.hideHandler = this.hide.bind (this); + document.addEventListener ('mousedown', this.hideHandler); - this._timeouts = []; - this._container = container; + this._timeouts = []; + this._container = container; + } + + var heapLen = this._topHeap.length; + + if (heapLen > 0) + { + var top = this._topHeap[heapLen - 1]; + var rect = top.getBoundingClientRect (); + var left = rect.left + parseInt (rect.width / 2) - window.pageXOffset; + this._container.style.left = left +'px'; + } } ,_showText: function (message, className) @@ -81,17 +102,24 @@ module.exports = if (this._timeouts.length >= this.maxMessages) this._onMessageTimeout (); - var node = document.createElement ('div'); - node.className = className; - node.addEventListener ('mousedown', this._onMessageMouseDown); + var toast = document.createElement ('div'); + toast.className = className; + toast.addEventListener ('mousedown', this._onMessageMouseDown); var textNode = document.createTextNode (message); - node.appendChild (textNode); + toast.appendChild (textNode); - this._container.appendChild (node); + this._container.appendChild (toast); var timeoutId = setTimeout (this._onMessageTimeout.bind (this), this.timeout * 1000); this._timeouts.push (timeoutId); + + setTimeout (this._onShowToastTimeout.bind (this, toast), 50); + } + + ,_onShowToastTimeout: function (toast) + { + Vn.Node.addClass (toast, 'show'); } ,_onMessageTimeout: function () diff --git a/js/vn/json-connection.js b/js/vn/json-connection.js index 74e94c3d..7d38b9d6 100644 --- a/js/vn/json-connection.js +++ b/js/vn/json-connection.js @@ -108,7 +108,7 @@ module.exports = new Class this.signalEmit ('closed'); if (callback) - callback (this, json == true, error); + callback (this, json === true, error); } ,_closeClient: function () @@ -261,7 +261,7 @@ module.exports = new Class var json = JSON.parse (request.responseText); var jsData = json.data; - var jsWarns = json.warnings; + //var jsWarns = json.warnings; if (request.status == 200) { diff --git a/js/vn/vn.js b/js/vn/vn.js index 89320e75..6a0ebe5a 100644 --- a/js/vn/vn.js +++ b/js/vn/vn.js @@ -1,5 +1,5 @@ -var Mootools = require ('mootools'); +require ('mootools'); Vn = module.exports = { Locale : require ('./locale') diff --git a/manifest.json b/manifest.json new file mode 100644 index 00000000..e1b6b274 --- /dev/null +++ b/manifest.json @@ -0,0 +1,11 @@ +{ + "name": "Verdnatura", + "icons": [ + { + "src": "image\/favicon\/favicon.png", + "sizes": "512x512" + } + ], + "start_url": "index.php", + "display": "standalone" +} diff --git a/package.json b/package.json index 177562ec..051cdc02 100644 --- a/package.json +++ b/package.json @@ -3,20 +3,22 @@ "version": "1.0.0", "description": "Verdnatura web page", "devDependencies": { - "webpack": "*", - "webpack-dev-server": "*", - "css-loader": "*", - "style-loader": "*", - "json-loader": "*", - "raw-loader": "*", - "bundle-loader": "*" + "bundle-loader": "^0.5.4", + "css-loader": "^0.25.0", + "file-loader": "^0.9.0", + "json-loader": "^0.5.4", + "raw-loader": "^0.5.1", + "style-loader": "^0.13.1", + "url-loader": "^0.5.7", + "webpack": "^1.13.3", + "webpack-dev-server": "^1.16.2" }, "dependencies": { "mootools": "^1.5.2", "tinymce": "^4.4.3" }, "scripts": { - "dev": "webpack-dev-server --progress --colors --inline --hot", + "dev": "webpack-dev-server --progress --colors --hot", "build": "rm -f build/* ; webpack --progress --colors", "clean": "rm -rf build/" } diff --git a/pages/main/head.php b/pages/main/head.php index beadc2b1..c135129c 100755 --- a/pages/main/head.php +++ b/pages/main/head.php @@ -12,7 +12,7 @@ if ($result = $db->query ('SELECT name, content FROM metatag')) $result->free (); } -$url = _DEV_MODE ? 'http://localhost:8080' : '.'; +$url = _DEV_MODE ? "http://{$_SERVER['SERVER_NAME']}:8080" : '.'; if (_DEV_MODE) $this->includeJs ("$url/webpack-dev-server.js"); diff --git a/pages/main/ui.php b/pages/main/ui.php index 55520cfb..65006b62 100755 --- a/pages/main/ui.php +++ b/pages/main/ui.php @@ -4,9 +4,14 @@
- - - + + + + + + + +