Commit 8a41804093aacb62701b6d1b2006fa6747cbac92

Authored by José Maria Villac Pinheiro
1 parent 82381832

V. 0.8.0 - Change from Jade to Pug

app.js
... ... @@ -14,7 +14,7 @@ var app = express();
14 14  
15 15 // view engine setup
16 16 app.set("views", path.join(__dirname, "views"));
17   -app.set("view engine", "jade");
  17 +app.set("view engine", "pug");
18 18  
19 19 // uncomment after placing your favicon in /public
20 20 app.use(
... ...
index.js 0 → 100644
... ... @@ -0,0 +1,112 @@
  1 +#!/usr/bin/env node // to invoke node, in linux system, that is installed in a path accessed through the environment variable
  2 +
  3 +/**
  4 + * Module dependencies.
  5 + * Everything starts here
  6 + */
  7 +
  8 +var app = require('./app'); // call app.js that will call routes throught ../routes/index.js
  9 +var debug = require('debug')('pg-node:server');
  10 +// var http = require('http');
  11 +
  12 +/**
  13 + * Production version verification. It needs to build for React client.
  14 + */
  15 +var express = require("express");
  16 +if (process.env.NODE_ENV === 'production') {
  17 + // Express will serve up production assets
  18 + // like our main.js file or main.css file!
  19 + // this guarantees that expressjs will look
  20 + // for specific files in specific directories
  21 + console.log ("NEXUS-We are in production...");
  22 + app.use(express.static('./client/build')); // if get request comes in from some route or some file or for anything for my application and we do not understant, then look in some file from this directory to see if some file that matches up the request
  23 +
  24 + // Express will serve up the index.html file
  25 + // if it doesn't recognize the route.
  26 + // If something arrives from a route that we do not understand,
  27 + // look at the index.htm file in the client directory
  28 + const path = require('path');
  29 + app.get('*', (req, res) => {
  30 + res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
  31 + });
  32 +}
  33 +
  34 +/**
  35 + * Define port
  36 + */
  37 +var port = normalizePort(process.env.PORT || '5000');
  38 +app.listen(port);
  39 +
  40 +/**
  41 + * Create HTTP server.
  42 + */
  43 +
  44 +// var server = http.createServer(app);
  45 +
  46 +/**
  47 + * Listen on provided port, on all network interfaces.
  48 + */
  49 +
  50 +// server.listen(port);
  51 +// server.on('error', onError);
  52 +// server.on('listening', onListening);
  53 +
  54 +/**
  55 + * Normalize a port into a number, string, or false.
  56 + */
  57 +
  58 +function normalizePort(val) {
  59 + var port = parseInt(val, 10);
  60 +
  61 + if (isNaN(port)) {
  62 + // named pipe
  63 + return val;
  64 + }
  65 +
  66 + if (port >= 0) {
  67 + // port number
  68 + return port;
  69 + }
  70 +
  71 + return false;
  72 +}
  73 +
  74 +/**
  75 + * Event listener for HTTP server "error" event.
  76 + */
  77 +
  78 +function onError(error) {
  79 + if (error.syscall !== 'listen') {
  80 + throw error;
  81 + }
  82 +
  83 + var bind = typeof port === 'string'
  84 + ? 'Pipe ' + port
  85 + : 'Port ' + port;
  86 +
  87 + // handle specific listen errors with friendly messages
  88 + switch (error.code) {
  89 + case 'EACCES':
  90 + console.error(bind + ' requires elevated privileges');
  91 + process.exit(1);
  92 + break;
  93 + case 'EADDRINUSE':
  94 + console.error(bind + ' is already in use');
  95 + process.exit(1);
  96 + break;
  97 + default:
  98 + throw error;
  99 + }
  100 +}
  101 +
  102 +/**
  103 + * Event listener for HTTP server "listening" event.
  104 + */
  105 +
  106 +// function onListening() {
  107 +// var addr = server.address();
  108 +// var bind = typeof addr === 'string'
  109 +// ? 'pipe ' + addr
  110 +// : 'port ' + addr.port;
  111 +// debug('Listening on ' + bind);
  112 +// }
... ...
package-lock.json
1 1 {
2 2 "name": "GeoSanWeb",
3   - "version": "0.6.2",
  3 + "version": "0.7.1",
4 4 "lockfileVersion": 1,
5 5 "requires": true,
6 6 "dependencies": {
... ... @@ -381,6 +381,11 @@
381 381 "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
382 382 "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
383 383 },
  384 + "doctypes": {
  385 + "version": "1.1.0",
  386 + "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz",
  387 + "integrity": "sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk="
  388 + },
384 389 "ee-first": {
385 390 "version": "1.1.1",
386 391 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
... ... @@ -494,6 +499,11 @@
494 499 "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
495 500 "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
496 501 },
  502 + "function-bind": {
  503 + "version": "1.1.1",
  504 + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
  505 + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
  506 + },
497 507 "generic-pool": {
498 508 "version": "3.4.2",
499 509 "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.4.2.tgz",
... ... @@ -582,6 +592,14 @@
582 592 }
583 593 }
584 594 },
  595 + "has": {
  596 + "version": "1.0.3",
  597 + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
  598 + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
  599 + "requires": {
  600 + "function-bind": "^1.1.1"
  601 + }
  602 + },
585 603 "has-ansi": {
586 604 "version": "0.1.0",
587 605 "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
... ... @@ -642,11 +660,35 @@
642 660 "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
643 661 "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4="
644 662 },
  663 + "is-expression": {
  664 + "version": "3.0.0",
  665 + "resolved": "https://registry.npmjs.org/is-expression/-/is-expression-3.0.0.tgz",
  666 + "integrity": "sha1-Oayqa+f9HzRx3ELHQW5hwkMXrJ8=",
  667 + "requires": {
  668 + "acorn": "~4.0.2",
  669 + "object-assign": "^4.0.1"
  670 + },
  671 + "dependencies": {
  672 + "acorn": {
  673 + "version": "4.0.13",
  674 + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
  675 + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c="
  676 + }
  677 + }
  678 + },
645 679 "is-promise": {
646 680 "version": "2.1.0",
647 681 "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
648 682 "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
649 683 },
  684 + "is-regex": {
  685 + "version": "1.0.4",
  686 + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
  687 + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
  688 + "requires": {
  689 + "has": "^1.0.1"
  690 + }
  691 + },
650 692 "isarray": {
651 693 "version": "1.0.0",
652 694 "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
... ... @@ -674,6 +716,11 @@
674 716 "resolved": "https://registry.npmjs.org/jade-bootstrap/-/jade-bootstrap-1.0.14.tgz",
675 717 "integrity": "sha1-x99tRjinKHKZ3HUXXrUAnzJyEeg="
676 718 },
  719 + "js-stringify": {
  720 + "version": "1.0.2",
  721 + "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz",
  722 + "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds="
  723 + },
677 724 "jstransformer": {
678 725 "version": "0.0.2",
679 726 "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-0.0.2.tgz",
... ... @@ -920,6 +967,11 @@
920 967 "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz",
921 968 "integrity": "sha1-vR/vr2hslrdUda7VGWQS/2DPucE="
922 969 },
  970 + "object-assign": {
  971 + "version": "4.1.1",
  972 + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
  973 + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
  974 + },
923 975 "on-finished": {
924 976 "version": "2.3.0",
925 977 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
... ... @@ -997,6 +1049,11 @@
997 1049 "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
998 1050 "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
999 1051 },
  1052 + "path-parse": {
  1053 + "version": "1.0.5",
  1054 + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz",
  1055 + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME="
  1056 + },
1000 1057 "path-to-regexp": {
1001 1058 "version": "0.1.7",
1002 1059 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
... ... @@ -1112,6 +1169,206 @@
1112 1169 "ipaddr.js": "1.4.0"
1113 1170 }
1114 1171 },
  1172 + "pug": {
  1173 + "version": "2.0.3",
  1174 + "resolved": "https://registry.npmjs.org/pug/-/pug-2.0.3.tgz",
  1175 + "integrity": "sha1-ccuoJTfJWl6rftBGluQiH1Oqh44=",
  1176 + "requires": {
  1177 + "pug-code-gen": "^2.0.1",
  1178 + "pug-filters": "^3.1.0",
  1179 + "pug-lexer": "^4.0.0",
  1180 + "pug-linker": "^3.0.5",
  1181 + "pug-load": "^2.0.11",
  1182 + "pug-parser": "^5.0.0",
  1183 + "pug-runtime": "^2.0.4",
  1184 + "pug-strip-comments": "^1.0.3"
  1185 + }
  1186 + },
  1187 + "pug-attrs": {
  1188 + "version": "2.0.3",
  1189 + "resolved": "https://registry.npmjs.org/pug-attrs/-/pug-attrs-2.0.3.tgz",
  1190 + "integrity": "sha1-owlflw5kFR972tlX7vVftdeQXRU=",
  1191 + "requires": {
  1192 + "constantinople": "^3.0.1",
  1193 + "js-stringify": "^1.0.1",
  1194 + "pug-runtime": "^2.0.4"
  1195 + }
  1196 + },
  1197 + "pug-bootstrap": {
  1198 + "version": "0.0.15",
  1199 + "resolved": "https://registry.npmjs.org/pug-bootstrap/-/pug-bootstrap-0.0.15.tgz",
  1200 + "integrity": "sha1-Ack6s2nPGpRWdtcOoSUjaAjhIRY=",
  1201 + "requires": {
  1202 + "pug": "^2.0.0-beta3"
  1203 + }
  1204 + },
  1205 + "pug-code-gen": {
  1206 + "version": "2.0.1",
  1207 + "resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-2.0.1.tgz",
  1208 + "integrity": "sha1-CVHsgyJddNjPxHan+Zolm199BQw=",
  1209 + "requires": {
  1210 + "constantinople": "^3.0.1",
  1211 + "doctypes": "^1.1.0",
  1212 + "js-stringify": "^1.0.1",
  1213 + "pug-attrs": "^2.0.3",
  1214 + "pug-error": "^1.3.2",
  1215 + "pug-runtime": "^2.0.4",
  1216 + "void-elements": "^2.0.1",
  1217 + "with": "^5.0.0"
  1218 + },
  1219 + "dependencies": {
  1220 + "acorn": {
  1221 + "version": "3.3.0",
  1222 + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
  1223 + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo="
  1224 + },
  1225 + "acorn-globals": {
  1226 + "version": "3.1.0",
  1227 + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz",
  1228 + "integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=",
  1229 + "requires": {
  1230 + "acorn": "^4.0.4"
  1231 + },
  1232 + "dependencies": {
  1233 + "acorn": {
  1234 + "version": "4.0.13",
  1235 + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
  1236 + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c="
  1237 + }
  1238 + }
  1239 + },
  1240 + "with": {
  1241 + "version": "5.1.1",
  1242 + "resolved": "https://registry.npmjs.org/with/-/with-5.1.1.tgz",
  1243 + "integrity": "sha1-+k2qktrzLE6pTtRTyB8EaGtXXf4=",
  1244 + "requires": {
  1245 + "acorn": "^3.1.0",
  1246 + "acorn-globals": "^3.0.0"
  1247 + }
  1248 + }
  1249 + }
  1250 + },
  1251 + "pug-error": {
  1252 + "version": "1.3.2",
  1253 + "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-1.3.2.tgz",
  1254 + "integrity": "sha1-U659nSm7A89WRJOgJhCfVMR/XyY="
  1255 + },
  1256 + "pug-filters": {
  1257 + "version": "3.1.0",
  1258 + "resolved": "https://registry.npmjs.org/pug-filters/-/pug-filters-3.1.0.tgz",
  1259 + "integrity": "sha1-JxZVVbwEwjbkqisDZiRt+gIbYm4=",
  1260 + "requires": {
  1261 + "clean-css": "^4.1.11",
  1262 + "constantinople": "^3.0.1",
  1263 + "jstransformer": "1.0.0",
  1264 + "pug-error": "^1.3.2",
  1265 + "pug-walk": "^1.1.7",
  1266 + "resolve": "^1.1.6",
  1267 + "uglify-js": "^2.6.1"
  1268 + },
  1269 + "dependencies": {
  1270 + "asap": {
  1271 + "version": "2.0.6",
  1272 + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
  1273 + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
  1274 + },
  1275 + "clean-css": {
  1276 + "version": "4.1.11",
  1277 + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.1.11.tgz",
  1278 + "integrity": "sha1-Ls3xRaujj1R0DybO/Q/z4D4SXWo=",
  1279 + "requires": {
  1280 + "source-map": "0.5.x"
  1281 + }
  1282 + },
  1283 + "jstransformer": {
  1284 + "version": "1.0.0",
  1285 + "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz",
  1286 + "integrity": "sha1-7Yvwkh4vPx7U1cGkT2hwntJHIsM=",
  1287 + "requires": {
  1288 + "is-promise": "^2.0.0",
  1289 + "promise": "^7.0.1"
  1290 + }
  1291 + },
  1292 + "promise": {
  1293 + "version": "7.3.1",
  1294 + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
  1295 + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
  1296 + "requires": {
  1297 + "asap": "~2.0.3"
  1298 + }
  1299 + },
  1300 + "source-map": {
  1301 + "version": "0.5.7",
  1302 + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
  1303 + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
  1304 + }
  1305 + }
  1306 + },
  1307 + "pug-lexer": {
  1308 + "version": "4.0.0",
  1309 + "resolved": "https://registry.npmjs.org/pug-lexer/-/pug-lexer-4.0.0.tgz",
  1310 + "integrity": "sha1-IQwYRX7y4XYCQnQMXmR715TOwng=",
  1311 + "requires": {
  1312 + "character-parser": "^2.1.1",
  1313 + "is-expression": "^3.0.0",
  1314 + "pug-error": "^1.3.2"
  1315 + },
  1316 + "dependencies": {
  1317 + "character-parser": {
  1318 + "version": "2.2.0",
  1319 + "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz",
  1320 + "integrity": "sha1-x84o821LzZdE5f/CxfzeHHMmH8A=",
  1321 + "requires": {
  1322 + "is-regex": "^1.0.3"
  1323 + }
  1324 + }
  1325 + }
  1326 + },
  1327 + "pug-linker": {
  1328 + "version": "3.0.5",
  1329 + "resolved": "https://registry.npmjs.org/pug-linker/-/pug-linker-3.0.5.tgz",
  1330 + "integrity": "sha1-npp65ABWgtAn3uuWsAD4juuDoC8=",
  1331 + "requires": {
  1332 + "pug-error": "^1.3.2",
  1333 + "pug-walk": "^1.1.7"
  1334 + }
  1335 + },
  1336 + "pug-load": {
  1337 + "version": "2.0.11",
  1338 + "resolved": "https://registry.npmjs.org/pug-load/-/pug-load-2.0.11.tgz",
  1339 + "integrity": "sha1-5kjlftET/iwfRdV4WOorrWvAFSc=",
  1340 + "requires": {
  1341 + "object-assign": "^4.1.0",
  1342 + "pug-walk": "^1.1.7"
  1343 + }
  1344 + },
  1345 + "pug-parser": {
  1346 + "version": "5.0.0",
  1347 + "resolved": "https://registry.npmjs.org/pug-parser/-/pug-parser-5.0.0.tgz",
  1348 + "integrity": "sha1-45Stmz/KkxI5QK/4hcBuRKt+aOQ=",
  1349 + "requires": {
  1350 + "pug-error": "^1.3.2",
  1351 + "token-stream": "0.0.1"
  1352 + }
  1353 + },
  1354 + "pug-runtime": {
  1355 + "version": "2.0.4",
  1356 + "resolved": "https://registry.npmjs.org/pug-runtime/-/pug-runtime-2.0.4.tgz",
  1357 + "integrity": "sha1-4XjhvaaKsujArPybztLFT9iM61g="
  1358 + },
  1359 + "pug-strip-comments": {
  1360 + "version": "1.0.3",
  1361 + "resolved": "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-1.0.3.tgz",
  1362 + "integrity": "sha1-8VWVkiBu3G+FMQ2s9K+0igJa9Z8=",
  1363 + "requires": {
  1364 + "pug-error": "^1.3.2"
  1365 + }
  1366 + },
  1367 + "pug-walk": {
  1368 + "version": "1.1.7",
  1369 + "resolved": "https://registry.npmjs.org/pug-walk/-/pug-walk-1.1.7.tgz",
  1370 + "integrity": "sha1-wA1cUSi6xYBr7BXSt+fNq+QlMfM="
  1371 + },
1115 1372 "qs": {
1116 1373 "version": "6.5.1",
1117 1374 "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
... ... @@ -1171,6 +1428,14 @@
1171 1428 "semver": "^5.1.0"
1172 1429 }
1173 1430 },
  1431 + "resolve": {
  1432 + "version": "1.8.1",
  1433 + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",
  1434 + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==",
  1435 + "requires": {
  1436 + "path-parse": "^1.0.5"
  1437 + }
  1438 + },
1174 1439 "resolve-from": {
1175 1440 "version": "2.0.0",
1176 1441 "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
... ... @@ -1352,6 +1617,11 @@
1352 1617 "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
1353 1618 "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
1354 1619 },
  1620 + "token-stream": {
  1621 + "version": "0.0.1",
  1622 + "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz",
  1623 + "integrity": "sha1-zu78cXp2xDFvEm0LnbqlXX598Bo="
  1624 + },
1355 1625 "topojson": {
1356 1626 "version": "3.0.2",
1357 1627 "resolved": "https://registry.npmjs.org/topojson/-/topojson-3.0.2.tgz",
... ...
package.json
... ... @@ -34,6 +34,8 @@
34 34 "passport-google-oauth20": "^1.0.0",
35 35 "pg": "^7.4.3",
36 36 "postgeo": "*",
  37 + "pug": "^2.0.3",
  38 + "pug-bootstrap": "0.0.15",
37 39 "serve-favicon": "~2.4.5"
38 40 }
39 41 }
... ...
views/error.jade
... ... @@ -1,6 +0,0 @@
1   -extends layout
2   -
3   -block content
4   - h1= message
5   - h2= error.status
6   - pre #{error.stack}
views/error.pug 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +extends layout
  2 +
  3 +block content
  4 + h1= message
  5 + h2= error.status
  6 + pre #{error.stack}
... ...
views/index.jade
... ... @@ -1,11 +0,0 @@
1   -extends layout
2   -block content
3   - h1= title
4   - p Selecione aqui o link desejado 5000:
5   - a(href="/auth/google") Selecione aqui para logar
6   - p
7   - a(href="/map/paulo") Selecione aqui para acessar o mapa
8   - p
9   - a(href="/api/current_user") Selecione aqui para saber o usuário logado
10   - p
11   - a(href="/api/logout") Selecione aqui para fazer logout
views/index.pug 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +extends layout
  2 +block content
  3 + h1= title
  4 + p Selecione aqui o link desejado 5000:
  5 + a(href="/auth/google") Selecione aqui para logar
  6 + p
  7 + a(href="/map/paulo") Selecione aqui para acessar o mapa
  8 + p
  9 + a(href="/api/current_user") Selecione aqui para saber o usuário logado
  10 + p
  11 + a(href="/api/logout") Selecione aqui para fazer logout
... ...
views/layout.jade
... ... @@ -1,24 +0,0 @@
1   -doctype html
2   -html
3   - head
4   - title= title
5   - link(rel='stylesheet', href='/stylesheets/style.css')
6   - link(rel='stylesheet', href='http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css')
7   - link(rel="stylesheet", href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin="")
8   - script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')
9   - script(src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js')
10   - meta(http-equiv='X-UA-Compatible', content='IE=edge')
11   - meta(name='viewport', content='width=device-width, initial-scale=1.0')
12   - meta(name='description', content='Baking Bootstrap Snippets with Jade')
13   - link(rel="stylesheet", href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css")
14   - script(src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js")
15   - script(src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js")
16   - script(src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin="")
17   - link(rel='stylesheet', href='https://unpkg.com/leaflet-draw@1.0.2/dist/leaflet.draw.css')
18   - script(src="https://unpkg.com/leaflet-draw@1.0.2/dist/leaflet.draw.js")
19   - link(src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous")
20   - body
21   - .container
22   - script(src='//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')
23   - script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js')
24   -block content
views/layout.pug 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +doctype html
  2 +html
  3 + head
  4 + title= title
  5 + link(rel='stylesheet', href='/stylesheets/style.css')
  6 + link(rel='stylesheet', href='http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css')
  7 + link(rel="stylesheet", href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin="")
  8 + script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')
  9 + script(src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js')
  10 + meta(http-equiv='X-UA-Compatible', content='IE=edge')
  11 + meta(name='viewport', content='width=device-width, initial-scale=1.0')
  12 + meta(name='description', content='Baking Bootstrap Snippets with Jade')
  13 + link(rel="stylesheet", href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css")
  14 + script(src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js")
  15 + script(src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js")
  16 + script(src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin="")
  17 + link(rel='stylesheet', href='https://unpkg.com/leaflet-draw@1.0.2/dist/leaflet.draw.css')
  18 + script(src="https://unpkg.com/leaflet-draw@1.0.2/dist/leaflet.draw.js")
  19 + link(src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous")
  20 + body
  21 + .container
  22 + script(src='//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')
  23 + script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js')
  24 +block content
... ...
views/map.jade
... ... @@ -1,63 +0,0 @@
1   -extends layout
2   -block content
3   - script.
4   - function relocate_home()
5   - {
6   - location.href = "/map/" + nome.value;
7   - }
8   - #map
9   - script(type='text/javascript').
10   - var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
11   - southWest = L.latLng(#{bndSW}),
12   - northEast = L.latLng(#{bndNE}),
13   - bounds = L.latLngBounds(southWest, northEast),
14   - osmAttrib = '',
15   - osm = L.tileLayer(osmUrl,
16   - {attribution: osmAttrib}),
17   - map = L.map('map', {
18   - center: new L.LatLng(#{lat},#{lng}),
19   - zoom: #{fator_zoom},
20   - maxBounds: bounds
21   - });
22   -
23   - map.attributionControl.setPrefix('');
24   - wmsLayer= L.tileLayer.wms("#{geoserverWMS}", {
25   - layers: "#{waterLayers}",
26   - format: 'image/png',
27   - transparent: true,
28   - maxZoom: 23
29   - }),
30   - drawnItems = L.featureGroup().addTo(map);
31   -
32   - // places the logomark
33   - L.Control.Watermark = L.Control.extend({
34   - onAdd: function(map) {
35   - var img = L.DomUtil.create('img');
36   - //- img.src = "http://www.saesascs.sp.gov.br/wp-content/themes/portaldae/img/logo-saesa.png";
37   - img.src = 'https://nexusbr.com/images/logo.png';
38   - img.style.width = '130px';
39   - return img;
40   - },
41   - onRemove: function(map) {
42   - // Nothing to do here
43   - }
44   - });
45   - L.control.watermark = function(opts) {
46   - return new L.Control.Watermark(opts);
47   - }
48   - L.control.watermark({ position: 'bottomright' }).addTo(map);
49   -
50   - // places the layer control to on and off
51   - L.control.layers({
52   - "OSM": osm.addTo(map),
53   - "Google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}', {
54   - attribution: 'google'
55   - })
56   - },
57   - {'Redes': wmsLayer, 'Ocorrências': drawnItems},
58   - { position: 'topright', collapsed: false }
59   - ).addTo(map);
60   -
61   - // places the marker that was found
62   - var marker = L.marker([#{lat},#{lng}]).addTo(map);
63   - marker.bindPopup("<b>#{codigo}</b><br>#{consumidor}").openPopup();
64 0 \ No newline at end of file
views/map.pug 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +extends layout
  2 +block content
  3 + script.
  4 + function relocate_home()
  5 + {
  6 + location.href = "/map/" + nome.value;
  7 + }
  8 + #map
  9 + script(type='text/javascript').
  10 + var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
  11 + southWest = L.latLng(#{bndSW}),
  12 + northEast = L.latLng(#{bndNE}),
  13 + bounds = L.latLngBounds(southWest, northEast),
  14 + osmAttrib = '',
  15 + osm = L.tileLayer(osmUrl,
  16 + {attribution: osmAttrib}),
  17 + map = L.map('map', {
  18 + center: new L.LatLng(#{lat},#{lng}),
  19 + zoom: #{fator_zoom},
  20 + maxBounds: bounds
  21 + });
  22 +
  23 + map.attributionControl.setPrefix('');
  24 + wmsLayer= L.tileLayer.wms("#{geoserverWMS}", {
  25 + layers: "#{waterLayers}",
  26 + format: 'image/png',
  27 + transparent: true,
  28 + maxZoom: 23
  29 + }),
  30 + drawnItems = L.featureGroup().addTo(map);
  31 +
  32 + // places the logomark
  33 + L.Control.Watermark = L.Control.extend({
  34 + onAdd: function(map) {
  35 + var img = L.DomUtil.create('img');
  36 + //- img.src = "http://www.saesascs.sp.gov.br/wp-content/themes/portaldae/img/logo-saesa.png";
  37 + img.src = 'https://nexusbr.com/images/logo.png';
  38 + img.style.width = '130px';
  39 + return img;
  40 + },
  41 + onRemove: function(map) {
  42 + // Nothing to do here
  43 + }
  44 + });
  45 + L.control.watermark = function(opts) {
  46 + return new L.Control.Watermark(opts);
  47 + }
  48 + L.control.watermark({ position: 'bottomright' }).addTo(map);
  49 +
  50 + // places the layer control to on and off
  51 + L.control.layers({
  52 + "OSM": osm.addTo(map),
  53 + "Google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}', {
  54 + attribution: 'google'
  55 + })
  56 + },
  57 + {'Redes': wmsLayer, 'Ocorrências': drawnItems},
  58 + { position: 'topright', collapsed: false }
  59 + ).addTo(map);
  60 +
  61 + // places the marker that was found
  62 + var marker = L.marker([#{lat},#{lng}]).addTo(map);
  63 + marker.bindPopup("<b>#{codigo}</b><br>#{consumidor}").openPopup();
0 64 \ No newline at end of file
... ...