       return Promise.resolve('insert')
 
   insert: (title, content) ->
-    that = this
     gapi.client.load('drive', 'v2')
-      .then () -> that.gdrive.insert(title, content)
-      .then (response) ->
+      .then () => this.gdrive.insert(title, content)
+      .then (response) =>
         console.log("insert file")
         console.log(response.result)
-        that.set("file", response.result)
+        this.set("file", response.result)
 
         Promise.resolve(response.result)
 
   update: (title, content) ->
-    that = this
-    fileId = that.get('file').id
+    fileId = this.get('file').id
     gapi.client.load('drive', 'v2')
-      .then () -> that.gdrive.update(fileId, title, content)
-      .then (response) ->
+      .then () => this.gdrive.update(fileId, title, content)
+      .then (response) =>
         console.log("update file")
         console.log(response.result)
-        that.set("file", response.result)
+        this.set("file", response.result)
 
         Promise.resolve(response.result)
 })

      documentLink.removeClass("text-muted").addClass("text-primary")

  showPicker: ()->
    that = this
    client_id = that.model.get('client_id')
    access_token = that.model.get("access_token")
    if access_token
      view = new google.picker.View(google.picker.ViewId.DOCS)
      # 現状何かエラー出ているけど一応使えるのでとりあえず放置

    )

  fetchFile: (fileId) ->
    return new Promise((resolve, reject) =>
      this.gdrive.get(fileId)
        .then (file) =>
          this.set("file", file)
          this.set('title', file.title)

          this.gdrive.getFileResource(
            file.downloadUrl,
            this.get('access_token')
          )
        .then (fileContent) =>
          this.set('content', fileContent)
          resolve(fileContent)
      )

