From 3ed415fb7516c6acc5b98c4a73160511404ae055 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Sun, 20 Dec 2015 00:00:01 +0000 Subject: [PATCH] Enhance message textbox by styling placeholders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users can add placeholders to their messages, eg > …your vehicle ((registration number)) when the message is sent, this gets replaced with the data the user uploads, eg > …your vehicle LC12 BFL We reckon that it will be useful to see that the placeholder has been recognised, ie that its syntax is correct, before uploading any data. We reckon that the best way to do this is by styling it differently to the rest of the text that the user types. This is not a trivial problem. There are two possible ways to do it: 1 Write a Google Docs-style text rendering engine, which completely replaces the native HTML ` + {% endif %} {% endmacro %} diff --git a/app/templates/views/edit-template.html b/app/templates/views/edit-template.html index 4570b3e61..b17b5b64c 100644 --- a/app/templates/views/edit-template.html +++ b/app/templates/views/edit-template.html @@ -12,7 +12,7 @@ GOV.UK Notify | Edit template
{{ textbox(name='template_name', label='Template name', value=template_name) }} - {{ textbox(name='template_body', label='Message', small=False, value=template_body) }} + {{ textbox(name='template_body', label='Message', small=False, value=template_body, highlight_tags=True) }} {{ submit_form('Save and continue') }}
diff --git a/app/templates/views/job.html b/app/templates/views/job.html index 852c92eee..963ff1810 100644 --- a/app/templates/views/job.html +++ b/app/templates/views/job.html @@ -38,7 +38,7 @@ GOV.UK Notify | Notifications activity

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