Commit Graph

24 Commits

Author SHA1 Message Date
Nicholas Staples
a9fead0d82 Merge with master. 2016-01-19 09:49:01 +00:00
Chris Hill-Scott
81d4230b61 Page for adding a new service
This page is exactly the same as the page for adding your first service, save
the heading text.

So all this commit does is:
- set up two routes (`/add-service`, `/add-service/first`) for each of the two
  journeys and change the existing journeys to use the `/add-service/first`
  route
- add logic to show different heading text depending on the journey
- add a link to the new (`/add-service`) route in the service chooser dropdown
2016-01-18 11:03:25 +00:00
Nicholas Staples
4e2019c949 Work in progress, all tests passing and implemented mocks for services_dao. 2016-01-15 17:46:09 +00:00
Chris Hill-Scott
1e0f5c27b9 Add link to delete a template
This is a link not a button because:
- it’s less prominent—delete is an infrequent action
- it’s a two-step process, and only the second part changes any data (so it has
  a button)
2016-01-14 10:59:51 +00:00
Chris Hill-Scott
04b9c120d4 Add mocked service ID to all service-specific pages 2016-01-13 12:44:12 +00:00
Chris Hill-Scott
4cb535a2e1 Add progressive enhancement to service switcher
- by default, the menu is open
- if Javascript is enabled/loaded, the links are hidden, and visual cues (▶) to
  show that it can be opened are added
- clicking it opens and closes it
2016-01-12 11:47:02 +00:00
Chris Hill-Scott
732efd25c7 Refactor markup
Strips it down to only what’s necessary

As a separate commit for easier diffing.
2016-01-12 11:47:02 +00:00
Chris Hill-Scott
934ce51f2c Use user’s real name, not a placeholder 2016-01-12 11:47:02 +00:00
Chris Hill-Scott
7be32be70d Fix code whitespace
As a separate commit for easier diffing
2016-01-12 11:47:02 +00:00
Chris Heathcote
8dbf266e87 Design showing opened service switcher 2016-01-12 11:47:02 +00:00
Chris Heathcote
884e4e8057 Added in bar containing service name, user name/link to profile and sign out 2016-01-12 11:47:02 +00:00
Chris Hill-Scott
e8fe8c50ba Add a WTForms-compatible textbox macro
This macro:
- accepts a WTForm form field as a parameter
- renders a form field which follows the GOV.UK Elements patterns, both visually
  and in markup terms

It then changes any page which uses either:
- the old, non-WTForms macro or
- the old, WTFforms `render_field` macro

…to use this new macro and removes both of the old ones.

It also adds the option to display hint text above the textbox.
2016-01-11 15:20:00 +00:00
Rebecca Law
a860f713d2 Implementation of the new_password endpoint.
Found a way to create the token that does not need to persist it to the database.
This requires proper error messages, written by people who speak menglis good.
2016-01-11 12:23:07 +00:00
Chris Hill-Scott
4d10eec1e2 Rename submit_form component to page_footer
Submit form was
- a confusing name in itself
- not descriptive, because it also has an optional ‘back’ link

This commit also puts this component in as many pages as possible, stripping
out any hard-coded buttons and links.

It replaces any usage of buttons for ‘back’, because these are links, not
buttons (ie they don’t change any data).
2016-01-08 15:02:08 +00:00
Nicholas Staples
7001d8261d Fix for security hole with setting session['user_id'] before second factor of authentication has been authorised. 2016-01-07 12:43:10 +00:00
Nicholas Staples
0a4ea6ca2e Merge branch 'master' into provide_logout_link 2016-01-06 17:06:04 +00:00
Nicholas Staples
5905229714 Logout functionality and test added. 2016-01-06 16:40:38 +00:00
Nicholas Staples
6fc39d1814 Add in macro import to our template, not govuk_template 2016-01-06 11:37:59 +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
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
Chris Hill-Scott
a5f4580a7f Get SASS compilation working
Main thing that was missing was including the main CSS file in the template.

There are a few hacky bits here, like moving the whole of toolkit inside the
stylesheets directory.

Would arguably be cleaner using something that isn’t Flask Assets, but that’s
something for later.
2015-12-11 09:48:59 +00:00
Chris Heathcote
12cbc04080 Changed main GOV.UK link depending on whether user is logged in or not
Goes to / for not logged in, /dashboard for logged in.
2015-12-07 16:18:05 +00:00
Chris Heathcote
da80013ec9 Adding beta phase banner 2015-12-03 16:01:00 +00:00
Chris Heathcote
701ce482d4 Create base forms for registration and sign in
Created routes and forms for registration, sign in, and registration
from an invite.
Also tidied up assets folder, removed copy of fronted toolkit.
2015-11-26 10:18:37 +00:00