summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-25 13:23:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-25 13:23:54 +0900
commitc338c1b84440cc031e04cc902c3db1eb7ff1afb5 (patch)
tree2efafbfdba9e1d20afbc87d164c0ef565adfd72c /src
parentMerge pull request #203 from syuilo/greenkeeper/css-loader-0.26.2 (diff)
downloadsharkey-c338c1b84440cc031e04cc902c3db1eb7ff1afb5.tar.gz
sharkey-c338c1b84440cc031e04cc902c3db1eb7ff1afb5.tar.bz2
sharkey-c338c1b84440cc031e04cc902c3db1eb7ff1afb5.zip
[Client] Fix bug
Diffstat (limited to 'src')
-rw-r--r--src/web/app/desktop/tags/drive/browser.tag20
-rw-r--r--src/web/app/desktop/tags/drive/file.tag1
-rw-r--r--src/web/app/desktop/tags/select-file-from-drive-window.tag4
3 files changed, 18 insertions, 7 deletions
diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag
index 7eaa7ed6e3..9f3c14f821 100644
--- a/src/web/app/desktop/tags/drive/browser.tag
+++ b/src/web/app/desktop/tags/drive/browser.tag
@@ -516,13 +516,23 @@
};
this.chooseFile = file => {
- if (this.selectedFiles.some(f => f.id == file.id)) {
- this.selectedFiles = this.selectedFiles.filter(f => f.id != file.id);
+ const isAlreadySelected = this.selectedFiles.some(f => f.id == file.id);
+ if (this.multiple) {
+ if (isAlreadySelected) {
+ 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);
+ if (isAlreadySelected) {
+ this.trigger('selected', file);
+ } else {
+ this.selectedFiles = [file];
+ this.trigger('change-selection', [file]);
+ }
}
- this.update();
- this.trigger('change-selection', this.selectedFiles);
};
this.newWindow = folderId => {
diff --git a/src/web/app/desktop/tags/drive/file.tag b/src/web/app/desktop/tags/drive/file.tag
index 47416db0bd..519d04f6dc 100644
--- a/src/web/app/desktop/tags/drive/file.tag
+++ b/src/web/app/desktop/tags/drive/file.tag
@@ -156,6 +156,7 @@
this.browser.on('change-selection', selections => {
this.isSelected = selections.some(f => f.id == this.file.id);
+ this.update();
});
this.onclick = () => {
diff --git a/src/web/app/desktop/tags/select-file-from-drive-window.tag b/src/web/app/desktop/tags/select-file-from-drive-window.tag
index ed1c1bce6c..5dba76d1fe 100644
--- a/src/web/app/desktop/tags/select-file-from-drive-window.tag
+++ b/src/web/app/desktop/tags/select-file-from-drive-window.tag
@@ -142,7 +142,7 @@
this.on('mount', () => {
this.refs.window.refs.browser.on('selected', file => {
- this.files = file;
+ this.files = [file];
this.ok();
});
@@ -166,7 +166,7 @@
};
this.ok = () => {
- this.trigger('selected', this.files);
+ this.trigger('selected', this.multiple ? this.files : this.files[0]);
this.refs.window.close();
};
</script>