wq.app 0.8.1
wq.app 0.8.1 builds on 0.8.0 to add a number of new features and enhancements, in particular to wq/map.js and wq/photos.js.
New Plugin API
wq/map.js is now a formal "plugin" for wq/app.js. This means instead of the following:
define(['wq/app', 'wq/map', './config'], function(app, map, config) {
app.init(config).then(function() {
map.init(config.map);
});
});
The following is preferred:
define(['wq/app', 'wq/map', './config'], function(app, map, config) {
app.use(map);
app.init(config);
});
A wq/app.js plugin is essentially just an object with three properties:
name
: An identifier for the plugininit()
: A function to call duringapp.init()
run()
: A function to call onpageshow
event.
See the documentation for wq/app.js for more information on the new plugin API.
Map Configuration & Layer Editing (#41, #36)
wq/map.js is now more easily configured via pure JSON. The JSON configuration can be specified within the wq configuration object for a page by creating the map
property as an object instead of a boolean. The old JavaScript-based configuration still works, but is mostly deprecated and parts will be removed in 1.0.
As part of this change, basemaps and overlays can now have custom types in addition to the default TileLayer
and GeoJSON
formats. The types need to be registered via JavaScript but the actual layers can be registered via JSON configuration.
The layer configuration can now be different for list, detail, and edit views. Edit view layers can also be configured as editable with a new edit
property. The new map editing tools are powered by Leaflet.Draw (#36).
See the documentation for wq/map.js for more information on the new JSON-based configuration and drawing tools.
PhoneGap (Cordova) Camera Integration
wq/photos.js has finally been fully updated to integrate with the new wq/store.js API. Specifically, photos.take()
and photos.pick()
store PhoneGap-requested photos as Blob
s for later retrieval. wq/app.js and wq/outbox.js have been updated to upload these Blob
s during an outbox sync. This makes fully-offline file storage and sync (#22) possible, even when using the PhoneGap Camera API. (In wq wq.app 0.8.0, this feature only worked for files selected via <input type=file>
).
Like wq/map.js, wq/photos.js has also been updated to work as a wq/app.js plugin. A number of data-wq-
attributes can be used to indicate which buttons and inputs to use with wq/photos.js.
See the Species Tracker templates and the new documentation for wq/photos.js for more information.
Bug Fixes
- Ensure wq/store.js doesn't break if offline storage is disabled (#50)
- Fix race condition during CSRF token loading (a916aa1)
- Fix outbox model updating bug (c0d1cc2)
- Don't use unreliable
navigator.onLine
when determining whether to sync in background (#33) - Ensure multiple files can be submitted via the same input (or via inputs with the same name)
- Check for existence of
FormData
before using it (2c34f05) - Fix bug in
router_info.params
calculation (c1a1722) - Fix list view filter bug (05ce964)
- Fix SCSS build paths on Windows (085a7dc)
Minor Improvements
- Better detection of the path to Leaflet image assets (#23)
- Include reference to model config in
info()
for wq/model.js - Ensure
page_config
is set on all template context variants; preserve non-page attributes onwq_config
(42685a6) - Add
app.emptyOutbox()
shortcut function - Add ability to display nested object errors (0c28fd2)