update api module to version with embed parameter

this lets you add ?embed= to the end of api GET calls for collections to
expand the memberships array
update api module for image fixes

This allows setting a URL for an image for persons and organizations
over the API. It also correctly displays the _id field of images added
using the front end and provides the URL for images hosted on the popit
instance.
display add another x buttons consistently

In view mode if there is an existing link, contact etc then make sure an
add another button is displayed that takes you into edit mode. Also
make language on the Add another buttons in edit more consistent with
the buttons in view mode.

Fixes #618
Remove extraneous labels on edit forms

There were extra labels for several of the tabs which were creating
visual clutter
keep selected tab when switching to edit mode on org page

Detect if we are on the organization page or the persons page so we can
do the correct selector to work out which is the active tab when
switching to edit mode
retain active tab when saving changes to org/person

Add the url hash to the form action so that when the saved page is
loaded it displays the tab selected when save was pressed so it's easier
to see that changes have been saved
replace-database: it's safer to use second granularity in the timestamp

It's very common for me to have to run replace-database more than once a
day, but extremely unlikely that one would run it twice in a second for
the instance, so I think it's safer to have the timestamp to a
granularity of seconds rather than days.
Switch to passport-localapikey-update module

The passport-localapikey module is no longer being maintained and the
latest version, with support for putting the API keys in the headers,
hasn't been released to the npm registry.

To work around these issues passport-localapikey-update has been
created, which has the added bonus of being updated to work with the
latest version of passport, which should hopefully reduce the chance of
problems due to differing versions.
Merge branch 'small-ui-fixes'
Make sure NODE_ENV correctly set and we're using the right master db

If NODE_ENV is not set then it will fall back to development which means
that on a production server any settings in a production config will be
ignored. To avoid this we require that NODE_ENV be set.

As a further check compare the master db name passed in on the command
line and the one that is used by a node script to make sure they agree
and bail if they don't
Upgrade popit-api in npm-shrinkwrap.json

This includes the fix for restricting pagination parameters.
Load extra vagrant configuration from another file

Allow adding to the vagrant configuration with another file rather than
having lots of conditional code based on environment variables in the
`Vagrantfile`.

This loads the file specified in the POPIT_VAGRANT_EXTRAS environment
variable, which can contain another `Vagrant.configure` block which will
add to/override settings from the main `Vagrantfile`.

See https://docs.vagrantup.com/v2/vagrantfile/index.html for more
information (under the "LOAD ORDER AND MERGING" heading).
Override public_dir in testing environment config

This prevents the tests from failing locally when there's no
public-production directory present. Which means they should run
"out-of-the-box" when e.g. creating a new vagrant box.
Use OpenNorth image proxy for image resizing

Include the OpenNorth proxy and remove ours.

Changes to the image_proxy helper to use the new URL format and also to
correctly encode the URL. Also to pass in full URLs for local images.
Change the remote URL handingling code in templates to pass those to the
proxy as well.

This also works if you set the image proxy path to an external host.

Fixes #238 and also #527
if no images but there is an image property use that

This is partly a work around for an existing bug but also it means that
if people have directly imported stuff not via the API that uses the
Popolo spec we should do the right thing
Add examples for contact details fields

It's completely unclear to most users what should go in the 'Label',
'Value', 'Type' and 'Note' fields should be when adding or editing a
contact detail for a person. There's an argument that we should think
more broadly about how to redesign the entry of these kinds of details,
but in the interim this change (adding examples for three out of four
of those fields) at least provides some help for users until we have
time to do something more involved.  I left out the 'Note' field since
it's unclear to me at the moment how it should be used - I assumed this
was for free-form text for any useful notes about that contact detail,
but the example in the Popolo spec ("e.g. for grouping contact details
by physical location" [1]) makes wonder about that.

 [1] http://popoloproject.com/specs/contact-detail.html

This is an interim fix for #525.