diff options
author | Dave Arter <davea@mysociety.org> | 2017-06-12 13:46:37 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-04-30 13:13:02 +0100 |
commit | 3ca3ddeb424c69220fb4293cb46e3823c752180e (patch) | |
tree | 3a0cdc922d88fa0983ab220c9cf249a7ba2326a9 /www/js/models/draft.js | |
parent | e42acf108661838baccd0b2726c3632e4abb5779 (diff) |
Allow multiple photos with reports
A new CONFIG.MAX_PHOTOS setting enables any number of photos to be
uploaded.
Includes code adapted from from 0ac07c1ea062a68d68d162c3ecdbba7e9da3e4c9
and c207193a0e052ae9e41a6d42e0ac1b704883b25b in zurich_mobile: this is a
bit of an abuse of the FileTransfer plugin, which technically doesn't
support uploading more than one file at a time. There's no good reason
for that though, the HTTP spec allows an arbitrary number of files in a
POST request.
Diffstat (limited to 'www/js/models/draft.js')
-rw-r--r-- | www/js/models/draft.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/www/js/models/draft.js b/www/js/models/draft.js index 56d8111..e517f1b 100644 --- a/www/js/models/draft.js +++ b/www/js/models/draft.js @@ -3,17 +3,19 @@ Draft: Backbone.Model.extend({ localStorage: new Backbone.LocalStorage(CONFIG.NAMESPACE + '-drafts'), - defaults: { - lat: 0, - lon: 0, - title: '', - details: '', - may_show_name: '', - category: '', - phone: '', - pc: '', - file: '', - created: moment.utc() + defaults: function() { + return { + lat: 0, + lon: 0, + title: '', + details: '', + may_show_name: '', + category: '', + phone: '', + pc: '', + files: [], + created: moment.utc() + }; }, description: function() { @@ -33,7 +35,7 @@ this.get('title') || this.get('details') || this.get('category') || - this.get('file') + this.get('files').length ) { return true; } |