summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-08-28 20:23:47 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-08-28 20:23:47 +0900
commitbce6c006b2a7d0add0ce5675d3098c57d32c1207 (patch)
tree64abed0f37699be3ccab661f938523f26fb8cec4 /src/web
parentv2458 (diff)
downloadsharkey-bce6c006b2a7d0add0ce5675d3098c57d32c1207.tar.gz
sharkey-bce6c006b2a7d0add0ce5675d3098c57d32c1207.tar.bz2
sharkey-bce6c006b2a7d0add0ce5675d3098c57d32c1207.zip
Fix bug
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/mobile/tags/drive-selector.tag7
-rw-r--r--src/web/app/mobile/tags/drive.tag16
2 files changed, 16 insertions, 7 deletions
diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag
index 32845432f2..2edae67c1b 100644
--- a/src/web/app/mobile/tags/drive-selector.tag
+++ b/src/web/app/mobile/tags/drive-selector.tag
@@ -3,7 +3,7 @@
<header>
<h1>%i18n:mobile.tags.mk-drive-selector.select-file%<span class="count" if={ files.length > 0 }>({ files.length })</span></h1>
<button class="close" onclick={ cancel }><i class="fa fa-times"></i></button>
- <button class="ok" onclick={ ok }><i class="fa fa-check"></i></button>
+ <button if={ opts.multiple } class="ok" onclick={ ok }><i class="fa fa-check"></i></button>
</header>
<mk-drive ref="browser" select-file={ true } multiple={ opts.multiple }/>
</div>
@@ -68,6 +68,11 @@
files: files
});
});
+
+ this.refs.browser.on('selected', file => {
+ this.trigger('selected', file);
+ this.unmount();
+ });
});
this.cancel = () => {
diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag
index e19325091d..9f3e647735 100644
--- a/src/web/app/mobile/tags/drive.tag
+++ b/src/web/app/mobile/tags/drive.tag
@@ -190,7 +190,7 @@
this.file = null;
this.isFileSelectMode = this.opts.selectFile;
- this.multiple =this.opts.multiple;
+ this.multiple = this.opts.multiple;
this.on('mount', () => {
this.stream.on('drive_file_created', this.onStreamDriveFileCreated);
@@ -435,13 +435,17 @@
this.chooseFile = file => {
if (this.isFileSelectMode) {
- if (this.selectedFiles.some(f => f.id == file.id)) {
- this.selectedFiles = this.selectedFiles.filter(f => f.id != file.id);
+ if (this.multiple) {
+ if (this.selectedFiles.some(f => f.id == file.id)) {
+ this.selectedFiles = this.selectedFiles.filter(f => f.id != file.id);
+ } else {
+ this.selectedFiles.push(file);
+ }
+ this.update();
+ this.trigger('change-selection', this.selectedFiles);
} else {
- this.selectedFiles.push(file);
+ this.trigger('selected', file);
}
- this.update();
- this.trigger('change-selection', this.selectedFiles);
} else {
this.cf(file);
}