Commit Graph

70 Commits

Author SHA1 Message Date
Chris Hill-Scott
784f577c4d Improve redraw performance
It’s noticeable when clicking from row to row in the spreadsheet that
the page jumps around a fair bit on load because there are a couple of
Javascript-powered components.

This commit makes sure:
- the radio select component doesn’t change height when rendering for
  the first time
- the scrollable table doesn’t show parts of the table that should be
  hidden by overflow for a fraction of second before all the JS has
  run
- the right-hand shadow on horizontally scrollable tables doesn’t fade
  in on initial page load but shows at 100% opacity immediately
2018-01-15 14:45:38 +00:00
Chris Hill-Scott
aa22568c64 Fix bug horizontal scrollbar being pushed off page
We weren’t calculating the height quite right; we were trying to
compensate for something that should have been compensated for in the
`stick-at-top-when-scrolling` code.

Add the 5px to the shim there is required because we’re adding it to the
element that the shim in replacing.
2017-12-20 15:37:34 +00:00
Chris Hill-Scott
c6f54966bf Change tables to scroll in-page, not full screen
There were three problems with showing tables fullscreen:
- it was over-optimised for very big spreadsheets, whereas most users
  will only have a few columns in their files
- it was jarring to go from full screen and back to the normal layout
- it was a bit change for existing users, where we prefer incremental
  changes that make things better without disrupting people’s work
  (where possible)

So this commit changes the big table to scroll horizontally in the page,
not take up the full width of the page.

From the fullscreen table it keeps:
- the shimming method to keep the horizontal scrollbar at the bottom of
  the screen at all times

It introduces some more refinements to make it nicer to use:
- fixing the first column, so you always know what row you’re on
- adding shadows indicate where there is content that’s scrolled outside
  the edges of the container
2017-12-20 12:09:18 +00:00
Chris Hill-Scott
8bfb67c702 Go fullscreen for row-level errors in spreadsheets
Two bits of context:

1. As we start dealing with letters, which have more columns, it’s more
   likely that people’s spreadsheets won’t fit in our current layout.

2. We already removed the view of the template from the page that shows
   row-level errors (eg bad phone number or missing personalisation) in
   spreadsheets because you don’t need to know about the content of the
   message in order to fix the errors.

This commit goes further by removing anything that isn’t to do with
the errors, including the normal GOV.UK header and the service’s
navigation.

This means the content can go the width of the page, which means it can
be allowed to scroll horizontally without being a usability car
crash. Which means that the layout doesn’t break with a spreadsheet that
has lots of columns.
2017-12-20 12:09:18 +00:00
Chris Hill-Scott
4ac90c066a Prevent doubling clicking form submissions
Have seen users complaining that they got an invitation email twice.
This is probably because they clicked the button twice even though they
think they only clicked it once.

Double form submission is a common issue on web pages, and there are a
number of different ways to prevent it. I’ve chosen to do it this way
because:
- temporarily, not permanently disabling the button means that this
  addresses the double clicking issue without breaking things if the
  user did, really want to click the button again deliberately (for
  whatever reason)
- doing it with a `data` attribute, rather than the `disabled` attribute
  means that the interaction behaviour of the button doesn’t change (
  `disabled` buttons can’t be focused, for example)
2017-09-15 14:29:56 +01:00
Chris Hill-Scott
82233340b6 Track errors when uploading spreadsheets
Uses the new javascript event tracking stuff so that we can see what
errors people are getting when they upload spreadsheets.
2017-07-20 12:06:15 +01:00
Chris Hill-Scott
eb264f34b7 Add a little JS module to track events
Google analytics lets you send:
- pageviews
- events

Page views are used by default. But sometimes you wanna count something
which isn’t the user navigating to a new page, or you wanna track
something which isn’t just what page they were looking it. This is where
events are useful.

This commit adds a small JS module that lets us fire off an event when
the presence of an element with the right data attributes are present on
the page.
2017-07-20 12:06:15 +01:00
Chris Hill-Scott
681cea1d34 Make AJAX requests on activity page POST not GET
See parent commit for the reason we’re doing this.

Currently our AJAX requests only work as `GET` requests. So this commit
does a bit of work to make them work as `POST` requests. This is
optional behaviour, and will only happen when the element in the page
that should be updated with AJAX has the `data-form` attribute set. It
will take the form that has the corresponding `id`, serialise it, and
use that data as the body of the post request. If not form is specified
it will not do the serialisation, and submit as a `GET` request as
before.
2017-06-13 12:15:04 +01:00
Chris Hill-Scott
3106ea0e15 Make send yourself a test form stay at top of page
You might need to scroll this page quite a lot to see where a
placeholder appears in your template – especially if you have a long
email or letter.

One of the things I’m trying to stop happening so much is a lot of
scrolling back and forth. This would happen if you were scrolling down
to see the placeholder, then back up to fill in its value.

So this commit makes the textbox ‘sticky’, ie it always stays at the top
of the viewport, even when you scroll down. This lets you see the
placeholder and the textbox side by side, no matter how long the
template is.

The code to do this mostly comes from the GOV.UK Frontend Toolkit
(documented here: d9489a9870/docs/javascript.md (stick-at-top-when-scrolling)).
I had to add some extra CSS to make it look good when it overlaps the
content of the page, which the GOV.UK Frontend Toolkit implementation
doesn’t really anticipate.
2017-05-22 10:50:41 +01:00
Chris Hill-Scott
e9754e92df Add a back button to the scheduler
We’ve seen in research a user getting stuck playing with the
scheduler. They picked a day, but then didn’t want to choose one of the
options for that day. There’s no way to do this except pick a day and
then un-pick it.

What they ended up doing was clicking the grey back button, which took
them back to the previous page, making them upload their file again.

This commit adds a ‘back’ link for the scheduler. ‘Back’ seems like
sensible naming because that’s the thing that the user tried to click,
and the UI of a link matches the thing they clicked to get into this
situation.
2017-04-26 11:36:45 +01:00
Chris Hill-Scott
d731de6edf Fix the focus handling on the scheduler
This got broken when we removed the old GOV.UK Selection Buttons
javascript in a592898eff
2017-04-26 11:34:39 +01:00
Chris Hill-Scott
8d5af47620 Change class names for validation errors in html
Implements the class name changes detailed in:
https://github.com/alphagov/govuk_elements/pull/405
2017-04-10 14:54:27 +01:00
Chris Hill-Scott
a592898eff Make radio select work w/ new checkboxes/radios
The visual appearance of radio and checkbox form inputs changed in
GOV.UK Elements here:

https://github.com/alphagov/govuk_elements/pull/296

This was subsequently reimplemented with different markup and no
Javascript here:
https://github.com/alphagov/govuk_elements/pull/406

This has meant making the following changes to our app:
- changing the markup in our radio/checkbox macros to match the example
  markup given by GOV.UK Elements
- removing the previous Javascript file because it’s no longer needed to
  make the radios appear visual selected
- making the buttons on the scheduled job picker look like links,
  because the grey button style looked weird with the new radio buttons
2017-04-10 14:18:12 +01:00
Chris Hill-Scott
f3c7a167df Add find-as-you-type on the choose template page
Not everyone knows how to use `ctrl` + `f`, and it’s not scoped to
just the list of templates.

The template you want to work with is often not the first one in the
list, but ordering by created at is useful for other reasons (mainly
around first time use).

This commit adds a find as you type control which aims to give users a
quick way of getting to the template they want to work with.
2017-03-20 11:40:19 +00:00
Chris Hill-Scott
cd7cb8884c Send focus to error summary before single error
> If both sections of the page have errors and the page is submitted,
> focus moves to the mobile numbers section so screen reader users may
> not be aware of preceding errors - focus should move to a dedicated
> error summary at the top of the page.

Right now we use Javascript to focus the first error on a page (if any
errors are found). This commit adds more JS to then focus the error
summary, if there is one on the page. So this is where the focus will
rest.

It also makes some modifications to the ‘dangerous’ banner to make it
focusable, and to visually indicate that it is focused.
2017-02-14 11:51:19 +00:00
Chris Hill-Scott
103e09e3a0 Make the UI more performant by not reflowing
Fixes the height of the component until it’s loaded so that it doesn’t
causes the page to reflow while it’s rendering the buttons.

Stops the options being shown and then immediately hiding on initial
page load.
2016-10-31 09:14:05 +00:00
Chris Hill-Scott
8a01e6af36 Make it say later today
Categories before:

> Now, today, tomorrow, Friday…

Categories after:

> Now, later today, tomorrow Friday…

This reduces the ambiguity of ‘now’ vs ‘today’, and keeping the word
‘later’ suggests what this features is about.

This implementation here is a bit hacky, but it works…
2016-10-31 09:14:05 +00:00
Chris Hill-Scott
a78d9d5048 Group choices for scheduling a job by day
The options for scheduling a job by time should be grouped by day,
because a long list of 96 options is not very usable.

On the server side, this commit generates label for the next 4 days in
a friendly format (ie today/tomorrow/Sunday/Monday)

The Javascript component for choosing a time was built in a kind of
old-school jQuery way, where it manipulated the elements on the page.
The complexity of introducing groups of options was just too much for
this pattern, because it involves storing a lot of state in the DOM.

This commit completely rewrites the JS to:

- read the initial options and groups from the HTML and store them
  in the object
- use Hogan to completely re-render the UI from a series of Mustache
  templates, each of which represents a state of the UI and takes the
  inital options and groups
- filter the choices to show when the today/tomorrow/… buttons are
  clicked
2016-10-31 09:14:05 +00:00
Imdad Ahad
2a2a733a41 Fix 500s when requesting json after logged out:
* Update permissions decorator to make sure user is logged in first, else 401
* Stop further ajax json calls on failure
2016-10-21 14:24:21 +01:00
Chris Hill-Scott
f561bfe603 Show expander arrow for all browsers
The polyfill we use for details/summary only renders the arrow if the
browser doesn’t natively support the feature.

The latest versions of Firefox _do_ now support the feature (after 5
years), but for some reason they don’t draw the arrow. So this commit
forces the arrow to be polyfilled in all browsers, and hides the browser
default one, for those browsers that do render it.
2016-10-12 15:55:53 +01:00
Chris Hill-Scott
6c96b90922 Make relative timestamps update automatically
It’s weird to be on a page that says ‘2 seconds ago’ and stays stuck
there.

We don’t want to AJAX the whole page because it would get in the way of
interacting with the list of notifications.

This commit adds the venerable jQuery Timeago[1] plugin to keep the
relative times accurate and fresh.

1. http://timeago.yarp.com/
2016-09-29 09:28:13 +01:00
Chris Hill-Scott
3e42042156 Add a page to manage a service’s whitelist
Services who are in alpha or building prototypes need a way of sending
to any email address or phone number without having to sign the MOU.

This commit adds a page where they can whitelist up to 5 email addresses
and 5 phone numbers.

It uses the ‘list entry’ UI pattern from the Digital Marketplace
frontend toolkit [1] [2] [3].

I had to do some modification:
- of the Javascript, to make it work with the GOV.UK Module pattern
- of the template to make it work with WTForms
- of the content security policy, because the list entry pattern uses
  Hogan[1], which needs to use `eval()` (this should be fine if we’re
  only allowing it for scripts that we serve)
- of our SASS lint config, to allow browser-targeting mixins to come
  after normal rules (so that they can override them)

This commit also adds a new form class to validate and populate the two
whitelists. The validation is fairly rudimentary at the moment, and
doesn’t highlight which item in the list has the error, but it’s
probably good enough.

The list can only be updated all-at-once, this is how it’s possible to
remove items from the list without having to make multiple `POST`
requests.

1. 434ad30791/toolkit/templates/forms/list-entry.html
2. 434ad30791/toolkit/scss/forms/_list-entry.scss
3. 434ad30791/toolkit/javascripts/list-entry.js
4. http://twitter.github.io/hogan.js/
2016-09-29 09:27:38 +01:00
Chris Hill-Scott
225a61ddd3 Add a component for picking the time to send a job
Users need to pick a time in the next 24hrs, or send a file immediately.

Rationale for this is a bit lost in time-before-holiday, but generally:

‘Now’ and ‘later’ as the inital choices makes it really clear what
this feature is about conceptually.

The choice of times is absolute, eg ‘1pm’ not ‘in 3 hours’
2016-08-31 16:58:09 +01:00
Chris Hill-Scott
b9a69def00 Revert "Stop AJAX updater consuming ever-increasing memory" 2016-08-04 12:06:04 +01:00
Chris Hill-Scott
ec724ce417 Stop AJAX updater consuming ever-increasing memory
The pages with AJAX on were feeling quite sluggish, and it felt like
they were making the whole browser slow down.

Looking at the performance stuff in Chrome, the number of DOM nodes was
going up and up, which is weird because the number of things on the page
wasn’t changing. This was causing the page to consume more and more
memory in order to store all these nodes.

This is kinda beyond my understanding, but I tried a few things and it
looks like the browser was having a hard time garbage collecting the
temporary bits of DOM used to update the page.

By assinging these bits of DOM to variables before using them it seems
that the browser has an easier time cleaning them up.
2016-08-03 10:29:25 +01:00
Chris Hill-Scott
c006b8748c Add conditional placeholder detection
Implements: https://github.com/alphagov/notifications-utils/pull/51

Copies the same regex.

Adds some CSS to display conditional placeholders differently to
normal placeholders (vertical rather that curved right-hand edge).
2016-07-12 17:11:52 +01:00
Chris Hill-Scott
d2b4dd5007 Revert "Add character count as you type"
This reverts commit fbc4abf85d.
2016-06-20 16:03:21 +01:00
Chris Hill-Scott
c975e0f671 Remove placeholder hint JS
This was used for an older iteration of placeholder guidance. Not used
anywhere now.
2016-06-20 14:45:59 +01:00
Chris Hill-Scott
fbc4abf85d Add character count as you type
Text messages have a maximum length, which we tell the users. We
shouldn’t expect people to count the characters in the message
themselves.

This commit borrows [the word counter from the Digital Marketplace
frontend toolkit](9d17690de5/toolkit/javascripts/word-counter.js)
and adapts it to count characters instead.

Things I’m still not sure about with this:

- what should it say when the message goes over the length of one text
  message
- what’s the interaction with placeholders, which will change the length
  of the message

This commit also adds a line to the pricing page which explains that
service name counts towards the length of the message.
2016-06-20 14:45:59 +01:00
Chris Hill-Scott
66a33e4e47 Stop page jumping on first load with a long email
A long email message needs to be collapsed to only show the first few
lines. The problem is that we were doing this by adding a class with
Javascript, meaning that the email wasn’t being collapsed until the
script in the footer ran.

This caused a jump in the page because the browser was painting the
whole email message, then repainting it once it was collapsed.

This commit takes advantage of the `.js-enabled` class added to the
`<body>` by a script in the `<head>` of GOV.UK template.

This means that the email message is collapsed with CSS before the first
paint of the page, so no jump.

This introduces some complexity in how we determine which emails get the
expander toggle. Because they’re already collapsed we can’t get their
height and work out if they’re long enough to need collapsing.

So we need to take a copy of the message, put it off-screen, expand it,
get its height, then remove it from the DOM. Bit of a faff.

Because of this there’s still a quick flash of the toggle if you see an
email message that’s too short to need collapsing. I think this is the
lesser of two evils—very short email messages will be few and far
between in the real world.
2016-06-15 09:35:55 +01:00
Chris Hill-Scott
940170159a Handle AJAX errors when updating content
With the change in implementation in the previous commit, any error
(eg server responds with `500`) would cause the page to not be updated
again.

This is better than the previous implementation, whereby the browser
would re-request as fast as it could until it got a successful response.

This commit handles errors by clearing the render queue if the server
returns an error. So:

- Any updates that would have been performed based on this request are
  dropped
- Subsequent updates will be attempted as if it was the first load of
  the page, ie after a delay of `x` seconds
2016-06-12 14:16:27 +01:00
Chris Hill-Scott
9c92a2bd86 Stop AJAX updates queuing requests
The `updateContent` module updates a section of the page based on an
AJAX request.

The current implementation will poll every `x` seconds. If the server
takes a long time to respond, this results in a the browser queuing up
requests. If a particular endpoint is slow, this can result in one
client making enough requests to slow down the whole server, to the
point where it gets removed from the loadbalancer, eventually bringing
the whole site down.

This commit rewrites the module so that it queues up the render
operations, not the requests.

There is one queue per endpoint, so for
`http://example.com/endpoint.json`:

1. Queue is empty
```javascript
{
  'http://example.com/endpoint.json': []
}
```

2. Inital re-render is put on the queue…
```javascript
{
  'http://example.com/endpoint.json': [
    function render(){…}
  ]
}
```

…AJAX request fires
```
GET http://example.com/endpoint.json
```

3. Every `x` seconds, another render operation is put on the queue
```javascript
{
  'http://example.com/endpoint.json': [
    function render(){…},
    function render(){…},
    function render(){…}
  ]
}
```

4. AJAX request returns queue is flushed by executing each queued
render function in sequence
```javascript
render(response); render(response); render(response);
```
```javascript
{
  'http://example.com/endpoint.json': []
}
```

5. Repeat

This means that, at most, the AJAX requests will never fire more than
once every `x` seconds, where `x` defaults to `1.5`.
2016-06-12 14:15:04 +01:00
Chris Hill-Scott
51f6450e5d Make placeholder look more editable
Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/40

In research we’ve noticed two problems with the appearance of
placeholders:

1. We are inconsistent about when we display the ((double brackets)).
   Sometimes we show them, sometimes we don’t. This doesn’t help user’s
   understanding about where the column names in their CSV file come
   from, or how they can edit the template to fix any errors.

2. Because they look so different from normal `<textarea>` text, it’s
   not immediately obvious that they can be edited just like normal
   text. They look more like something that can be dragged/inserted.

So this commit:

1. Makes the brackets always-visible.

2. Makes the text colour of the placeholder `$text-colour`, and only
   highlights the name of the ‘variable’, not the brackets themselves.
2016-06-06 12:59:40 +01:00
Chris Hill-Scott
2ba801ff73 Add polyfill for HTML5 <details> element
The details element is fairly new. It doesn’t work in all browsers,
and isn’t keyboard/screenreader accessible even in some new browsers.

This commit adds the Polyfill script from GOV.UK elements[1] which
polyfills these features for browsers that don’t support them.

1. http://govuk-elements.herokuapp.com/typography/#typography-hidden-text
2016-05-17 14:54:05 +01:00
Chris Hill-Scott
33b4138e79 Patch update sections of the page on AJAX
Currently, when we update a section of the page with AJAX we replace the
entire HTML of the section with the new HTML. This causes problems:
- if you’re trying to interact with that section of the page, eg by
  inpecting it, clicking or hovering an element
- (probably) for screenreaders trying to navigate a page which is
  changing more than is necessary

This commit replaces the call to `.html()` with a pretty clever library
called diffDOM[1]. DiffDOM works by taking a diff of the old element and
the new element, then doing a patch update, ie only modifying the parts
that have changed.

This is similar in concept to React’s virtual DOM, while still allowing
us to render all markup from one set of templates on the server-side.

1. https://github.com/fiduswriter/diffDOM
2016-04-27 10:08:57 +01:00
Chris Hill-Scott
27ad1532e4 Make the flow of using templates better
For users who:
- want to send messages from a template
- want to edit templates

For developers:
- who need to get the ID of a template

This commit mainly cleans up the choose template page so there are less
options, and the options that are there are less wordy.

This means:
- moving ‘send yourself a test’ onto the send messages page, and making
  it button
- stripping a lot of stuff out of the ‘send from API’ page, so it’s more
  obvious what the template ID is
2016-04-19 15:31:19 +01:00
Chris Hill-Scott
54e42a2021 Make the hint work for both subject and body
This commit makes the placeholder hint not be dependent on their only
being one textbox with placeholders on a page.

To do this it needs to be its own module, because the two textboxes are
each self-contained instances of the same module.

The way I’ve gone about this is to make the placeholder hint accept a
list of textboxes it should look in when deciding what message to
display to the user.

Most of the code is extracted from the existing placeholder highlighting
module.
2016-04-14 14:54:53 +01:00
Chris Hill-Scott
bdf746131f Only collapse email templates if they’re long
It’s a bit silly to have email templates expandable if you’re only going
to reveal a couple more lines.

This commit adds a data attribute which specifies how high (in pixels)
the email template can be before it gets truncated. It then changes the
script to only truncate emails which are naturally taller than this
height.

Currently the cut off is at 200px, which is approximately 8 lines of
text: `200px / (font-size: 19px * line-height: 1.31) = 8.03`
2016-04-13 09:50:18 +01:00
Chris Hill-Scott
cffd941742 Fix email expand/collapse not working
The click event was scoped to the wrong element.
2016-04-12 16:21:41 +01:00
Chris Hill-Scott
975041cbed Merge pull request #428 from alphagov/better-choose-template
Make choose template page clearer
2016-04-12 10:06:40 +01:00
Chris Hill-Scott
a2263f959e Merge pull request #422 from alphagov/commas-in-placeholders
Don’t allow commas in placeholders
2016-04-12 10:06:08 +01:00
Chris Hill-Scott
3a5b76ce2a Truncate previews of email messages to ~3 lines
Emails can get very long.

When you’re trying to do other things on the page this results in a lot
of scrolling.

This commit truncates email messages to about 3 lines, and adds a JS
toggle which reveal the full contents of the email.
2016-04-11 17:24:22 +01:00
Chris Hill-Scott
82ecaa3628 Add cancel button to file upload pattern
We’ve seen users try to click the upload again when their file doesn’t
upload in time. This is because we’re giving them no feedback that
something is happening.

I reckon that changing the button to a cancel button is the easiest way
to show that something is happening, and also means that (unlike
disabling the send button) the user can’t get stuck if the connection
drops completely.
2016-04-08 16:46:25 +01:00
Chris Hill-Scott
732109889e Make border width of field layers match textbox
We put a border on text boxes that have errors. This means that they
take up more space than the layers above them which don’t have borders.

This makes the layers that highlight the fields in a template misalign.

This commit adds a line to make the borders match, which fixes this.
2016-04-08 07:46:15 +01:00
Chris Hill-Scott
eaa72074db Enhance the ‘how to do placeholders’ hint
This commit makes the ‘how to do placeholders’ box part of the tour,
with the same blue background.

It also adds some Javascript enhancement so that:
- it responds to the contents of the message template
- has a ‘show me’ link which inserts ‘Dear ((name))’ into the template
  contents textbox

We’ve found that this has helped people understnad what placeholders
are, and how to do them.
2016-04-04 09:25:41 +01:00
Chris Hill-Scott
4411f8cb37 Allow custom interval on AJAX sections of page
Some pages with AJAX should update quickly, because the data is likely
to be changing quickly, and be finished changing sooner. Other pages we
want to have tick over a bit slower.

This commit adds an optional ‘interval’ parameter to the updateContent
modules, which sets how often the page should ping the server for an
update.

It then sets the interval for the dashboard page to be 10 seconds,
rather than the default 1.5 seconds.
2016-03-23 13:40:23 +00:00
Chris Hill-Scott
8f0dd98d13 Remove method that maintain’s scroll parity
Since we don’t anticipate placeholder textboxes ever scrolling in the future,
this can be removed.
2016-03-18 09:24:25 +00:00
Chris Hill-Scott
0f3b0b38bc Make textboxes expand to fit contents
This applies to any textbox which has placeholders.

There are two reasons to do this:

1. Scrolling in textboxes is fiddly, especially on touch devices
2. Keeping the placeholders aligned with the textbox is fiddly too

These can both be avoided by always having the textbox be larger than its
contents so it never needs to scroll.

By default—and unlike other block-level elements—textboxes dont expand to fit
their contents. The layer with the placeholders in _does_ however, because it’s
a normal block-level element.

Since the layer with the placeholders always has an exact copy of what in the
textbox, we can set the textbox’s height to match the height of the layer with
the placeholders, and do this every time the content changes.
2016-03-18 09:19:21 +00:00
Chris Hill-Scott
836fe77c37 Fix bug with ‘ghost’ links in template textbox
This is a bug with the code that highlights placeholders.

It was taking the value of the textbox and copying it straight into the HTML
of the layer that contains the blue lozenges. This meant that any HTML that the
user typed into the textbox was rendered by the browser.

This commit fixes the bug by:
1. taking the contents of the textbox
2. copying it to the _text_ (not inner HTML) of a temporary `<div>`
3. taking the inner HTML of that `<div>` (whose text has been encoded with HTML
   entities in step 2., eg `>` becomes `&gt;`)
4. using that for the HTML content of the layer with the blue lozenges
2016-03-09 16:58:51 +00:00
Chris Hill-Scott
b31c9fbc0d Make job page poll for updates
This is a first go at having the job page update without refreshing.

The approach I’ve taken is to do all the rendering of HTML on the server side,
rather than use a Javascipt templating engine like mustache. This ensures that
we don’t have to maintain two sets of templates.

So the approach is to split the job page into partials. These partials can then:
- be included in the job page to render the whole page
- be rendered indivudually and then returned as a blob of HTML inside a JSON
  response

Then I’ve added a Javascript module which looks for areas of the page that should
be reloaded. For each area of the page it will poll a URL and re-render that
section of the page when it gets new HTML. It implements some throttling so that
API calls will never happen more frequently than 0.67 times/second.
2016-03-03 14:28:36 +00:00