{"action":"created","comment":{"url":"https://api.github.com/repos/google/ggrc-core/pulls/comments/59229351","id":59229351,"diff_hunk":"@@ -0,0 +1,56 @@\n+/*!\n+    Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n+    Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n+    Created By: ivan@reciprocitylabs.com\n+    Maintained By: ivan@reciprocitylabs.com\n+*/\n+\n+(function (can, $) {\n+  'use strict';\n+\n+  GGRC.Components('assessmentTemplates', {\n+    tag: 'assessment-templates',\n+    template: can.view(\n+      GGRC.mustache_path +\n+      '/components/assessment_templates/assessment_templates.mustache'\n+    ),\n+    scope: {\n+      binding: '@',\n+      responses: [],\n+      templates: function () {\n+        var type = this.attr('type');\n+        var responses = this.attr('responses');\n+        var noValue = {\n+          title: 'No template',\n+          value: ''\n+        };\n+        var items = _.compact(_.map(responses, function (response) {\n+          if (!response.instance) {\n+            return;\n+          }\n+          if (response.instance.template_object_type !== type) {\n+            return;\n+          }\n+          return {\n+            title: response.instance.title,\n+            value: response.instance.id\n+          };\n+        }));\n+        return [noValue].concat(items);\n+      }\n+    },\n+    events: {\n+      '{scope} type': function () {\n+        this.scope.attr('assessmentTemplate', '');\n+      }\n+    },\n+    init: function () {\n+      var instance = this.scope.attr('instance');\n+      var binding = instance.get_binding(this.scope.attr('binding'));\n+\n+      binding.refresh_instances().done(function (response) {\n+        this.scope.attr('responses', response);\n+      }.bind(this));","path":"src/ggrc/assets/javascripts/components/assessment_templates/assessment_templates.js","position":53,"original_position":53,"commit_id":"df8881b1367c4122138d657282b74ee2bca91fe4","original_commit_id":"a6b44095c52ca2eac0f8fb3800774e4a5bcef7db","user":{"login":"plamut","id":1235663,"avatar_url":"https://avatars.githubusercontent.com/u/1235663?v=3","gravatar_id":"","url":"https://api.github.com/users/plamut","html_url":"https://github.com/plamut","followers_url":"https://api.github.com/users/plamut/followers","following_url":"https://api.github.com/users/plamut/following{/other_user}","gists_url":"https://api.github.com/users/plamut/gists{/gist_id}","starred_url":"https://api.github.com/users/plamut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamut/subscriptions","organizations_url":"https://api.github.com/users/plamut/orgs","repos_url":"https://api.github.com/users/plamut/repos","events_url":"https://api.github.com/users/plamut/events{/privacy}","received_events_url":"https://api.github.com/users/plamut/received_events","type":"User","site_admin":false},"body":"I don't know, probably just display an error toast message?\r\nNevertheless, silently ignoring it is also an option if we decide for it, just thinking aloud here...","created_at":"2016-04-11T15:53:18Z","updated_at":"2016-04-11T15:53:18Z","html_url":"https://github.com/google/ggrc-core/pull/3709#discussion_r59229351","pull_request_url":"https://api.github.com/repos/google/ggrc-core/pulls/3709","_links":{"self":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/comments/59229351"},"html":{"href":"https://github.com/google/ggrc-core/pull/3709#discussion_r59229351"},"pull_request":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/3709"}}},"pull_request":{"url":"https://api.github.com/repos/google/ggrc-core/pulls/3709","id":64650943,"html_url":"https://github.com/google/ggrc-core/pull/3709","diff_url":"https://github.com/google/ggrc-core/pull/3709.diff","patch_url":"https://github.com/google/ggrc-core/pull/3709.patch","issue_url":"https://api.github.com/repos/google/ggrc-core/issues/3709","number":3709,"state":"open","locked":false,"title":"CORE-2966 Generate assessment with templates","user":{"login":"hyperNURb","id":59742,"avatar_url":"https://avatars.githubusercontent.com/u/59742?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperNURb","html_url":"https://github.com/hyperNURb","followers_url":"https://api.github.com/users/hyperNURb/followers","following_url":"https://api.github.com/users/hyperNURb/following{/other_user}","gists_url":"https://api.github.com/users/hyperNURb/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperNURb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperNURb/subscriptions","organizations_url":"https://api.github.com/users/hyperNURb/orgs","repos_url":"https://api.github.com/users/hyperNURb/repos","events_url":"https://api.github.com/users/hyperNURb/events{/privacy}","received_events_url":"https://api.github.com/users/hyperNURb/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-30T15:50:33Z","updated_at":"2016-04-11T15:53:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb8070ced90322de58d1eed6372ff5ea7ea24af3","assignee":null,"milestone":{"url":"https://api.github.com/repos/google/ggrc-core/milestones/16","html_url":"https://github.com/google/ggrc-core/milestones/0.9.6-Plum%20Jelly","labels_url":"https://api.github.com/repos/google/ggrc-core/milestones/16/labels","id":1058061,"number":16,"title":"0.9.6-Plum Jelly","description":"","creator":{"login":"Smotko","id":513444,"avatar_url":"https://avatars.githubusercontent.com/u/513444?v=3","gravatar_id":"","url":"https://api.github.com/users/Smotko","html_url":"https://github.com/Smotko","followers_url":"https://api.github.com/users/Smotko/followers","following_url":"https://api.github.com/users/Smotko/following{/other_user}","gists_url":"https://api.github.com/users/Smotko/gists{/gist_id}","starred_url":"https://api.github.com/users/Smotko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smotko/subscriptions","organizations_url":"https://api.github.com/users/Smotko/orgs","repos_url":"https://api.github.com/users/Smotko/repos","events_url":"https://api.github.com/users/Smotko/events{/privacy}","received_events_url":"https://api.github.com/users/Smotko/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":269,"state":"open","created_at":"2015-04-08T11:38:13Z","updated_at":"2016-04-11T14:10:13Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/google/ggrc-core/pulls/3709/commits","review_comments_url":"https://api.github.com/repos/google/ggrc-core/pulls/3709/comments","review_comment_url":"https://api.github.com/repos/google/ggrc-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/ggrc-core/issues/3709/comments","statuses_url":"https://api.github.com/repos/google/ggrc-core/statuses/df8881b1367c4122138d657282b74ee2bca91fe4","head":{"label":"hyperNURb:feature/CORE-2966","ref":"feature/CORE-2966","sha":"df8881b1367c4122138d657282b74ee2bca91fe4","user":{"login":"hyperNURb","id":59742,"avatar_url":"https://avatars.githubusercontent.com/u/59742?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperNURb","html_url":"https://github.com/hyperNURb","followers_url":"https://api.github.com/users/hyperNURb/followers","following_url":"https://api.github.com/users/hyperNURb/following{/other_user}","gists_url":"https://api.github.com/users/hyperNURb/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperNURb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperNURb/subscriptions","organizations_url":"https://api.github.com/users/hyperNURb/orgs","repos_url":"https://api.github.com/users/hyperNURb/repos","events_url":"https://api.github.com/users/hyperNURb/events{/privacy}","received_events_url":"https://api.github.com/users/hyperNURb/received_events","type":"User","site_admin":false},"repo":{"id":34402765,"name":"ggrc-core","full_name":"hyperNURb/ggrc-core","owner":{"login":"hyperNURb","id":59742,"avatar_url":"https://avatars.githubusercontent.com/u/59742?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperNURb","html_url":"https://github.com/hyperNURb","followers_url":"https://api.github.com/users/hyperNURb/followers","following_url":"https://api.github.com/users/hyperNURb/following{/other_user}","gists_url":"https://api.github.com/users/hyperNURb/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperNURb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperNURb/subscriptions","organizations_url":"https://api.github.com/users/hyperNURb/orgs","repos_url":"https://api.github.com/users/hyperNURb/repos","events_url":"https://api.github.com/users/hyperNURb/events{/privacy}","received_events_url":"https://api.github.com/users/hyperNURb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hyperNURb/ggrc-core","description":"GGRC Core","fork":true,"url":"https://api.github.com/repos/hyperNURb/ggrc-core","forks_url":"https://api.github.com/repos/hyperNURb/ggrc-core/forks","keys_url":"https://api.github.com/repos/hyperNURb/ggrc-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperNURb/ggrc-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperNURb/ggrc-core/teams","hooks_url":"https://api.github.com/repos/hyperNURb/ggrc-core/hooks","issue_events_url":"https://api.github.com/repos/hyperNURb/ggrc-core/issues/events{/number}","events_url":"https://api.github.com/repos/hyperNURb/ggrc-core/events","assignees_url":"https://api.github.com/repos/hyperNURb/ggrc-core/assignees{/user}","branches_url":"https://api.github.com/repos/hyperNURb/ggrc-core/branches{/branch}","tags_url":"https://api.github.com/repos/hyperNURb/ggrc-core/tags","blobs_url":"https://api.github.com/repos/hyperNURb/ggrc-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperNURb/ggrc-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperNURb/ggrc-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperNURb/ggrc-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperNURb/ggrc-core/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperNURb/ggrc-core/languages","stargazers_url":"https://api.github.com/repos/hyperNURb/ggrc-core/stargazers","contributors_url":"https://api.github.com/repos/hyperNURb/ggrc-core/contributors","subscribers_url":"https://api.github.com/repos/hyperNURb/ggrc-core/subscribers","subscription_url":"https://api.github.com/repos/hyperNURb/ggrc-core/subscription","commits_url":"https://api.github.com/repos/hyperNURb/ggrc-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperNURb/ggrc-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperNURb/ggrc-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperNURb/ggrc-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperNURb/ggrc-core/contents/{+path}","compare_url":"https://api.github.com/repos/hyperNURb/ggrc-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperNURb/ggrc-core/merges","archive_url":"https://api.github.com/repos/hyperNURb/ggrc-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperNURb/ggrc-core/downloads","issues_url":"https://api.github.com/repos/hyperNURb/ggrc-core/issues{/number}","pulls_url":"https://api.github.com/repos/hyperNURb/ggrc-core/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperNURb/ggrc-core/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperNURb/ggrc-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperNURb/ggrc-core/labels{/name}","releases_url":"https://api.github.com/repos/hyperNURb/ggrc-core/releases{/id}","deployments_url":"https://api.github.com/repos/hyperNURb/ggrc-core/deployments","created_at":"2015-04-22T16:45:05Z","updated_at":"2015-09-25T08:31:35Z","pushed_at":"2016-04-11T15:34:36Z","git_url":"git://github.com/hyperNURb/ggrc-core.git","ssh_url":"git@github.com:hyperNURb/ggrc-core.git","clone_url":"https://github.com/hyperNURb/ggrc-core.git","svn_url":"https://github.com/hyperNURb/ggrc-core","homepage":null,"size":51778,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"google:develop","ref":"develop","sha":"8510bb1a993d5fe49f10db47cf6023e64e089004","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":9304637,"name":"ggrc-core","full_name":"google/ggrc-core","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/ggrc-core","description":"GGRC Core","fork":false,"url":"https://api.github.com/repos/google/ggrc-core","forks_url":"https://api.github.com/repos/google/ggrc-core/forks","keys_url":"https://api.github.com/repos/google/ggrc-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/ggrc-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/ggrc-core/teams","hooks_url":"https://api.github.com/repos/google/ggrc-core/hooks","issue_events_url":"https://api.github.com/repos/google/ggrc-core/issues/events{/number}","events_url":"https://api.github.com/repos/google/ggrc-core/events","assignees_url":"https://api.github.com/repos/google/ggrc-core/assignees{/user}","branches_url":"https://api.github.com/repos/google/ggrc-core/branches{/branch}","tags_url":"https://api.github.com/repos/google/ggrc-core/tags","blobs_url":"https://api.github.com/repos/google/ggrc-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/ggrc-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/ggrc-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/ggrc-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/ggrc-core/statuses/{sha}","languages_url":"https://api.github.com/repos/google/ggrc-core/languages","stargazers_url":"https://api.github.com/repos/google/ggrc-core/stargazers","contributors_url":"https://api.github.com/repos/google/ggrc-core/contributors","subscribers_url":"https://api.github.com/repos/google/ggrc-core/subscribers","subscription_url":"https://api.github.com/repos/google/ggrc-core/subscription","commits_url":"https://api.github.com/repos/google/ggrc-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/ggrc-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/ggrc-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/ggrc-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/ggrc-core/contents/{+path}","compare_url":"https://api.github.com/repos/google/ggrc-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/ggrc-core/merges","archive_url":"https://api.github.com/repos/google/ggrc-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/ggrc-core/downloads","issues_url":"https://api.github.com/repos/google/ggrc-core/issues{/number}","pulls_url":"https://api.github.com/repos/google/ggrc-core/pulls{/number}","milestones_url":"https://api.github.com/repos/google/ggrc-core/milestones{/number}","notifications_url":"https://api.github.com/repos/google/ggrc-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/ggrc-core/labels{/name}","releases_url":"https://api.github.com/repos/google/ggrc-core/releases{/id}","deployments_url":"https://api.github.com/repos/google/ggrc-core/deployments","created_at":"2013-04-08T19:16:28Z","updated_at":"2016-04-05T14:33:43Z","pushed_at":"2016-04-11T15:34:37Z","git_url":"git://github.com/google/ggrc-core.git","ssh_url":"git@github.com:google/ggrc-core.git","clone_url":"https://github.com/google/ggrc-core.git","svn_url":"https://github.com/google/ggrc-core","homepage":null,"size":58005,"stargazers_count":82,"watchers_count":82,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":19,"forks":53,"open_issues":19,"watchers":82,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/3709"},"html":{"href":"https://github.com/google/ggrc-core/pull/3709"},"issue":{"href":"https://api.github.com/repos/google/ggrc-core/issues/3709"},"comments":{"href":"https://api.github.com/repos/google/ggrc-core/issues/3709/comments"},"review_comments":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/3709/comments"},"review_comment":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/3709/commits"},"statuses":{"href":"https://api.github.com/repos/google/ggrc-core/statuses/df8881b1367c4122138d657282b74ee2bca91fe4"}}}}