{"action":"created","comment":{"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments/32878748","id":32878748,"diff_hunk":"@@ -63,6 +64,29 @@ export default Ember.ObjectController.extend({\n             });\n \n             this.endPropertyChanges();\n+        },\n+        generateProtocol: function() {\n+            var filename = this.get('model.title') + '.xml';\n+            $.ajax({\n+                beforeSend: function(xhr) {\n+                    xhr.setRequestHeader('Authorization', 'Token ' + Cookies.get('authorizationToken'));\n+                },\n+                type: 'GET',\n+                url: ENV.APP.API_HOST + '/' + ENV.APP.API_NAMESPACE + '/procedures/' + this.get('model.id') + '/generate/',\n+                success: function(data) {\n+                    var blob = new Blob([(new XMLSerializer()).serializeToString(data)], { type: 'text/xml' });\n+                    var url = window.URL.createObjectURL(blob);\n+                    var a = document.createElement(\"a\");\n+                    var randomId = Math.random().toString();","path":"src-frontend/app/controllers/procedure.js","position":23,"original_position":23,"commit_id":"00e5c8124ef4cf5ed18cc1b363e78c21a83e059e","original_commit_id":"00e5c8124ef4cf5ed18cc1b363e78c21a83e059e","user":{"login":"Ommy","id":978947,"avatar_url":"https://avatars.githubusercontent.com/u/978947?v=3","gravatar_id":"","url":"https://api.github.com/users/Ommy","html_url":"https://github.com/Ommy","followers_url":"https://api.github.com/users/Ommy/followers","following_url":"https://api.github.com/users/Ommy/following{/other_user}","gists_url":"https://api.github.com/users/Ommy/gists{/gist_id}","starred_url":"https://api.github.com/users/Ommy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ommy/subscriptions","organizations_url":"https://api.github.com/users/Ommy/orgs","repos_url":"https://api.github.com/users/Ommy/repos","events_url":"https://api.github.com/users/Ommy/events{/privacy}","received_events_url":"https://api.github.com/users/Ommy/received_events","type":"User","site_admin":false},"body":"Why do we need to use a random number string for an ID vs simply giving it an explicit ID?","created_at":"2015-06-19T23:57:51Z","updated_at":"2015-06-19T23:57:51Z","html_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/134#discussion_r32878748","pull_request_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134","_links":{"self":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments/32878748"},"html":{"href":"https://github.com/SanaMobile/sana.protocol_builder/pull/134#discussion_r32878748"},"pull_request":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134","id":38075237,"html_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/134","diff_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/134.diff","patch_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/134.patch","issue_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/134","number":134,"state":"open","locked":false,"title":"Generator API and file saving","user":{"login":"Kapin","id":995382,"avatar_url":"https://avatars.githubusercontent.com/u/995382?v=3","gravatar_id":"","url":"https://api.github.com/users/Kapin","html_url":"https://github.com/Kapin","followers_url":"https://api.github.com/users/Kapin/followers","following_url":"https://api.github.com/users/Kapin/following{/other_user}","gists_url":"https://api.github.com/users/Kapin/gists{/gist_id}","starred_url":"https://api.github.com/users/Kapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kapin/subscriptions","organizations_url":"https://api.github.com/users/Kapin/orgs","repos_url":"https://api.github.com/users/Kapin/repos","events_url":"https://api.github.com/users/Kapin/events{/privacy}","received_events_url":"https://api.github.com/users/Kapin/received_events","type":"User","site_admin":false},"body":"Javascript part is a tad hacky, but that is the recommended way of doing it.\r\n\r\nStill needs styling work.\r\n\r\nDepends on #120 ","created_at":"2015-06-19T03:59:48Z","updated_at":"2015-06-19T23:57:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"967f9b0c68adc0e90127610b31f9c028d5dd39ad","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134/commits","review_comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134/comments","review_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/134/comments","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/00e5c8124ef4cf5ed18cc1b363e78c21a83e059e","head":{"label":"SanaMobile:josh/generator-api","ref":"josh/generator-api","sha":"00e5c8124ef4cf5ed18cc1b363e78c21a83e059e","user":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"repo":{"id":25015456,"name":"sana.protocol_builder","full_name":"SanaMobile/sana.protocol_builder","owner":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SanaMobile/sana.protocol_builder","description":"Web app for building Sana Protocols","fork":false,"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder","forks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/forks","keys_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/teams","hooks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/hooks","issue_events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/events{/number}","events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/events","assignees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/assignees{/user}","branches_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/branches{/branch}","tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/tags","blobs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/{sha}","languages_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/languages","stargazers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/stargazers","contributors_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contributors","subscribers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscribers","subscription_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscription","commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contents/{+path}","compare_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/merges","archive_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/downloads","issues_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues{/number}","pulls_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls{/number}","milestones_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/milestones{/number}","notifications_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/labels{/name}","releases_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/releases{/id}","created_at":"2014-10-10T01:24:58Z","updated_at":"2015-06-09T14:50:44Z","pushed_at":"2015-06-19T23:34:59Z","git_url":"git://github.com/SanaMobile/sana.protocol_builder.git","ssh_url":"git@github.com:SanaMobile/sana.protocol_builder.git","clone_url":"https://github.com/SanaMobile/sana.protocol_builder.git","svn_url":"https://github.com/SanaMobile/sana.protocol_builder","homepage":"","size":6750,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":3,"default_branch":"master"}},"base":{"label":"SanaMobile:master","ref":"master","sha":"c39c1f79928ec664710825aacee1de150ce7d0d2","user":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"repo":{"id":25015456,"name":"sana.protocol_builder","full_name":"SanaMobile/sana.protocol_builder","owner":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SanaMobile/sana.protocol_builder","description":"Web app for building Sana Protocols","fork":false,"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder","forks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/forks","keys_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/teams","hooks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/hooks","issue_events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/events{/number}","events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/events","assignees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/assignees{/user}","branches_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/branches{/branch}","tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/tags","blobs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/{sha}","languages_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/languages","stargazers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/stargazers","contributors_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contributors","subscribers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscribers","subscription_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscription","commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contents/{+path}","compare_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/merges","archive_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/downloads","issues_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues{/number}","pulls_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls{/number}","milestones_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/milestones{/number}","notifications_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/labels{/name}","releases_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/releases{/id}","created_at":"2014-10-10T01:24:58Z","updated_at":"2015-06-09T14:50:44Z","pushed_at":"2015-06-19T23:34:59Z","git_url":"git://github.com/SanaMobile/sana.protocol_builder.git","ssh_url":"git@github.com:SanaMobile/sana.protocol_builder.git","clone_url":"https://github.com/SanaMobile/sana.protocol_builder.git","svn_url":"https://github.com/SanaMobile/sana.protocol_builder","homepage":"","size":6750,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134"},"html":{"href":"https://github.com/SanaMobile/sana.protocol_builder/pull/134"},"issue":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/134"},"comments":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/00e5c8124ef4cf5ed18cc1b363e78c21a83e059e"}}}}