[Client:Mobile] Fix drive bug

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

View File

@ -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
</script>
</mk-drive>

View File

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

View File

@ -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 '<i class="fa fa-folder-open"></i>' + 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 '<mk-file-type-icon class="icon"></mk-file-type-icon>' + 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
</script>
</mk-drive-page>