From 18901dd9a3e2df00340ea689c478ded431f44d18 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 16 Feb 2017 17:20:45 +0900 Subject: [PATCH] =?UTF-8?q?[Client]=20=E8=89=AF=E3=81=84=E6=84=9F=E3=81=98?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/common/scripts/gcd.js | 2 + src/web/app/common/tags/file-type-icon.tag | 7 +- src/web/app/mobile/tags/drive.tag | 40 +++- src/web/app/mobile/tags/drive/file-viewer.tag | 184 +++++++++++++++++- src/web/app/mobile/tags/drive/file.tag | 4 +- src/web/app/mobile/tags/page/drive.tag | 5 +- src/web/app/mobile/tags/ui-header.tag | 3 +- 7 files changed, 230 insertions(+), 15 deletions(-) create mode 100644 src/web/app/common/scripts/gcd.js diff --git a/src/web/app/common/scripts/gcd.js b/src/web/app/common/scripts/gcd.js new file mode 100644 index 000000000..43bfbc57a --- /dev/null +++ b/src/web/app/common/scripts/gcd.js @@ -0,0 +1,2 @@ +const gcd = (a, b) => !b ? a : gcd(b, a % b); +module.exports = gcd; diff --git a/src/web/app/common/tags/file-type-icon.tag b/src/web/app/common/tags/file-type-icon.tag index 054457bf0..b4b0c88d6 100644 --- a/src/web/app/common/tags/file-type-icon.tag +++ b/src/web/app/common/tags/file-type-icon.tag @@ -1,11 +1,10 @@ - + + diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index 903a66017..c4e7c0e6d 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -5,8 +5,14 @@

{ folder.name }

- -

{ folder.name }

+ + +

{ folder.name }

+
+ + +

{ file.name }

+
0 }> @@ -150,6 +156,8 @@ #if @opts.folder? if @opts.folder? and @opts.folder != '' @cd @opts.folder + else if @opts.file? and @opts.file != '' + @cf @opts.file else @load! @@ -186,6 +194,8 @@ @cd target-folder, true @cd = (target-folder, is-move) ~> + @file = null + if target-folder? and typeof target-folder == \object target-folder = target-folder.id @@ -263,7 +273,8 @@ @update! @go-root = ~> - if @folder != null + if @folder != null or @file != null + @file = null @folder = null @hierarchy-folders = [] @update! @@ -337,7 +348,30 @@ @update! @trigger \change-selected @selected-files else + @cf file + + @cf = (file) ~> + if typeof file == \object + file = file.id + + @loading = true + @update! + + @api \drive/files/show do + file_id: file + .then (file) ~> @file = file + @folder = null + @hierarchy-folders = [] + + x = (f) ~> + @hierarchy-folders.unshift f + if f.parent? + x f.parent + + if file.folder? + x file.folder + @update! @trigger \open-file @file diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag index ac426278b..406f2f09f 100644 --- a/src/web/app/mobile/tags/drive/file-viewer.tag +++ b/src/web/app/mobile/tags/drive/file-viewer.tag @@ -1,9 +1,189 @@ -

{ file.name }

+
+ { + +
+ + { file.properties.width } + × + { file.properties.height } + px + + + + { file.properties.width / getGcd(file.properties.width, file.properties.height) } + : + { file.properties.height / getGcd(file.properties.width, file.properties.height) } + +
+
+
+
+ { file.type } + + { bytesToSize(file.datasize) } + + +
+
+ +
+
+

+ ファイルのハッシュ値 +

+ { file.hash } +
+
- +
diff --git a/src/web/app/mobile/tags/drive/file.tag b/src/web/app/mobile/tags/drive/file.tag index 1ce8297ea..7a4d44469 100644 --- a/src/web/app/mobile/tags/drive/file.tag +++ b/src/web/app/mobile/tags/drive/file.tag @@ -11,7 +11,7 @@ -->