From 3303510d3dabc4c1efdf39c52db026229d909490 Mon Sep 17 00:00:00 2001 From: Roald de Vries Date: Mon, 5 Dec 2016 17:13:13 +0100 Subject: no difference between dev and prod static files --- web-ui/.jshintignore | 3 + web-ui/.jshintrc | 3 +- web-ui/Makefile | 4 +- web-ui/config/buildoptions.js | 2 +- web-ui/config/compass.rb | 8 +- web-ui/config/imagemin.js | 4 +- web-ui/config/minify_app.sh | 34 +++++++ web-ui/config/package.sh | 54 +--------- web-ui/package.json | 10 +- web-ui/public/Interstitial.js | 9 +- web-ui/public/favicon.png | Bin 0 -> 592 bytes web-ui/public/images/LOADING-transparent.gif | Bin 16170 -> 0 bytes web-ui/public/images/fa-sent.svg | 15 --- web-ui/public/images/favicon.png | Bin 592 -> 0 bytes web-ui/public/images/logo.svg | 30 ------ web-ui/public/images/pixelated-logo-orange.svg | 29 ------ .../pixelated-symbol-blue-transparent-01.png | Bin 9075 -> 0 bytes web-ui/public/images/sent_email.png | Bin 9160 -> 0 bytes web-ui/public/index.html | 113 --------------------- web-ui/public/sandbox.html | 5 +- web-ui/public/signup.html | 2 +- web-ui/src/images/LOADING-transparent.gif | Bin 0 -> 16170 bytes web-ui/src/images/fa-sent.svg | 15 +++ web-ui/src/images/favicon.png | Bin 0 -> 592 bytes web-ui/src/images/logo.svg | 30 ++++++ web-ui/src/images/pixelated-logo-orange.svg | 29 ++++++ .../pixelated-symbol-blue-transparent-01.png | Bin 0 -> 9075 bytes web-ui/src/images/sent_email.png | Bin 0 -> 9160 bytes web-ui/src/js/index.js | 6 +- 29 files changed, 139 insertions(+), 266 deletions(-) create mode 100644 web-ui/config/minify_app.sh create mode 100644 web-ui/public/favicon.png delete mode 100644 web-ui/public/images/LOADING-transparent.gif delete mode 100644 web-ui/public/images/fa-sent.svg delete mode 100644 web-ui/public/images/favicon.png delete mode 100644 web-ui/public/images/logo.svg delete mode 100644 web-ui/public/images/pixelated-logo-orange.svg delete mode 100644 web-ui/public/images/pixelated-symbol-blue-transparent-01.png delete mode 100644 web-ui/public/images/sent_email.png delete mode 100644 web-ui/public/index.html create mode 100644 web-ui/src/images/LOADING-transparent.gif create mode 100644 web-ui/src/images/fa-sent.svg create mode 100644 web-ui/src/images/favicon.png create mode 100644 web-ui/src/images/logo.svg create mode 100644 web-ui/src/images/pixelated-logo-orange.svg create mode 100644 web-ui/src/images/pixelated-symbol-blue-transparent-01.png create mode 100644 web-ui/src/images/sent_email.png (limited to 'web-ui') diff --git a/web-ui/.jshintignore b/web-ui/.jshintignore index 473c9c23..f2f274fe 100644 --- a/web-ui/.jshintignore +++ b/web-ui/.jshintignore @@ -1,5 +1,8 @@ +**/*.min.js +**/*-min.js public/node_modules public/bower_components public/js/lib public/js/generated public/signup.js +src/js/index.js diff --git a/web-ui/.jshintrc b/web-ui/.jshintrc index 1e2a147d..7debbfbe 100644 --- a/web-ui/.jshintrc +++ b/web-ui/.jshintrc @@ -33,6 +33,7 @@ "_", "Pixelated", "Handlebars", - "Bloodhound" + "Bloodhound", + "Snap" ] } diff --git a/web-ui/Makefile b/web-ui/Makefile index 0bc9d5d4..efd59c9e 100644 --- a/web-ui/Makefile +++ b/web-ui/Makefile @@ -22,13 +22,13 @@ compile: ./go package clean: - rm -Rf dist/ $(DESTDIR)/ + rm -Rf $(DESTDIR)/ install: rm -Rf $(DESTDIR)/usr/pixelated $(DESTDIR)/usr/web-ui # Fix: delete files generated by python setup.py install that are in the wrong place install -d $(DESTDIR)/usr/share/pixelated-user-agent - cp -r dist/* $(DESTDIR)/usr/share/pixelated-user-agent + cp -r public/* $(DESTDIR)/usr/share/pixelated-user-agent all: clean compile install diff --git a/web-ui/config/buildoptions.js b/web-ui/config/buildoptions.js index 2e7ba028..b0fade0d 100644 --- a/web-ui/config/buildoptions.js +++ b/web-ui/config/buildoptions.js @@ -16,7 +16,7 @@ */ ({ - baseUrl: '../public', + baseUrl: '../public', /* TODO: double check: src or public? */ wrap: true, almond: true, optimize: 'none', diff --git a/web-ui/config/compass.rb b/web-ui/config/compass.rb index bc0301a3..461bd9e2 100644 --- a/web-ui/config/compass.rb +++ b/web-ui/config/compass.rb @@ -17,13 +17,11 @@ # Set this to the root of your project when deployed: -target_dir = ENV['PIXELATED_BUILD'] == 'package' ? 'dist' : 'public' - - http_path = "/" -css_dir = "#{target_dir}/css" +css_dir = "public/css" sass_dir = "public/scss" -images_dir = "public/images" +images_dir = "src/images" +generated_images_dir = "public/images" javascripts_dir = "public/js" # You can select your preferred output style here (can be overridden via the command line): diff --git a/web-ui/config/imagemin.js b/web-ui/config/imagemin.js index bbc589a8..6f94373e 100644 --- a/web-ui/config/imagemin.js +++ b/web-ui/config/imagemin.js @@ -17,8 +17,8 @@ const imagemin = require('imagemin'); -imagemin(['public/images/*.{gif,jpg,png,svg}'], - 'dist/images' +imagemin(['src/images/*.{gif,jpg,png,svg}'], + 'public/images' ).then(files => { console.log('Images list:') files.map(function(file) { console.log(file.path); }); diff --git a/web-ui/config/minify_app.sh b/web-ui/config/minify_app.sh new file mode 100644 index 00000000..d9e232a5 --- /dev/null +++ b/web-ui/config/minify_app.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see . + +set -e + +# concat js files and minify for app.min.js +cat \ +public/bower_components/modernizr/modernizr.js \ +public/bower_components/lodash/dist/lodash.js \ +public/bower_components/jquery/dist/jquery.js \ +public/bower_components/jquery-ui/jquery-ui.js \ +public/bower_components/jquery-file-upload/js/jquery.fileupload.js \ +public/js/lib/highlightRegex.js \ +public/bower_components/handlebars/handlebars.js \ +public/bower_components/typeahead.js/dist/typeahead.bundle.js \ +public/bower_components/foundation/js/foundation.js \ +public/bower_components/foundation/js/foundation/foundation.reveal.js \ +public/bower_components/foundation/js/foundation/foundation.offcanvas.js \ +public/js/foundation/initialize_foundation.js \ +public/bower_components/iframe-resizer/js/iframeResizer.js \ +.tmp/app.concatenated.js | node_modules/.bin/minify --js > public/app.min.js diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh index d4208ecb..06351257 100644 --- a/web-ui/config/package.sh +++ b/web-ui/config/package.sh @@ -18,61 +18,11 @@ set -e -export PIXELATED_BUILD='package' - -mkdir -p dist - # initial npm tasks -./go clean -./go compass -./go handlebars -./go imagemin -./go minify_html -./go minify_sandbox -./go add_git_version -./go buildmain - +./go build -# copy files -cd public -cp --parents \ -404.html \ -fonts/* \ -locales/**/* \ -bower_components/font-awesome/css/font-awesome.min.css \ -bower_components/jquery-file-upload/css/jquery.fileupload.css \ -bower_components/font-awesome/fonts/* \ -../dist -cd - - -# concat js files and minify for app.min.js -cat \ -public/bower_components/modernizr/modernizr.js \ -public/bower_components/lodash/dist/lodash.js \ -public/bower_components/jquery/dist/jquery.js \ -public/bower_components/jquery-ui/jquery-ui.js \ -public/bower_components/jquery-file-upload/js/jquery.fileupload.js \ -public/js/lib/highlightRegex.js \ -public/bower_components/handlebars/handlebars.js \ -public/bower_components/typeahead.js/dist/typeahead.bundle.js \ -public/bower_components/foundation/js/foundation.js \ -public/bower_components/foundation/js/foundation/foundation.reveal.js \ -public/bower_components/foundation/js/foundation/foundation.offcanvas.js \ -public/js/foundation/initialize_foundation.js \ -public/bower_components/iframe-resizer/js/iframeResizer.js \ -.tmp/app.concatenated.js > dist/app.js -node_modules/.bin/minify dist/app.js > dist/app.min.js -rm dist/app.js - -if [ ! -s dist/app.min.js ] +if [ ! -s public/app.min.js ] then echo "Minification failed!" exit 1; fi - -# concat js files and minify for sandbox.min.js -cat \ -public/js/sandbox.js \ -public/bower_components/iframe-resizer/js/iframeResizer.contentWindow.js > dist/sandbox.js -node_modules/.bin/minify dist/sandbox.js > dist/sandbox.min.js -rm dist/sandbox.js diff --git a/web-ui/package.json b/web-ui/package.json index b10ff51e..83931b09 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -35,15 +35,15 @@ "handlebars-watch": "node_modules/.bin/watch 'npm run handlebars' public/templates", "compass": "compass compile", "compass-watch": "compass watch", - "build": "npm run clean && npm run handlebars && npm run add_git_version && npm run compass && npm run build-signup", + "build": "npm run clean && npm run handlebars && npm run add_git_version && npm run compass && npm run imagemin && npm run build-signup && npm run buildmain && npm run minify_app && npm run minify_sandbox", "build-signup": "babel src/js -d lib/js && browserify lib/js/index.js >public/signup.js", - "jshint": "node_modules/jshint/bin/jshint --config=.jshintrc public test", - "clean": "rm -rf .tmp/ 'dist/*' public/js/generated/hbs/* public/css/*", + "jshint": "node_modules/jshint/bin/jshint --config=.jshintrc src public test", + "clean": "rm -rf .tmp/ public/js/generated/hbs/* public/css/* lib/js public/signup.js", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", + "minify_app": "/bin/bash config/minify_app.sh", + "minify_sandbox": "cat public/js/sandbox.js public/bower_components/iframe-resizer/js/iframeResizer.contentWindow.js | node_modules/.bin/minify --js > public/sandbox.min.js", "package": "/bin/bash config/package.sh", "imagemin": "node config/imagemin.js", - "minify_html": "node_modules/.bin/html-minifier public/index.html --collapse-whitespace | sed 's|.*||' > dist/index.html", - "minify_sandbox": "node_modules/.bin/html-minifier public/sandbox.html --collapse-whitespace | sed 's|.*||' > dist/sandbox.html", "add_git_version": "/bin/bash config/add_git_version.sh" }, "dependencies": { diff --git a/web-ui/public/Interstitial.js b/web-ui/public/Interstitial.js index ac5a789a..05c5ff29 100644 --- a/web-ui/public/Interstitial.js +++ b/web-ui/public/Interstitial.js @@ -1,7 +1,7 @@ if ($('#hive').length) { var hive = new Snap('#hive'); var img_width = $('#hive').width(); - var left_pos = img_width * .5; + var left_pos = img_width * 0.5; var pixelated = hive.path("M12.4,20.3v31.8l28,15.8l28-15.8V20.3l-28-15.8L12.4,20.3z M39.2,56.4l-16.3-9V27.9l16.3,9.3L39.2,56.4z M57.7,47.4l-16.1,9l0-19.2l16.1-9.4V47.4z M57.7,25.2L40.4,35.5L22.9,25.2l17.5-9.4L57.7,25.2z").transform("translate(319, 50)").attr("fill", "#908e8e"); var all = hive.group().transform("matrix(2, 0, 0, 2, -100, -100)"); @@ -14,8 +14,8 @@ if ($('#hive').length) { for (var j = 0; j < rows; j++) { for (var i = 0; i < cols; i++) { - x = i * width + (j%2*width/2); - y = j * height; + var x = i * width + (j%2*width/2); + var y = j * height; all.add(pixelated.clone().transform("translate("+x+","+y+")")); } } @@ -23,6 +23,7 @@ if ($('#hive').length) { all.add(pixelated); var brightenLogo = function () { + 'use strict'; var glowPosition = Math.floor(Math.random()*rows*cols); all[glowPosition].animate({fill: "#FFF"}, 1000, function() { @@ -31,6 +32,7 @@ if ($('#hive').length) { }; var darkenLogo = function (el) { + 'use strict'; el.animate({fill: "#908e8e"}, 1000, brightenLogo); }; @@ -39,6 +41,7 @@ if ($('#hive').length) { } $(function () { + 'use strict'; var handler = setInterval(function () { $.ajax({ method: 'GET', diff --git a/web-ui/public/favicon.png b/web-ui/public/favicon.png new file mode 100644 index 00000000..e14841c7 Binary files /dev/null and b/web-ui/public/favicon.png differ diff --git a/web-ui/public/images/LOADING-transparent.gif b/web-ui/public/images/LOADING-transparent.gif deleted file mode 100644 index ac9abcde..00000000 Binary files a/web-ui/public/images/LOADING-transparent.gif and /dev/null differ diff --git a/web-ui/public/images/fa-sent.svg b/web-ui/public/images/fa-sent.svg deleted file mode 100644 index a4b4bea4..00000000 --- a/web-ui/public/images/fa-sent.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - fa-sent - Created with Sketch. - - - - - - - - - - \ No newline at end of file diff --git a/web-ui/public/images/favicon.png b/web-ui/public/images/favicon.png deleted file mode 100644 index e14841c7..00000000 Binary files a/web-ui/public/images/favicon.png and /dev/null differ diff --git a/web-ui/public/images/logo.svg b/web-ui/public/images/logo.svg deleted file mode 100644 index 6c2d8989..00000000 --- a/web-ui/public/images/logo.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/web-ui/public/images/pixelated-logo-orange.svg b/web-ui/public/images/pixelated-logo-orange.svg deleted file mode 100644 index 7e0ef43d..00000000 --- a/web-ui/public/images/pixelated-logo-orange.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/web-ui/public/images/pixelated-symbol-blue-transparent-01.png b/web-ui/public/images/pixelated-symbol-blue-transparent-01.png deleted file mode 100644 index 96b92155..00000000 Binary files a/web-ui/public/images/pixelated-symbol-blue-transparent-01.png and /dev/null differ diff --git a/web-ui/public/images/sent_email.png b/web-ui/public/images/sent_email.png deleted file mode 100644 index ddaa11d0..00000000 Binary files a/web-ui/public/images/sent_email.png and /dev/null differ diff --git a/web-ui/public/index.html b/web-ui/public/index.html deleted file mode 100644 index 0a6303b2..00000000 --- a/web-ui/public/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - -$account_email - Pixelated Mail - - - - - - - - - - -
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-
    -
    - -
    -
      -
    -
    -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - diff --git a/web-ui/public/sandbox.html b/web-ui/public/sandbox.html index 8325b0da..d24a8452 100644 --- a/web-ui/public/sandbox.html +++ b/web-ui/public/sandbox.html @@ -5,10 +5,7 @@ - - - - + diff --git a/web-ui/public/signup.html b/web-ui/public/signup.html index a1d4bef9..9814f585 100644 --- a/web-ui/public/signup.html +++ b/web-ui/public/signup.html @@ -10,7 +10,7 @@ -
    +
    diff --git a/web-ui/src/images/LOADING-transparent.gif b/web-ui/src/images/LOADING-transparent.gif new file mode 100644 index 00000000..ac9abcde Binary files /dev/null and b/web-ui/src/images/LOADING-transparent.gif differ diff --git a/web-ui/src/images/fa-sent.svg b/web-ui/src/images/fa-sent.svg new file mode 100644 index 00000000..a4b4bea4 --- /dev/null +++ b/web-ui/src/images/fa-sent.svg @@ -0,0 +1,15 @@ + + + + fa-sent + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/web-ui/src/images/favicon.png b/web-ui/src/images/favicon.png new file mode 100644 index 00000000..e14841c7 Binary files /dev/null and b/web-ui/src/images/favicon.png differ diff --git a/web-ui/src/images/logo.svg b/web-ui/src/images/logo.svg new file mode 100644 index 00000000..6c2d8989 --- /dev/null +++ b/web-ui/src/images/logo.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/web-ui/src/images/pixelated-logo-orange.svg b/web-ui/src/images/pixelated-logo-orange.svg new file mode 100644 index 00000000..7e0ef43d --- /dev/null +++ b/web-ui/src/images/pixelated-logo-orange.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + diff --git a/web-ui/src/images/pixelated-symbol-blue-transparent-01.png b/web-ui/src/images/pixelated-symbol-blue-transparent-01.png new file mode 100644 index 00000000..96b92155 Binary files /dev/null and b/web-ui/src/images/pixelated-symbol-blue-transparent-01.png differ diff --git a/web-ui/src/images/sent_email.png b/web-ui/src/images/sent_email.png new file mode 100644 index 00000000..ddaa11d0 Binary files /dev/null and b/web-ui/src/images/sent_email.png differ diff --git a/web-ui/src/js/index.js b/web-ui/src/js/index.js index 57ec42a6..8e66db06 100644 --- a/web-ui/src/js/index.js +++ b/web-ui/src/js/index.js @@ -16,7 +16,7 @@ class PixelatedComponent extends React.Component { } componentWillUnmount() { - this.unsubscribe() + this.unsubscribe(); } } @@ -26,7 +26,7 @@ class PixelatedForm extends PixelatedComponent { const immutableActionProperties = new Map(actionProperties); this.props.store.dispatch(immutableActionProperties.merge({status: 'STARTED'}).toJS()); fetch(url).then((response) => { - return response.json() + return response.json(); }).then((json) => { setTimeout(() => { this.props.store.dispatch(immutableActionProperties.merge({status: 'SUCCESS', json: json}).toJS()); @@ -93,7 +93,7 @@ class CreateAccountForm extends PixelatedForm { _handleClick(event) { event.stopPropagation(); event.preventDefault(); - this.props.store.dispatch({type: 'SUBMIT_CREATE_ACCOUNT', username: event.target['username'].value, password: event.target['password'].value}); + this.props.store.dispatch({type: 'SUBMIT_CREATE_ACCOUNT', username: event.target.username.value, password: event.target.password.value}); } } -- cgit v1.2.3