This commit is contained in:
Juan Ferrer Toribio 2016-10-30 23:48:18 +01:00
parent 2c1fb15917
commit a71b196fef
25 changed files with 231 additions and 81 deletions

3
app.js
View File

@ -1,5 +1,6 @@
var Hedera = require ('hedera/hedera');
require ('./env.js' );
require ('hedera/hedera');
window.onload = function ()
{

8
env.js Normal file
View File

@ -0,0 +1,8 @@
var host = window.location.host.split(':')[0];
if (_DEV_MODE)
host = host +':8080';
__webpack_public_path__ = '//'+ host +'/build/';

View File

@ -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
{

View File

@ -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%;
}

View File

@ -3,13 +3,6 @@
margin-right: 17em;
}
/* Main */
.htk-toast
{
margin-left: -10.5em;
}
/* Topbar */
.catalog-actions > .htk-search-entry

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
image/favicon/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
image/favicon/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

72
image/icon.svg Normal file
View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="187"
height="187"
viewBox="0 0 187 187"
enable-background="new 0 0 595 842"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.svg"><metadata
id="metadata21"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs19" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1016"
id="namedview17"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="4.6900433"
inkscape:cx="83.335292"
inkscape:cy="99.203526"
inkscape:window-x="1920"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><g
id="Background"
transform="translate(-211.7456,-282.24899)" /><g
id="Guides"
transform="translate(-211.7456,-282.24899)" /><g
id="g7"
transform="matrix(1.0030446,0,0,1.0030446,-212.39029,-288.74375)"
style="fill:#8ed300;fill-opacity:1"><path
style="fill:#8ed300;fill-opacity:1"
inkscape:connector-curvature="0"
id="path9"
d="m 339.611,301.147 c 1.324,-0.375 2.663,-0.656 4.017,-0.838 l 54.55,-7.391 -1.039,30.924 c -0.862,25.488 -15.732,48.394 -34.025,53.571 -1.319,0.374 -2.654,0.654 -4.003,0.837 l -54.551,7.379 1.038,-30.923 c 0.864,-25.481 15.725,-48.38 34.013,-53.559 z" /><path
style="fill:#8ed300;fill-opacity:1"
inkscape:connector-curvature="0"
id="path11"
d="m 304.353,399.358 27.265,-3.692 c 10.052,-1.368 17.809,8.612 17.351,22.267 l -0.523,15.469 -27.265,3.692 c -10.041,1.366 -17.811,-8.612 -17.354,-22.279 l 0.526,-15.457 z" /><path
style="fill:#8ed300;fill-opacity:1"
inkscape:connector-curvature="0"
id="path13"
d="m 212.72,326.05 49.089,-6.647 c 18.083,-2.444 32.068,15.502 31.238,40.103 l -0.941,27.826 -49.09,6.647 c -18.081,2.456 -32.057,-15.506 -31.236,-40.09 l 0.94,-27.839 z" /><path
style="fill:#8ed300;fill-opacity:1"
inkscape:connector-curvature="0"
id="path15"
d="m 248.296,407.657 c 0.966,-0.272 1.943,-0.478 2.93,-0.611 l 39.76,-5.383 -0.75,22.539 c -0.624,18.584 -11.458,35.275 -24.792,39.049 -0.966,0.272 -1.943,0.48 -2.931,0.613 l -39.772,5.385 0.761,-22.542 c 0.625,-18.573 11.461,-35.274 24.794,-39.05 z" /></g></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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 ()

View File

@ -1,7 +1,6 @@
require ('htk/htk');
Vn.includeCss ('js/hedera/style.css');
require ('./style.css');
Hedera = module.exports = {
Login : require ('./login')

View File

@ -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);
@ -142,14 +143,16 @@ module.exports = new Class
if (!this._isOpen)
return;
var style = this.node.style;
var node = this._node;
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');

View File

@ -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
{

View File

@ -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;
if (!this._container)
{
var container = document.createElement ('div');
container.className = 'htk-toast';
document.body.appendChild (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 ()

View File

@ -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)
{

View File

@ -1,5 +1,5 @@
var Mootools = require ('mootools');
require ('mootools');
Vn = module.exports = {
Locale : require ('./locale')

11
manifest.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "Verdnatura",
"icons": [
{
"src": "image\/favicon\/favicon.png",
"sizes": "512x512"
}
],
"start_url": "index.php",
"display": "standalone"
}

View File

@ -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/"
}

View File

@ -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");

View File

@ -4,9 +4,14 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no"/>
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" type="image/x-icon" href="image/favicon.ico"/>
<?php include ('head.php') ?>
<meta name="mobile-web-app-capable" content="yes"/>
<link rel="shortcut icon" href="image/favicon/favicon.ico"/>
<link rel="apple-touch-icon" href="image/favicon/apple-touch-icon.png"/>
<link rel="icon" type="image/png" href="image/favicon/favicon.png"/>
<link rel="icon" type="image/svg+xml" href="image/icon.svg" sizes="any"/>
<link rel="manifest" href="manifest.json"/>
<meta name="theme-color" content="#009688"/>
<?php include 'head.php' ?>
<title>Verdnatura</title>
</head>

View File

@ -91,7 +91,7 @@ class HtmlService extends Service
function printHeader ()
{
header ('Content-Type: text/html; charset=UTF-8');
//header ("Content-Security-Policy: default-src 'self'; img-src *");
//header ("Content-Security-Policy: default-src *; img-src *;");
}
function globalErrorHandler ()

View File

@ -11,13 +11,14 @@ module.exports =
path: path.join (__dirname, 'build'),
filename: 'hedera-web.js',
chunkFilename: 'chunk.[id].[chunkhash].js',
publicPath: devMode ? 'http://localhost:8080/build/' : 'build/',
publicPath: 'build/'
},
module: {
loaders: [
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.json$/, loader: 'json' },
{ test: /\.xml$/, loader: 'raw' }
{ test: /\.xml$/, loader: 'raw' },
{ test: /\.ttf$/, loader: 'file' }
]
},
resolve: {
@ -28,8 +29,19 @@ module.exports =
fallback: process.env.NODE_PATH
},
plugins: [
// new webpack.optimize.UglifyJsPlugin ({minimize: true})
new webpack.DefinePlugin ({ _DEV_MODE: devMode }),
new webpack.optimize.UglifyJsPlugin ({
minimize: true,
compress: {
warnings: false
}
})
],
// devtool: 'source-map'
devServer: {
inline: true,
host: '0.0.0.0',
headers: { "Access-Control-Allow-Origin": "*" }
},
devtool: 'source-map'
};