Commit Graph

338 Commits

Author SHA1 Message Date
Martyn Inglis
416fa30929 Make the £ string a unicode string 2016-01-06 12:57:09 +00:00
Martyn Inglis
260e1bad85 Removed build to heroku 2016-01-06 11:44:13 +00:00
Martyn Inglis
f92a46f419 updated readme 2016-01-06 11:37:37 +00:00
Rebecca Law
43a423b027 Update README.md
Added instructions to install n for node version management
2016-01-06 11:14:04 +00:00
minglis
3cbaa00930 Merge pull request #42 from alphagov/file-encoding
Added encoding to file
2016-01-06 11:10:59 +00:00
Martyn Inglis
b9895a805c Added encoding to file 2016-01-06 11:03:29 +00:00
minglis
f9457d739e Merge pull request #41 from alphagov/putting-aws-back
Putting AWS back
2016-01-06 10:41:21 +00:00
minglis
d179970032 Merge pull request #37 from alphagov/templating-flow
Manage templates flow
2016-01-06 09:45:01 +00:00
Martyn Inglis
6943c88c48 Putting AWS back 2016-01-06 09:40:53 +00:00
Chris Hill-Scott
84cdd2f4f0 Add Javascript feature detection for oninput
This commit adds a feature detection for the `oninput` event, which isn’t
supported in older browsers[1].

This means that the code that highlights placeholders will only be run in
browsers that support the `oninput` event.

1. http://caniuse.com/#feat=input-event
2016-01-06 09:39:42 +00:00
Chris Hill-Scott
74da3b1adf Use EcmaScript 6, w/ transpiling for compatibility
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
2016-01-06 09:39:42 +00:00
Chris Hill-Scott
3ed415fb75 Enhance message textbox by styling placeholders
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 `<textarea>` with a custom control, and programme what should
  happen when the user types something that looks like a placeholder, or
  presses an arrow key, or makes a selection, or…
2 Leave the `<textarea>` in place, unmodified, and duplicate layers in front
  of/behind it to visually replace a placeholder with the blue lozenge

Unsurprisingly, this commit implements 2.

There are four layers. Each layer contains live-updated copy of the text in the
textbox, and each is styled differently:
- one layer behind the textbox to make the blue background
- the textbox itself
- a layer with the white text, which overlays the black text of the textbox
- a layer with an inner shadow to knock back the brackets

This is because of some interesting limitations:
- The text in the foreground and background must occupy the same physical space,
  so no deleting characters from the duplicated layers
- Words can’t be split up into multiple elements,
  eg `<span>((</span>regist…`:—this results in slightly different kerning to
  `((regis…`, which messes up the alignment of the layers
- The textbox can’t be completely overlapped with a block of colour, because
  the cursor disappears behind it. Trying to edit text when you can’t see the
  cursor is hard.

Implementation

Technically this makes use of Paul Hayes work on Javascript modules in the
GOV.UK frontend toolkit[1].

It also makes use of the `oninput` event to detect changes to the textbox’s
contents. This is much more performant than `onkeydown`, `onpaste`, etc. Without
it the delay between user input and the layers all updating is too slow and you
see misalignment of the layers.

1. https://github.com/alphagov/govuk_frontend_toolkit/pull/227
2016-01-06 09:39:42 +00:00
Chris Hill-Scott
ba48707371 Add routing and pages for managing templates
So that users can see what it the flow is like to:
- add new templates
- edit existing templates
2016-01-06 09:39:42 +00:00
Chris Hill-Scott
5e0777b696 Add messages to the current job’s history
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
2016-01-06 09:39:42 +00:00
Chris Hill-Scott
5ec1978dcb Make data consistent from dashboard -> job
- 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’
2016-01-06 09:39:42 +00:00
minglis
503c931a0a Merge pull request #36 from alphagov/service-activity-flow
Service activity flow
2016-01-06 09:36:23 +00:00
minglis
a109c6e82b Merge pull request #34 from alphagov/quarter-width-nav
Make navigation column 1/4 width
2016-01-06 09:35:35 +00:00
minglis
13b700bd0d Merge pull request #33 from alphagov/node-based-asset-compilation
Use a Node-based tools for handling assets
2016-01-06 09:34:19 +00:00
Chris Hill-Scott
450c7aaeaa Remove log of activity from single notification
Having the full history of the message is more information than is necessary.
We should only show what stage the message is at, and the time that it reached
that stage.

We can do research later on to find out if users understand or care about the
different stages.
2016-01-05 13:31:54 +00:00
Chris Hill-Scott
cad5698754 Add big numbers to dashboard
A suggestion of what high-level information users might need on the dashboard
page.
2016-01-05 13:31:54 +00:00
Chris Hill-Scott
96c3291600 ‘Messages’ is a more human word than ‘notifications’ 2016-01-05 13:31:54 +00:00
Chris Hill-Scott
31e6e53d46 Make data consistent from dashboard -> job
- 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’
2016-01-05 13:31:54 +00:00
Chris Hill-Scott
0e6dab3f5c Add unit tests for activity (and SMS) flows
These are basic tests to make sure that the pages stay stitched together.

Added for both the jobs and send SMS flows (because the send SMS flow didn’t
have any before)
2016-01-05 13:31:54 +00:00
Chris Hill-Scott
d4a03a40c8 Add message history 2016-01-05 13:31:54 +00:00
Chris Hill-Scott
034c70bc97 Add a banner ✔ 2016-01-05 13:31:54 +00:00
Chris Hill-Scott
2acf599c04 Add big number component…
…and count the messages to display some totals
2016-01-05 13:31:53 +00:00
Chris Hill-Scott
aa0663cad8 Add messages to the current job’s history
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
2016-01-05 13:31:53 +00:00
Chris Hill-Scott
6bdc0d3fce Tidy up navigation code
- use SASS variables for colours and spacing
- make navigation an include not a macro (because it doesn’t take any
  parameters)
2016-01-05 13:22:08 +00:00
Chris Hill-Scott
ab190cb585 Make navigation column 1/4 width 2016-01-05 13:22:08 +00:00
Rebecca Law
e1c2ba034d Turn on debug for live 2016-01-05 13:17:01 +00:00
Rebecca Law
f1291b7c09 Adding logging.
Raise ValidationError for validate_codes rather than returning a true or false.
2016-01-05 13:13:06 +00:00
Chris Hill-Scott
fd4c4107ac Remove Flask Assets
This commit’s parent introduces a Node-based way of managing front end assets.

Nothing else is needed in the app, specifically not Flask Assets. Flask itself
automatically routes requests for `domain.tld/static/*` to the files in
`app/static`.

This also removes all the Ruby stuff.
2016-01-05 13:12:35 +00:00
Chris Hill-Scott
5ebeec08ae Use a Node-based tools for handling assets
…or how to move a bunch of things from a bunch of different places into
`app/static`.

There are three main reasons not to use Flask Assets:
- It had some strange behaviour like only
- It was based on Ruby SASS, which is slower to get new features than libsass,
  and meant depending on Ruby, and having the SASS Gem globally installed—so
  you’re already out of being a ‘pure’ Python app
- Martyn and I have experience of doing it this way on Marketplace, and we’ve
  ironed out the initial rough patches

The specific technologies this introduces, all of which are Node-based:
- Gulp – like a Makefile written in Javascript
- NPM – package management, used for managing Gulp and its related dependencies
- Bower – also package management, and the only way I can think to have
  GOV.UK template as a proper dependency

…speaking of which, GOV.UK template is now a dependency. This means it can’t be
modified at all (eg to add a global `#content` wrapper), so every page now
inherits from a template that has this wrapper. But it also means that we have a
clean upgrade path when the template is modified.

Everything else (toolkit, elements) I’ve kept as submodules but moved them to a
more logical place (`app/assets` not `app/assets/stylesheets`, because they
contain more than just SASS/CSS).
2016-01-05 13:12:35 +00:00
Rebecca Law
1fd6ce9fe4 fix codestyle 2016-01-05 12:40:01 +00:00
Rebecca Law
931c6b2809 Add debugging to find issue. 2016-01-05 12:35:36 +00:00
Rebecca Law
3d437ba653 revert bundle version 2016-01-05 12:01:11 +00:00
Rebecca Law
0eabdc06be try again 2016-01-05 11:59:25 +00:00
Rebecca Law
41b59fdebe Remove bundle install 2016-01-05 11:53:09 +00:00
Rebecca Law
ea9187a7ec Removing the aws deployment commands until aws is running again 2016-01-05 11:48:24 +00:00
Rebecca Law
eab451a38b Removing ruby versions 2016-01-05 11:39:54 +00:00
Rebecca Law
c691becba2 Trying version 1.9.3 2016-01-05 11:28:57 +00:00
Rebecca Law
4cb2310359 Use version 2.0.0 2016-01-05 11:22:03 +00:00
Rebecca Law
8c72166ebe Bah! Another attempt. 2016-01-05 11:04:29 +00:00
Rebecca Law
e3d96644c7 Attempts at fixing the deploy - but it seems PR 33 will fix it anyway. 2016-01-05 10:51:04 +00:00
NIcholas Staples
29e0295df0 Merge pull request #39 from alphagov/change_add_service_form
Refactor add-service form such that the dao is not exposed in the forms.
2016-01-04 17:24:07 +00:00
Rebecca Law
785c413cde Move and rename macro.html
Remove print statements
Fix code style
2016-01-04 15:50:26 +00:00
Rebecca Law
ac05f6931e Refactor add-service form such that the dao is not exposed in the forms. 2016-01-04 15:31:50 +00:00
Rebecca Law
75bafd7a7d Add the Gemfile.lock back 2016-01-04 14:01:50 +00:00
Nicholas Staples
989d914326 Update the travis file to upgrade ruby version to 2.0.0. 2016-01-04 13:55:29 +00:00
Nicholas Staples
74a6879e3f Update to Gemfile to add ruby for heroku deployment. 2016-01-04 13:44:30 +00:00