[Client:Mobile] Fix drive bug

This commit is contained in:
syuilo 2017-02-17 10:52:28 +09:00
parent d6469418c0
commit 8694685dbd
3 changed files with 16 additions and 16 deletions

View File

@ -155,9 +155,9 @@
# https://github.com/riot/riot/issues/2080 # https://github.com/riot/riot/issues/2080
#if @opts.folder? #if @opts.folder?
if @opts.folder? and @opts.folder != '' if @opts.folder? and @opts.folder != ''
@cd @opts.folder @cd @opts.folder, true
else if @opts.file? and @opts.file != '' else if @opts.file? and @opts.file != ''
@cf @opts.file @cf @opts.file, true
else else
@load! @load!
@ -191,9 +191,9 @@
@move ev.item.folder @move ev.item.folder
@move = (target-folder) ~> @move = (target-folder) ~>
@cd target-folder, true @cd target-folder
@cd = (target-folder, is-move) ~> @cd = (target-folder, silent = false) ~>
@file = null @file = null
if target-folder? and typeof target-folder == \object if target-folder? and typeof target-folder == \object
@ -221,8 +221,7 @@
x folder.parent x folder.parent
@update! @update!
if is-move then @trigger \move @folder @trigger \open-folder @folder, silent
@trigger \cd @folder
@load! @load!
.catch (err, text-status) -> .catch (err, text-status) ->
console.error err console.error err
@ -350,7 +349,7 @@
else else
@cf file @cf file
@cf = (file) ~> @cf = (file, silent = false) ~>
if typeof file == \object if typeof file == \object
file = file.id file = file.id
@ -373,6 +372,6 @@
x file.folder x file.folder
@update! @update!
@trigger \open-file @file @trigger \open-file @file, silent
</script> </script>
</mk-drive> </mk-drive>

View File

@ -195,7 +195,7 @@
file_id: @file.id file_id: @file.id
name: name name: name
.then ~> .then ~>
@parent.cf @file @parent.cf @file, true
</script> </script>
</mk-drive-file-viewer> </mk-drive-file-viewer>

View File

@ -30,21 +30,22 @@
# Rewrite URL # Rewrite URL
history.push-state null null '/i/drive' 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 # TODO: escape html characters in folder.name
@ui.trigger \title '<i class="fa fa-folder-open"></i>' + folder.name @ui.trigger \title '<i class="fa fa-folder-open"></i>' + folder.name
@refs.ui.refs.browser.on \move (folder) ~> if !silent
# Rewrite URL # Rewrite URL
history.push-state null null '/i/drive/folder/' + folder.id 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 # TODO: escape html characters in file.name
@ui.trigger \title '<mk-file-type-icon class="icon"></mk-file-type-icon>' + file.name @ui.trigger \title '<mk-file-type-icon class="icon"></mk-file-type-icon>' + file.name
riot.mount \mk-file-type-icon do riot.mount \mk-file-type-icon do
type: file.type type: file.type
# Rewrite URL if !silent
history.push-state null null '/i/drive/file/' + file.id # Rewrite URL
history.push-state null null '/i/drive/file/' + file.id
</script> </script>
</mk-drive-page> </mk-drive-page>