From 27287b26a34cccf11d50c12ff40aa66fb55cf53b Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Fri, 17 Feb 2017 05:47:09 +0900
Subject: [PATCH] [Client:Mobile] Implement file rename

---
 src/web/app/mobile/tags/drive/file-viewer.tag | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag
index 406f2f09fb..48a3758150 100644
--- a/src/web/app/mobile/tags/drive/file-viewer.tag
+++ b/src/web/app/mobile/tags/drive/file-viewer.tag
@@ -183,7 +183,19 @@
 		@bytes-to-size = require '../../../common/scripts/bytes-to-size.js'
 		@get-gcd = require '../../../common/scripts/gcd.js'
 
+		@mixin \api
+
 		@file = @opts.file
 		@kind = @file.type.split \/ .0
+
+		@rename = ~>
+			name = window.prompt '名前を変更' @file.name
+			if name? and name != '' and name != @file.name
+				@api \drive/files/update do
+					file_id: @file.id
+					name: name
+				.then ~>
+					@parent.cf @file
+
 	</script>
 </mk-drive-file-viewer>