diff --git a/.eslintignore b/.eslintignore index 69337b2..fce1844 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ members/static/js/lib infoscreen/static/js/lib webapp/static/js/lib -global_static/js/lib +static/js/lib +collected_static diff --git a/.eslintrc.json b/.eslintrc.json index 2c290d0..c8aec53 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "env": { - "browser": true + "browser": true, + "jquery": true }, "globals": { "angular": 1, diff --git a/.gitignore b/.gitignore index b606e14..4d5ace6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,9 @@ infoscreen/static/js/hsl.json members/logs/* .idea/ logs/ -/static/ /media/ node_modules/ /.coverage db.sqlite3 requirements_henu.txt +/collected_static/ diff --git a/coffee_scale/static/js/coffee.js b/coffee_scale/static/js/coffee.js index ca97335..df052f9 100644 --- a/coffee_scale/static/js/coffee.js +++ b/coffee_scale/static/js/coffee.js @@ -12,22 +12,13 @@ $(document).ready(function(){ $(window).resize(resize); -var defaultBackoffTime = 1000; -var modified = 0; - function fetchdata(data, status){ - var backoffTime = defaultBackoffTime; - modified = 1; if (typeof status !== 'undefined'){ if (status == "success"){ - backoffTime = defaultBackoffTime; parseData(data); } else if (status == "error"){ - backoffTime *= 2; - modified = 0 handleError(); - return; } } } @@ -38,20 +29,21 @@ setInterval(function() { }, 2000); function formatBrewTime(){ - if(!brewtext && lastBrew instanceof Date){ + if (!brewtext && lastBrew instanceof Date){ var now = new Date(); - var timeDiff = Math.max(now.getTime()-lastBrew.getTime(),0); - if(timeDiff < 3600000) - tmp = Math.round(timeDiff/60000) + ' min'; - else - tmp = '~' + Math.round(timeDiff/3600000*2)/2 + ' h'; + var timeDiff = Math.max(now.getTime() - lastBrew.getTime(), 0); + var tmp = (timeDiff < 3600000) + ? Math.round(timeDiff / 60000) + ' min' + : '~' + Math.round(timeDiff / 3600000 * 2) / 2 + ' h'; + $("#brewtime").html(tmp); - }else + } else { $("#brewtime").html(brewtext); + } } -function handleError(){ - setData("?",0,0,Number.MAX_VALUE,Number.MAX_VALUE); +function handleError() { + setData("?", 0, 0, Number.MAX_VALUE, Number.MAX_VALUE); } function parseData(data) { @@ -62,7 +54,7 @@ function parseData(data) { var cups = data.cups; var brewing = data.brewing; var timeDiff = Math.max(now.getTime() - lastBrew.getTime(),0); - var opa = Math.max(100-timeDiff/90000,0); + var opa = Math.max(100 - timeDiff / 90000,0); setData(cups, data.temp, opa,now.getTime()-date.getTime(), timeDiff, brewing); } else{ @@ -71,9 +63,9 @@ function parseData(data) { } function setData(cups, temp, opa, timeFromUpdate, timeFromBrew, brewing){ - var now = new Date(); - if(cups == 0) + if (cups == 0) { opa = 0; + } brewtext = ""; $("#upper").css({opacity: opa/100}); $("#scale2").css({width: Math.min(cups/9*100,100) + '%'}); diff --git a/global_static/img/favicon.ico b/global_static/img/favicon.ico deleted file mode 100644 index 0799dd3..0000000 Binary files a/global_static/img/favicon.ico and /dev/null differ diff --git a/sikweb/base.py b/sikweb/base.py index 1e3c808..6ccab05 100644 --- a/sikweb/base.py +++ b/sikweb/base.py @@ -237,9 +237,9 @@ STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', ) STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATIC_ROOT = os.path.join(BASE_DIR, 'collected_static') STATICFILES_DIRS = ( - os.path.join(BASE_DIR, 'global_static'), + os.path.join(BASE_DIR, 'static'), ) MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' diff --git a/global_static/css/about.css b/static/css/about.css similarity index 100% rename from global_static/css/about.css rename to static/css/about.css diff --git a/global_static/css/base.css b/static/css/base.css similarity index 100% rename from global_static/css/base.css rename to static/css/base.css diff --git a/global_static/css/footer.css b/static/css/footer.css similarity index 100% rename from global_static/css/footer.css rename to static/css/footer.css diff --git a/global_static/css/lib/bootstrap.min.css b/static/css/lib/bootstrap.min.css similarity index 100% rename from global_static/css/lib/bootstrap.min.css rename to static/css/lib/bootstrap.min.css diff --git a/global_static/css/lib/simple-sidebar.css b/static/css/lib/simple-sidebar.css similarity index 100% rename from global_static/css/lib/simple-sidebar.css rename to static/css/lib/simple-sidebar.css diff --git a/global_static/img/en.png b/static/img/en.png similarity index 100% rename from global_static/img/en.png rename to static/img/en.png diff --git a/global_static/img/fi.png b/static/img/fi.png similarity index 100% rename from global_static/img/fi.png rename to static/img/fi.png diff --git a/global_static/js/lib/angular-animate.js b/static/js/lib/angular-animate.js similarity index 100% rename from global_static/js/lib/angular-animate.js rename to static/js/lib/angular-animate.js diff --git a/global_static/js/lib/angular-qrcode.js b/static/js/lib/angular-qrcode.js similarity index 100% rename from global_static/js/lib/angular-qrcode.js rename to static/js/lib/angular-qrcode.js diff --git a/global_static/js/lib/angular-route.js b/static/js/lib/angular-route.js similarity index 100% rename from global_static/js/lib/angular-route.js rename to static/js/lib/angular-route.js diff --git a/global_static/js/lib/angular.js b/static/js/lib/angular.js similarity index 100% rename from global_static/js/lib/angular.js rename to static/js/lib/angular.js diff --git a/global_static/js/lib/bootstrap.min.js b/static/js/lib/bootstrap.min.js similarity index 100% rename from global_static/js/lib/bootstrap.min.js rename to static/js/lib/bootstrap.min.js diff --git a/global_static/js/lib/jquery-3.1.0.min.js b/static/js/lib/jquery-3.1.0.min.js similarity index 100% rename from global_static/js/lib/jquery-3.1.0.min.js rename to static/js/lib/jquery-3.1.0.min.js diff --git a/global_static/js/lib/jquery.noty.packaged.js b/static/js/lib/jquery.noty.packaged.js similarity index 100% rename from global_static/js/lib/jquery.noty.packaged.js rename to static/js/lib/jquery.noty.packaged.js diff --git a/global_static/js/lib/moment.js b/static/js/lib/moment.js similarity index 100% rename from global_static/js/lib/moment.js rename to static/js/lib/moment.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/.versions b/static/js/lib/ng-file-upload-bower-12.2.11/.versions similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/.versions rename to static/js/lib/ng-file-upload-bower-12.2.11/.versions diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.flash.swf b/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.flash.swf similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.flash.swf rename to static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.flash.swf diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js b/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js rename to static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.min.js b/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.min.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.min.js rename to static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.min.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/LICENSE b/static/js/lib/ng-file-upload-bower-12.2.11/LICENSE similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/LICENSE rename to static/js/lib/ng-file-upload-bower-12.2.11/LICENSE diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/README.md b/static/js/lib/ng-file-upload-bower-12.2.11/README.md similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/README.md rename to static/js/lib/ng-file-upload-bower-12.2.11/README.md diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/bower.json b/static/js/lib/ng-file-upload-bower-12.2.11/bower.json similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/bower.json rename to static/js/lib/ng-file-upload-bower-12.2.11/bower.json diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.js b/static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.js rename to static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.min.js b/static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.min.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.min.js rename to static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.min.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.js b/static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.js rename to static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.min.js b/static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.min.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.min.js rename to static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-shim.min.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.js b/static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.js rename to static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.min.js b/static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.min.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.min.js rename to static/js/lib/ng-file-upload-bower-12.2.11/ng-file-upload.min.js diff --git a/global_static/js/lib/ng-file-upload-bower-12.2.11/package.js b/static/js/lib/ng-file-upload-bower-12.2.11/package.js similarity index 100% rename from global_static/js/lib/ng-file-upload-bower-12.2.11/package.js rename to static/js/lib/ng-file-upload-bower-12.2.11/package.js diff --git a/global_static/js/lib/qrcode.js b/static/js/lib/qrcode.js similarity index 100% rename from global_static/js/lib/qrcode.js rename to static/js/lib/qrcode.js diff --git a/global_static/js/lib/qrcode_UTF8.js b/static/js/lib/qrcode_UTF8.js similarity index 100% rename from global_static/js/lib/qrcode_UTF8.js rename to static/js/lib/qrcode_UTF8.js diff --git a/global_static/js/lib/underscore-min.js b/static/js/lib/underscore-min.js similarity index 100% rename from global_static/js/lib/underscore-min.js rename to static/js/lib/underscore-min.js