From 5ec1978dcb0b92d198e3f354a782cc4d4a935ed0 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 18 Dec 2015 10:26:56 +0000 Subject: [PATCH 1/6] Make data consistent from dashboard -> job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - adds a table of recent activity to the job page, which is shared by the dashboard page - uses the same filename and message template as the first job shown on the dashboard - sets the time of file uploads/message delivery/message sending to always match ‘just now’ --- app/main/views/index.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/main/views/index.py b/app/main/views/index.py index d3f2f7c16..446d52dec 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -9,6 +9,12 @@ def index(): return render_template('views/signedout.html') +@main.route("/dashboard") +@login_required +def dashboard(): + return render_template('views/dashboard.html') + + @main.route("/govuk") def govuk(): return render_template('views/govuk_template.html') From 5e0777b6965f260be6d3eb3a77b126d767798555 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 17 Dec 2015 11:14:19 +0000 Subject: [PATCH 2/6] =?UTF-8?q?Add=20messages=20to=20the=20current=20job?= =?UTF-8?q?=E2=80=99s=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This mocks out a data structure for a job’s messages, and renders this data: - on the notification page, as a table, which links through to… - …the page for an indidivual message --- app/templates/views/job.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/templates/views/job.html b/app/templates/views/job.html index 2cfd7a74e..852c92eee 100644 --- a/app/templates/views/job.html +++ b/app/templates/views/job.html @@ -13,7 +13,9 @@ GOV.UK Notify | Notifications activity {{ uploaded_file_name }} +

{{ banner(flash_message) }} +

- Sent with template {{ template_used }} at {{ uploaded_file_time }} + Sent with template {{ template_used }} at {{ uploaded_file_time }}

{% call(item) table( diff --git a/bower.json b/bower.json index 312bf3293..efa72b2c5 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,6 @@ "name": "GOV.UK Notify admin frontend", "version": "0.0.1", "dependencies": { - "jquery": "1.11.2", "govuk_template": "https://github.com/alphagov/govuk_template/releases/download/v0.16.0/jinja_govuk_template-0.16.0.tgz" } } diff --git a/gulpfile.js b/gulpfile.js index f480f2bc7..e316b67eb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,6 +34,20 @@ gulp.task('copy:govuk_template:assets', function() { // Concatenate and minify +gulp.task('jquery', function () { + return plugins.jquery.src({ + release: 1, + flags: [ + '-ajax', '-ajax/jsonp', '-ajax/load', '-ajax/parseJSON', + '-ajax/parseXML', '-ajax/script', '-ajax/var/nonce', + '-ajax/var/rquery', '-ajax/xhr', '-manipulation/_evalUrl', + '-deprecated', '-effects', '-effects/Tween', + '-effects/animatedSelector', '-effects/support', '-event-alias' + ] + }) + .pipe(gulp.dest(paths.dist + 'javascripts/')); +}); + gulp.task('javascripts', function() { return gulp.src(paths.src + 'javascripts/main.js') .pipe(plugins.include()) @@ -68,7 +82,7 @@ gulp.task('watchForChanges', function() { // Default: compile everything gulp.task('default', - ['copy:govuk_template:template', 'copy:govuk_template:assets', 'javascripts', 'sass', 'images'] + ['copy:govuk_template:template', 'copy:govuk_template:assets', 'jquery', 'javascripts', 'sass', 'images'] ); // Optional: recompile on changes diff --git a/package.json b/package.json index 20c6dd27a..6f62fee9d 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,10 @@ "bower": "1.7.1", "gulp": "3.9.0", "gulp-include": "2.1.0", + "gulp-jquery": "1.1.1", "gulp-load-plugins": "1.1.0", "gulp-sass": "2.1.1", - "gulp-uglify": "1.5.1" + "gulp-uglify": "1.5.1", + "jquery": "1.11.2" } } From 74da3b1adfc7bd98baa0f2759956e2486fad65c6 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Sun, 20 Dec 2015 00:00:01 +0000 Subject: [PATCH 5/6] Use EcmaScript 6, w/ transpiling for compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ES6 has some nice new features. Specifically relevant to this piece of work are: Arrow functions[1], whose `this` context is bound the value of `this` in the current scope and can’t be overidden. The code is cleaner as a result, and doesn’t need the addition of a bind polyfill for older browsers. Template strings[2], which are similar to triple-quoted multi line strings in Python. This means less fiddly and error-prone string concatenation. This commit adds Babel[3] to the Gulp pipeline. This transpiles Javascript written to the ES6 specification into code which is compatible with older browsers that don’t understand ES6 syntax. It also rewrites the gulpfile itself using some ES6 syntax, for the same reasons. 1. https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions 2. https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings 3. https://babeljs.io --- .travis.yml | 2 + app/assets/javascripts/highlightTags.js | 48 ++++++------- app/assets/javascripts/main.js | 9 +-- gulpfile.babel.js | 89 ++++++++++++++++++++++++ gulpfile.js | 91 ------------------------- package.json | 8 +++ 6 files changed, 120 insertions(+), 127 deletions(-) create mode 100644 gulpfile.babel.js delete mode 100644 gulpfile.js diff --git a/.travis.yml b/.travis.yml index b88f96454..f7d0352be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ addons: postgresql: '9.3' env: secure: jT9BIioqBMkOdLZhU+WJNdnRJ+06G7qUx4QqEVldp96dJwmWpPEvA0XbitdnQt/WXYkpMlDbgSApvvGj2ZNvdpowRRe5HFX8D2Udhi2g9+cXgKrQxH6zv0evJyQLOjCINW6KtgMCJ5wkYR3qQ4BQawlDt6ecpmeboKTmvs2W8jZ09aV4IKKvdd7BwFon10QVPF5ny10G83unLtKnKgRMjSSLnaEiA78pE/LSUkekK4mhmtl+yfQf60cIuQGcN9NCYIt5PrdYYyMkbUaht9ykwL2C11sp5JYPClI9k6lrlpGJCdL9wbJwejGhR/pEqwJ4tKK8Zv+mngmkbzE6fd5ehuRMnIUAifG4t3p6WbhKwY5pJsdVyPgWcRSPXOJA7yEcAeTAvWcC++6mCIFBeMxt/yQNw02jkFHeNKRh2twTRvr4xWZHq9FsVxTEVz89OOuue3IkkyDNmVusGJ9+AVRIn9Oa+U/r3bDnrs7jz+meSwb82GZUBzFpUe2pe8qeBE572Ay7yHB73VHUgp/2A1qkZ4SnTjTpMbnS5RdXTgwtMkOs5MLZgteCVxFL3sHcr9e/B3UIUnzKUSPXXOjHyDxBwrABWo81V9Vp2IPV7P9Ofv8zroudjQxK5MOcbmiPQF+eEB9L4DvkUBNsGxtJ/nmPp6tmN0Xjo0xXVdZCEVj29Og= +before_install: +- nvm install 5.0.0 install: - npm install - pip install -r requirements_for_test.txt diff --git a/app/assets/javascripts/highlightTags.js b/app/assets/javascripts/highlightTags.js index 05eee1343..2a6d7c34d 100644 --- a/app/assets/javascripts/highlightTags.js +++ b/app/assets/javascripts/highlightTags.js @@ -1,47 +1,39 @@ (function(Modules) { "use strict"; + const tagPattern = /\(\([^\)\(]+\)\)/g; + Modules.HighlightTags = function() { this.start = function(textarea) { this.$textbox = $(textarea) - .wrap( - "
" - ) - .after(this.$backgroundMaskForeground = $( - "