{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/comments/147047245","pull_request_review_id":72077275,"id":147047245,"diff_hunk":"@@ -69,10 +83,60 @@ export default Controller.extend({\n             window.location = url;\n         },\n \n-        changeView() {\n-            $('#mfrIframeParent').toggle();\n-            $('#revisionsPanel').toggle();\n-            $('.view-button').toggleClass('btn-default btn-primary');\n+        delete() {\n+            this.get('model.file').destroyRecord()\n+                .then(() => this._deleteFile('success'))\n+                .catch(() => this._deleteFile('error'));\n+        },\n+\n+        showModal() {\n+            this.set('openModal', true);\n+        },\n+\n+        closeModal() {\n+            this.set('openModal', false);\n+        },\n+\n+        changeViewPanel(panel, button) {\n+            if (!this.get('isEditableFile')) {\n+                $('#mainViewBtn, #revisionBtn').toggleClass('btn-primary btn-default');\n+                $('#mfrIframeParent, #revisionsPanel').toggle();\n+                return;\n+            }\n+\n+            if (button === 'revisionBtn' && $(`#${panel}`).css('display') === 'none') {\n+                $('.panel-view').hide().removeClass('col-sm-6');\n+                $('.view-button').removeClass('btn-primary').addClass('btn-default');\n+                $(`#${panel}`).toggle();\n+                $(`#${button}`).toggleClass('btn-default btn-primary');\n+                return;\n+            } else if (button === 'revisionBtn') {\n+                $('#mfrIframeParent').toggle();\n+                $('#mainViewBtn').toggleClass('btn-default btn-primary');\n+                $(`#${panel}`).toggle();\n+                $(`#${button}`).toggleClass('btn-default btn-primary');\n+                return;\n+            }","path":"app/file-detail/controller.js","position":86,"original_position":86,"commit_id":"07455e5449f3bb32af47d461b288e0c775661e61","original_commit_id":"07455e5449f3bb32af47d461b288e0c775661e61","user":{"login":"jamescdavis","id":348630,"avatar_url":"https://avatars1.githubusercontent.com/u/348630?v=4","gravatar_id":"","url":"https://api.github.com/users/jamescdavis","html_url":"https://github.com/jamescdavis","followers_url":"https://api.github.com/users/jamescdavis/followers","following_url":"https://api.github.com/users/jamescdavis/following{/other_user}","gists_url":"https://api.github.com/users/jamescdavis/gists{/gist_id}","starred_url":"https://api.github.com/users/jamescdavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamescdavis/subscriptions","organizations_url":"https://api.github.com/users/jamescdavis/orgs","repos_url":"https://api.github.com/users/jamescdavis/repos","events_url":"https://api.github.com/users/jamescdavis/events{/privacy}","received_events_url":"https://api.github.com/users/jamescdavis/received_events","type":"User","site_admin":false},"body":"this would be clearer as:\r\n```\r\nif (button === 'revisionBtn') {\r\n    if ($(`#${panel}`).css('display') === 'none') {\r\n        ...\r\n    } else {\r\n        ...\r\n    }\r\n}\r\n```\r\nAlso\r\n```\r\n$(`#${panel}`).toggle();\r\n$(`#${button}`).toggleClass('btn-default btn-primary');\r\n```\r\nappears in both cases so it could go in the outer if block","created_at":"2017-10-26T05:18:18Z","updated_at":"2017-10-26T06:00:13Z","html_url":"https://github.com/CenterForOpenScience/ember-osf-web/pull/17#discussion_r147047245","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/comments/147047245"},"html":{"href":"https://github.com/CenterForOpenScience/ember-osf-web/pull/17#discussion_r147047245"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17","id":145480446,"html_url":"https://github.com/CenterForOpenScience/ember-osf-web/pull/17","diff_url":"https://github.com/CenterForOpenScience/ember-osf-web/pull/17.diff","patch_url":"https://github.com/CenterForOpenScience/ember-osf-web/pull/17.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues/17","number":17,"state":"open","locked":false,"title":"[EOSF-770] Add edit features to file-detail page","user":{"login":"baylee-d","id":19379783,"avatar_url":"https://avatars0.githubusercontent.com/u/19379783?v=4","gravatar_id":"","url":"https://api.github.com/users/baylee-d","html_url":"https://github.com/baylee-d","followers_url":"https://api.github.com/users/baylee-d/followers","following_url":"https://api.github.com/users/baylee-d/following{/other_user}","gists_url":"https://api.github.com/users/baylee-d/gists{/gist_id}","starred_url":"https://api.github.com/users/baylee-d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baylee-d/subscriptions","organizations_url":"https://api.github.com/users/baylee-d/orgs","repos_url":"https://api.github.com/users/baylee-d/repos","events_url":"https://api.github.com/users/baylee-d/events{/privacy}","received_events_url":"https://api.github.com/users/baylee-d/received_events","type":"User","site_admin":false},"body":"## Ticket \r\n\r\nhttps://openscience.atlassian.net/browse/EOSF-770\r\n\r\n## Purpose\r\n\r\nTo add edit features to the file-detail page on quickfiles.\r\n\r\n## Changes\r\n\r\n- Add edit button to button bar, only accessible if the user is the owner of the files and if the files are actually editable\r\n- Add delete button.  On click, delete button takes user back to quickfiles home page after deleting that file\r\n- Add edit pane.  Will show the text of the file and is editable by the user/owner.  When the user clicks `Revert`, the text will go back to the way it was before their edits.  When they click `Save`, the updates will save as a new revision and the model will update with the new data.\r\n\r\nEdit 10/25:\r\n- Buttons were formatted to copy what it looks like currently on staging osf.io.  The only buttons with `btn-primary` class are `Download` and the `View/Edit/Revisions` buttons.\r\n![screen shot 2017-10-25 at 2 36 51 pm](https://user-images.githubusercontent.com/19379783/32016461-0ae917a6-b992-11e7-9b37-98794fec1ed1.png)\r\n## Notes\r\n\r\nShould be used with https://github.com/CenterForOpenScience/ember-osf/pull/279 to get the file-editor widget","created_at":"2017-10-09T15:18:06Z","updated_at":"2017-10-26T06:00:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80de53bcae3a11158d46157b04148e71662621f5","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues/17/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/statuses/07455e5449f3bb32af47d461b288e0c775661e61","head":{"label":"baylee-d:feature/add-edit-features","ref":"feature/add-edit-features","sha":"07455e5449f3bb32af47d461b288e0c775661e61","user":{"login":"baylee-d","id":19379783,"avatar_url":"https://avatars0.githubusercontent.com/u/19379783?v=4","gravatar_id":"","url":"https://api.github.com/users/baylee-d","html_url":"https://github.com/baylee-d","followers_url":"https://api.github.com/users/baylee-d/followers","following_url":"https://api.github.com/users/baylee-d/following{/other_user}","gists_url":"https://api.github.com/users/baylee-d/gists{/gist_id}","starred_url":"https://api.github.com/users/baylee-d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baylee-d/subscriptions","organizations_url":"https://api.github.com/users/baylee-d/orgs","repos_url":"https://api.github.com/users/baylee-d/repos","events_url":"https://api.github.com/users/baylee-d/events{/privacy}","received_events_url":"https://api.github.com/users/baylee-d/received_events","type":"User","site_admin":false},"repo":{"id":104222556,"name":"ember-osf-web","full_name":"baylee-d/ember-osf-web","owner":{"login":"baylee-d","id":19379783,"avatar_url":"https://avatars0.githubusercontent.com/u/19379783?v=4","gravatar_id":"","url":"https://api.github.com/users/baylee-d","html_url":"https://github.com/baylee-d","followers_url":"https://api.github.com/users/baylee-d/followers","following_url":"https://api.github.com/users/baylee-d/following{/other_user}","gists_url":"https://api.github.com/users/baylee-d/gists{/gist_id}","starred_url":"https://api.github.com/users/baylee-d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baylee-d/subscriptions","organizations_url":"https://api.github.com/users/baylee-d/orgs","repos_url":"https://api.github.com/users/baylee-d/repos","events_url":"https://api.github.com/users/baylee-d/events{/privacy}","received_events_url":"https://api.github.com/users/baylee-d/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/baylee-d/ember-osf-web","description":null,"fork":true,"url":"https://api.github.com/repos/baylee-d/ember-osf-web","forks_url":"https://api.github.com/repos/baylee-d/ember-osf-web/forks","keys_url":"https://api.github.com/repos/baylee-d/ember-osf-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baylee-d/ember-osf-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baylee-d/ember-osf-web/teams","hooks_url":"https://api.github.com/repos/baylee-d/ember-osf-web/hooks","issue_events_url":"https://api.github.com/repos/baylee-d/ember-osf-web/issues/events{/number}","events_url":"https://api.github.com/repos/baylee-d/ember-osf-web/events","assignees_url":"https://api.github.com/repos/baylee-d/ember-osf-web/assignees{/user}","branches_url":"https://api.github.com/repos/baylee-d/ember-osf-web/branches{/branch}","tags_url":"https://api.github.com/repos/baylee-d/ember-osf-web/tags","blobs_url":"https://api.github.com/repos/baylee-d/ember-osf-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baylee-d/ember-osf-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baylee-d/ember-osf-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/baylee-d/ember-osf-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baylee-d/ember-osf-web/statuses/{sha}","languages_url":"https://api.github.com/repos/baylee-d/ember-osf-web/languages","stargazers_url":"https://api.github.com/repos/baylee-d/ember-osf-web/stargazers","contributors_url":"https://api.github.com/repos/baylee-d/ember-osf-web/contributors","subscribers_url":"https://api.github.com/repos/baylee-d/ember-osf-web/subscribers","subscription_url":"https://api.github.com/repos/baylee-d/ember-osf-web/subscription","commits_url":"https://api.github.com/repos/baylee-d/ember-osf-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/baylee-d/ember-osf-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/baylee-d/ember-osf-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/baylee-d/ember-osf-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/baylee-d/ember-osf-web/contents/{+path}","compare_url":"https://api.github.com/repos/baylee-d/ember-osf-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baylee-d/ember-osf-web/merges","archive_url":"https://api.github.com/repos/baylee-d/ember-osf-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baylee-d/ember-osf-web/downloads","issues_url":"https://api.github.com/repos/baylee-d/ember-osf-web/issues{/number}","pulls_url":"https://api.github.com/repos/baylee-d/ember-osf-web/pulls{/number}","milestones_url":"https://api.github.com/repos/baylee-d/ember-osf-web/milestones{/number}","notifications_url":"https://api.github.com/repos/baylee-d/ember-osf-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baylee-d/ember-osf-web/labels{/name}","releases_url":"https://api.github.com/repos/baylee-d/ember-osf-web/releases{/id}","deployments_url":"https://api.github.com/repos/baylee-d/ember-osf-web/deployments","created_at":"2017-09-20T13:58:48Z","updated_at":"2017-09-14T18:25:41Z","pushed_at":"2017-10-25T18:01:45Z","git_url":"git://github.com/baylee-d/ember-osf-web.git","ssh_url":"git@github.com:baylee-d/ember-osf-web.git","clone_url":"https://github.com/baylee-d/ember-osf-web.git","svn_url":"https://github.com/baylee-d/ember-osf-web","homepage":null,"size":224,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"5842c4273a82d317d44bb538e1667c7c9ed41c48","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars1.githubusercontent.com/u/3344584?v=4","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":103567245,"name":"ember-osf-web","full_name":"CenterForOpenScience/ember-osf-web","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars1.githubusercontent.com/u/3344584?v=4","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/ember-osf-web","description":"Ember front-end for the Open Science Framework","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web","forks_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/releases{/id}","deployments_url":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/deployments","created_at":"2017-09-14T18:25:41Z","updated_at":"2017-10-09T17:17:58Z","pushed_at":"2017-10-25T18:01:47Z","git_url":"git://github.com/CenterForOpenScience/ember-osf-web.git","ssh_url":"git@github.com:CenterForOpenScience/ember-osf-web.git","clone_url":"https://github.com/CenterForOpenScience/ember-osf-web.git","svn_url":"https://github.com/CenterForOpenScience/ember-osf-web","homepage":"https://osf.io","size":218,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17"},"html":{"href":"https://github.com/CenterForOpenScience/ember-osf-web/pull/17"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues/17"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-osf-web/statuses/07455e5449f3bb32af47d461b288e0c775661e61"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jamescdavis"}}