{"action":"created","comment":{"url":"https://api.github.com/repos/aviacommerce/avia/pulls/comments/238305831","pull_request_review_id":180813033,"id":238305831,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODMwNTgzMQ==","diff_hunk":"@@ -31,6 +32,25 @@ export function imageOnEnter(){\n   });\n }\n \n+export function defaultImage(){\n+  $(document).delegate('input[type=\"checkbox\"]', 'click', function(event) {\n+    $(this).parent().siblings().find(':checkbox').prop('checked', false);\n+    var default_image = $(this).val();\n+    var product_id = $(\"#product-id\").val();\n+    var data = { product_id: product_id,  default_image: default_image};\n+    var CSRF_TOKEN = $(\"meta[name='csrf-token']\").attr(\"content\");\n+    $.ajax({\n+      url: `/set-default-image/${product_id}`,\n+      type: \"POST\",\n+      cache: false,\n+      data: data,\n+      beforeSend: function (xhr) {\n+        xhr.setRequestHeader(\"X-CSRF-Token\", CSRF_TOKEN);\n+      }\n+    });\n+ });\n+}\n+\n export function imageOnSubmit(){","path":"apps/admin_app/assets/js/views/product/edit.js","position":31,"original_position":31,"commit_id":"c68c8758b4803c71b4bcd714a71babb73815d65f","original_commit_id":"c68c8758b4803c71b4bcd714a71babb73815d65f","user":{"login":"ashish173","id":2052071,"node_id":"MDQ6VXNlcjIwNTIwNzE=","avatar_url":"https://avatars0.githubusercontent.com/u/2052071?v=4","gravatar_id":"","url":"https://api.github.com/users/ashish173","html_url":"https://github.com/ashish173","followers_url":"https://api.github.com/users/ashish173/followers","following_url":"https://api.github.com/users/ashish173/following{/other_user}","gists_url":"https://api.github.com/users/ashish173/gists{/gist_id}","starred_url":"https://api.github.com/users/ashish173/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashish173/subscriptions","organizations_url":"https://api.github.com/users/ashish173/orgs","repos_url":"https://api.github.com/users/ashish173/repos","events_url":"https://api.github.com/users/ashish173/events{/privacy}","received_events_url":"https://api.github.com/users/ashish173/received_events","type":"User","site_admin":false},"body":"@jyotigautam The function name is clear to describe the working of the function. This can be better. ","created_at":"2018-12-03T15:11:02Z","updated_at":"2018-12-03T15:11:03Z","html_url":"https://github.com/aviacommerce/avia/pull/339#discussion_r238305831","pull_request_url":"https://api.github.com/repos/aviacommerce/avia/pulls/339","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/aviacommerce/avia/pulls/comments/238305831"},"html":{"href":"https://github.com/aviacommerce/avia/pull/339#discussion_r238305831"},"pull_request":{"href":"https://api.github.com/repos/aviacommerce/avia/pulls/339"}}},"pull_request":{"url":"https://api.github.com/repos/aviacommerce/avia/pulls/339","id":235364875,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1MzY0ODc1","html_url":"https://github.com/aviacommerce/avia/pull/339","diff_url":"https://github.com/aviacommerce/avia/pull/339.diff","patch_url":"https://github.com/aviacommerce/avia/pull/339.patch","issue_url":"https://api.github.com/repos/aviacommerce/avia/issues/339","number":339,"state":"open","locked":false,"title":"Set main image for a product","user":{"login":"jyotigautam","id":10372136,"node_id":"MDQ6VXNlcjEwMzcyMTM2","avatar_url":"https://avatars2.githubusercontent.com/u/10372136?v=4","gravatar_id":"","url":"https://api.github.com/users/jyotigautam","html_url":"https://github.com/jyotigautam","followers_url":"https://api.github.com/users/jyotigautam/followers","following_url":"https://api.github.com/users/jyotigautam/following{/other_user}","gists_url":"https://api.github.com/users/jyotigautam/gists{/gist_id}","starred_url":"https://api.github.com/users/jyotigautam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyotigautam/subscriptions","organizations_url":"https://api.github.com/users/jyotigautam/orgs","repos_url":"https://api.github.com/users/jyotigautam/repos","events_url":"https://api.github.com/users/jyotigautam/events{/privacy}","received_events_url":"https://api.github.com/users/jyotigautam/received_events","type":"User","site_admin":false},"body":"Adding checkboxes alongside images to set the main image for the products. \r\n\r\n<!--- Provide a general summary of your changes in the Title above -->\r\n<!--- in NOT MORE THAN 50 characters. Keep it short, pls. -->\r\n\r\n## Motivation and Context\r\nPresently the images added to a product have no order, hence there should be a provision to select an image and make it as a default image to be shown for a particular product.\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n<!--- If it delivers a story on the Pivotal tracker, please link to it here. -->\r\n\r\n## Describe your changes\r\nAdded a checkbox on the images to select the main image to show as front image of the product.\r\n\r\nResolves [162156592](https://www.pivotaltracker.com/story/show/162156592)\r\n<!--- List and detail all changes made in this PR. -->\r\n------\r\n## Checklist\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [ ] I have read [CONTRIBUTING.md][contributing].\r\n- [ ] My code follows the [style guidelines][contributing] of this project.\r\n- [ ] I have commented my code, particularly in hard-to-understand areas.\r\n- [ ] My code does not generate any (new) [`credo`][credo] and compile-time warnings.\r\n- [ ] I have updated the documentation wherever necessary.\r\n- [ ] I have added tests to cover my changes.\r\n\r\n[contributing]: https://github.com/aviabird/snitch/CONTRIBUTING.md\r\n[credo]: https://github.com/rrrene/credo\r\n\r\n<!--- DO NOT REMOVE SECTION BELOW -->\r\n------\r\nDear Gatekeeper,\r\n\r\nPlease make sure that the commits that will be merged or rebased into the base\r\nbranch are [formatted according to our standards][commit-style].\r\n\r\n> The only additional requirement is that the the PR number must appear in the\r\n> commit title in brackets: `(#XXX)`\r\n\r\n[commit-style]: https://github.com/aviabird/snitch/blob/develop/CONTRIBUTING.md#styling\r\n","created_at":"2018-12-03T08:40:06Z","updated_at":"2018-12-03T15:11:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43580d4e59cdc94d0a8411da0b19ac98826719d5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"SagarKarwande","id":12864766,"node_id":"MDQ6VXNlcjEyODY0NzY2","avatar_url":"https://avatars1.githubusercontent.com/u/12864766?v=4","gravatar_id":"","url":"https://api.github.com/users/SagarKarwande","html_url":"https://github.com/SagarKarwande","followers_url":"https://api.github.com/users/SagarKarwande/followers","following_url":"https://api.github.com/users/SagarKarwande/following{/other_user}","gists_url":"https://api.github.com/users/SagarKarwande/gists{/gist_id}","starred_url":"https://api.github.com/users/SagarKarwande/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SagarKarwande/subscriptions","organizations_url":"https://api.github.com/users/SagarKarwande/orgs","repos_url":"https://api.github.com/users/SagarKarwande/repos","events_url":"https://api.github.com/users/SagarKarwande/events{/privacy}","received_events_url":"https://api.github.com/users/SagarKarwande/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":839033828,"node_id":"MDU6TGFiZWw4MzkwMzM4Mjg=","url":"https://api.github.com/repos/aviacommerce/avia/labels/PR%20state:%20review%20and%20merge","name":"PR state: review and merge","color":"8bf977","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/aviacommerce/avia/pulls/339/commits","review_comments_url":"https://api.github.com/repos/aviacommerce/avia/pulls/339/comments","review_comment_url":"https://api.github.com/repos/aviacommerce/avia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aviacommerce/avia/issues/339/comments","statuses_url":"https://api.github.com/repos/aviacommerce/avia/statuses/c68c8758b4803c71b4bcd714a71babb73815d65f","head":{"label":"aviacommerce:default_image","ref":"default_image","sha":"c68c8758b4803c71b4bcd714a71babb73815d65f","user":{"login":"aviacommerce","id":43067086,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDY3MDg2","avatar_url":"https://avatars0.githubusercontent.com/u/43067086?v=4","gravatar_id":"","url":"https://api.github.com/users/aviacommerce","html_url":"https://github.com/aviacommerce","followers_url":"https://api.github.com/users/aviacommerce/followers","following_url":"https://api.github.com/users/aviacommerce/following{/other_user}","gists_url":"https://api.github.com/users/aviacommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/aviacommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviacommerce/subscriptions","organizations_url":"https://api.github.com/users/aviacommerce/orgs","repos_url":"https://api.github.com/users/aviacommerce/repos","events_url":"https://api.github.com/users/aviacommerce/events{/privacy}","received_events_url":"https://api.github.com/users/aviacommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":121001913,"node_id":"MDEwOlJlcG9zaXRvcnkxMjEwMDE5MTM=","name":"avia","full_name":"aviacommerce/avia","private":false,"owner":{"login":"aviacommerce","id":43067086,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDY3MDg2","avatar_url":"https://avatars0.githubusercontent.com/u/43067086?v=4","gravatar_id":"","url":"https://api.github.com/users/aviacommerce","html_url":"https://github.com/aviacommerce","followers_url":"https://api.github.com/users/aviacommerce/followers","following_url":"https://api.github.com/users/aviacommerce/following{/other_user}","gists_url":"https://api.github.com/users/aviacommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/aviacommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviacommerce/subscriptions","organizations_url":"https://api.github.com/users/aviacommerce/orgs","repos_url":"https://api.github.com/users/aviacommerce/repos","events_url":"https://api.github.com/users/aviacommerce/events{/privacy}","received_events_url":"https://api.github.com/users/aviacommerce/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aviacommerce/avia","description":"E-Commerce re-invented in Elixir","fork":false,"url":"https://api.github.com/repos/aviacommerce/avia","forks_url":"https://api.github.com/repos/aviacommerce/avia/forks","keys_url":"https://api.github.com/repos/aviacommerce/avia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aviacommerce/avia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aviacommerce/avia/teams","hooks_url":"https://api.github.com/repos/aviacommerce/avia/hooks","issue_events_url":"https://api.github.com/repos/aviacommerce/avia/issues/events{/number}","events_url":"https://api.github.com/repos/aviacommerce/avia/events","assignees_url":"https://api.github.com/repos/aviacommerce/avia/assignees{/user}","branches_url":"https://api.github.com/repos/aviacommerce/avia/branches{/branch}","tags_url":"https://api.github.com/repos/aviacommerce/avia/tags","blobs_url":"https://api.github.com/repos/aviacommerce/avia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aviacommerce/avia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aviacommerce/avia/git/refs{/sha}","trees_url":"https://api.github.com/repos/aviacommerce/avia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aviacommerce/avia/statuses/{sha}","languages_url":"https://api.github.com/repos/aviacommerce/avia/languages","stargazers_url":"https://api.github.com/repos/aviacommerce/avia/stargazers","contributors_url":"https://api.github.com/repos/aviacommerce/avia/contributors","subscribers_url":"https://api.github.com/repos/aviacommerce/avia/subscribers","subscription_url":"https://api.github.com/repos/aviacommerce/avia/subscription","commits_url":"https://api.github.com/repos/aviacommerce/avia/commits{/sha}","git_commits_url":"https://api.github.com/repos/aviacommerce/avia/git/commits{/sha}","comments_url":"https://api.github.com/repos/aviacommerce/avia/comments{/number}","issue_comment_url":"https://api.github.com/repos/aviacommerce/avia/issues/comments{/number}","contents_url":"https://api.github.com/repos/aviacommerce/avia/contents/{+path}","compare_url":"https://api.github.com/repos/aviacommerce/avia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aviacommerce/avia/merges","archive_url":"https://api.github.com/repos/aviacommerce/avia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aviacommerce/avia/downloads","issues_url":"https://api.github.com/repos/aviacommerce/avia/issues{/number}","pulls_url":"https://api.github.com/repos/aviacommerce/avia/pulls{/number}","milestones_url":"https://api.github.com/repos/aviacommerce/avia/milestones{/number}","notifications_url":"https://api.github.com/repos/aviacommerce/avia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aviacommerce/avia/labels{/name}","releases_url":"https://api.github.com/repos/aviacommerce/avia/releases{/id}","deployments_url":"https://api.github.com/repos/aviacommerce/avia/deployments","created_at":"2018-02-10T09:24:32Z","updated_at":"2018-12-03T12:22:34Z","pushed_at":"2018-12-03T12:25:01Z","git_url":"git://github.com/aviacommerce/avia.git","ssh_url":"git@github.com:aviacommerce/avia.git","clone_url":"https://github.com/aviacommerce/avia.git","svn_url":"https://github.com/aviacommerce/avia","homepage":"https://www.aviacommerce.org/","size":2563,"stargazers_count":114,"watchers_count":114,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":23,"open_issues":30,"watchers":114,"default_branch":"develop"}},"base":{"label":"aviacommerce:develop","ref":"develop","sha":"fc9c9ea23de90860f002e8c50c8b30404c99d5ed","user":{"login":"aviacommerce","id":43067086,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDY3MDg2","avatar_url":"https://avatars0.githubusercontent.com/u/43067086?v=4","gravatar_id":"","url":"https://api.github.com/users/aviacommerce","html_url":"https://github.com/aviacommerce","followers_url":"https://api.github.com/users/aviacommerce/followers","following_url":"https://api.github.com/users/aviacommerce/following{/other_user}","gists_url":"https://api.github.com/users/aviacommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/aviacommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviacommerce/subscriptions","organizations_url":"https://api.github.com/users/aviacommerce/orgs","repos_url":"https://api.github.com/users/aviacommerce/repos","events_url":"https://api.github.com/users/aviacommerce/events{/privacy}","received_events_url":"https://api.github.com/users/aviacommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":121001913,"node_id":"MDEwOlJlcG9zaXRvcnkxMjEwMDE5MTM=","name":"avia","full_name":"aviacommerce/avia","private":false,"owner":{"login":"aviacommerce","id":43067086,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDY3MDg2","avatar_url":"https://avatars0.githubusercontent.com/u/43067086?v=4","gravatar_id":"","url":"https://api.github.com/users/aviacommerce","html_url":"https://github.com/aviacommerce","followers_url":"https://api.github.com/users/aviacommerce/followers","following_url":"https://api.github.com/users/aviacommerce/following{/other_user}","gists_url":"https://api.github.com/users/aviacommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/aviacommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviacommerce/subscriptions","organizations_url":"https://api.github.com/users/aviacommerce/orgs","repos_url":"https://api.github.com/users/aviacommerce/repos","events_url":"https://api.github.com/users/aviacommerce/events{/privacy}","received_events_url":"https://api.github.com/users/aviacommerce/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aviacommerce/avia","description":"E-Commerce re-invented in Elixir","fork":false,"url":"https://api.github.com/repos/aviacommerce/avia","forks_url":"https://api.github.com/repos/aviacommerce/avia/forks","keys_url":"https://api.github.com/repos/aviacommerce/avia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aviacommerce/avia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aviacommerce/avia/teams","hooks_url":"https://api.github.com/repos/aviacommerce/avia/hooks","issue_events_url":"https://api.github.com/repos/aviacommerce/avia/issues/events{/number}","events_url":"https://api.github.com/repos/aviacommerce/avia/events","assignees_url":"https://api.github.com/repos/aviacommerce/avia/assignees{/user}","branches_url":"https://api.github.com/repos/aviacommerce/avia/branches{/branch}","tags_url":"https://api.github.com/repos/aviacommerce/avia/tags","blobs_url":"https://api.github.com/repos/aviacommerce/avia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aviacommerce/avia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aviacommerce/avia/git/refs{/sha}","trees_url":"https://api.github.com/repos/aviacommerce/avia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aviacommerce/avia/statuses/{sha}","languages_url":"https://api.github.com/repos/aviacommerce/avia/languages","stargazers_url":"https://api.github.com/repos/aviacommerce/avia/stargazers","contributors_url":"https://api.github.com/repos/aviacommerce/avia/contributors","subscribers_url":"https://api.github.com/repos/aviacommerce/avia/subscribers","subscription_url":"https://api.github.com/repos/aviacommerce/avia/subscription","commits_url":"https://api.github.com/repos/aviacommerce/avia/commits{/sha}","git_commits_url":"https://api.github.com/repos/aviacommerce/avia/git/commits{/sha}","comments_url":"https://api.github.com/repos/aviacommerce/avia/comments{/number}","issue_comment_url":"https://api.github.com/repos/aviacommerce/avia/issues/comments{/number}","contents_url":"https://api.github.com/repos/aviacommerce/avia/contents/{+path}","compare_url":"https://api.github.com/repos/aviacommerce/avia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aviacommerce/avia/merges","archive_url":"https://api.github.com/repos/aviacommerce/avia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aviacommerce/avia/downloads","issues_url":"https://api.github.com/repos/aviacommerce/avia/issues{/number}","pulls_url":"https://api.github.com/repos/aviacommerce/avia/pulls{/number}","milestones_url":"https://api.github.com/repos/aviacommerce/avia/milestones{/number}","notifications_url":"https://api.github.com/repos/aviacommerce/avia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aviacommerce/avia/labels{/name}","releases_url":"https://api.github.com/repos/aviacommerce/avia/releases{/id}","deployments_url":"https://api.github.com/repos/aviacommerce/avia/deployments","created_at":"2018-02-10T09:24:32Z","updated_at":"2018-12-03T12:22:34Z","pushed_at":"2018-12-03T12:25:01Z","git_url":"git://github.com/aviacommerce/avia.git","ssh_url":"git@github.com:aviacommerce/avia.git","clone_url":"https://github.com/aviacommerce/avia.git","svn_url":"https://github.com/aviacommerce/avia","homepage":"https://www.aviacommerce.org/","size":2563,"stargazers_count":114,"watchers_count":114,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":23,"open_issues":30,"watchers":114,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/aviacommerce/avia/pulls/339"},"html":{"href":"https://github.com/aviacommerce/avia/pull/339"},"issue":{"href":"https://api.github.com/repos/aviacommerce/avia/issues/339"},"comments":{"href":"https://api.github.com/repos/aviacommerce/avia/issues/339/comments"},"review_comments":{"href":"https://api.github.com/repos/aviacommerce/avia/pulls/339/comments"},"review_comment":{"href":"https://api.github.com/repos/aviacommerce/avia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aviacommerce/avia/pulls/339/commits"},"statuses":{"href":"https://api.github.com/repos/aviacommerce/avia/statuses/c68c8758b4803c71b4bcd714a71babb73815d65f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ashish173"}}