From 941e9924c63eb8302bdc58b01037405a70195556 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Feb 2017 10:52:28 +0900 Subject: [PATCH] [Client:Mobile] Fix drive bug --- src/web/app/mobile/tags/drive.tag | 15 +++++++-------- src/web/app/mobile/tags/drive/file-viewer.tag | 2 +- src/web/app/mobile/tags/page/drive.tag | 15 ++++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index c4e7c0e6d7..78574e95b1 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -155,9 +155,9 @@ # https://github.com/riot/riot/issues/2080 #if @opts.folder? if @opts.folder? and @opts.folder != '' - @cd @opts.folder + @cd @opts.folder, true else if @opts.file? and @opts.file != '' - @cf @opts.file + @cf @opts.file, true else @load! @@ -191,9 +191,9 @@ @move ev.item.folder @move = (target-folder) ~> - @cd target-folder, true + @cd target-folder - @cd = (target-folder, is-move) ~> + @cd = (target-folder, silent = false) ~> @file = null if target-folder? and typeof target-folder == \object @@ -221,8 +221,7 @@ x folder.parent @update! - if is-move then @trigger \move @folder - @trigger \cd @folder + @trigger \open-folder @folder, silent @load! .catch (err, text-status) -> console.error err @@ -350,7 +349,7 @@ else @cf file - @cf = (file) ~> + @cf = (file, silent = false) ~> if typeof file == \object file = file.id @@ -373,6 +372,6 @@ x file.folder @update! - @trigger \open-file @file + @trigger \open-file @file, silent diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag index 48a3758150..0ad2cdcd1e 100644 --- a/src/web/app/mobile/tags/drive/file-viewer.tag +++ b/src/web/app/mobile/tags/drive/file-viewer.tag @@ -195,7 +195,7 @@ file_id: @file.id name: name .then ~> - @parent.cf @file + @parent.cf @file, true diff --git a/src/web/app/mobile/tags/page/drive.tag b/src/web/app/mobile/tags/page/drive.tag index e903ccfb0e..beb7cf77a4 100644 --- a/src/web/app/mobile/tags/page/drive.tag +++ b/src/web/app/mobile/tags/page/drive.tag @@ -30,21 +30,22 @@ # Rewrite URL history.push-state null null '/i/drive' - @refs.ui.refs.browser.on \cd (folder) ~> + @refs.ui.refs.browser.on \open-folder (folder, silent) ~> # TODO: escape html characters in folder.name @ui.trigger \title '' + folder.name - @refs.ui.refs.browser.on \move (folder) ~> - # Rewrite URL - history.push-state null null '/i/drive/folder/' + folder.id + if !silent + # Rewrite URL + history.push-state null null '/i/drive/folder/' + folder.id - @refs.ui.refs.browser.on \open-file (file) ~> + @refs.ui.refs.browser.on \open-file (file, silent) ~> # TODO: escape html characters in file.name @ui.trigger \title '' + file.name riot.mount \mk-file-type-icon do type: file.type - # Rewrite URL - history.push-state null null '/i/drive/file/' + file.id + if !silent + # Rewrite URL + history.push-state null null '/i/drive/file/' + file.id