{"action":"created","comment":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/37421577","id":37421577,"diff_hunk":"@@ -1377,45 +1382,154 @@ define(function (require, exports) {\n     };\n \n     /**\n+     * Helper function to find the right most artboard \\\n+     * \n+     * @private \n+     * @param {Immutable.List.<Layer>} artboards\n+     * @return {Layer}\n+     */\n+    var _findRightMostArtboard = function (artboards) {\n+        var layer = artboards.reduce(function (selectedLayer, currentLayer) {\n+            if (currentLayer.bounds.right > selectedLayer.bounds.right) {\n+                return currentLayer;\n+            } else {\n+                return selectedLayer;\n+            }\n+        }, artboards.first());\n+        return layer;\n+    };\n+\n+    /**\n+     * Helper function to get Bounds from specs (template preset)\n+     *\n+     * @private\n+     * @param {object} specs \n+     * @param {Immutable.List.<Layer>} artboards\n+     * @param {Layer} layerRef\n+     * @return {{finalBounds: Bounds, layerRef: Layer}}\n+     */\n+    var _getBoundsFromSpecs = function (specs, artboards, layerRef) {\n+        var preset = specs.preset,\n+            width,\n+            height,\n+            finalBounds;\n+\n+        var index = _.findIndex(templates, function (obj) {\n+                return obj.preset === preset;\n+            });\n+\n+        height = templates[index].height;\n+        width = templates[index].width;\n+\n+\n+        // if artboards are empty, insert template at first position \n+        if (artboards.isEmpty()) {\n+            layerRef = layerLib.referenceBy.current;\n+            finalBounds = new Bounds({\n+                top: DEFAULT_ARTBOARD_BOUNDS.top,\n+                bottom: height,\n+                left: DEFAULT_ARTBOARD_BOUNDS.left,\n+                right: width\n+            });\n+        } else {\n+            // find the rightmost artboard and insert the template after this \n+            var rightMostLayer = _findRightMostArtboard(artboards);","path":"src/js/actions/layers.js","position":68,"original_position":72,"commit_id":"5dd2ad0ac469f1ecb1e2e1f87227cc656f3aaf41","original_commit_id":"64352b153d617f93a9298196648aa33acbf3cfce","user":{"login":"iwehrman","id":1075154,"avatar_url":"https://avatars.githubusercontent.com/u/1075154?v=3","gravatar_id":"","url":"https://api.github.com/users/iwehrman","html_url":"https://github.com/iwehrman","followers_url":"https://api.github.com/users/iwehrman/followers","following_url":"https://api.github.com/users/iwehrman/following{/other_user}","gists_url":"https://api.github.com/users/iwehrman/gists{/gist_id}","starred_url":"https://api.github.com/users/iwehrman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwehrman/subscriptions","organizations_url":"https://api.github.com/users/iwehrman/orgs","repos_url":"https://api.github.com/users/iwehrman/repos","events_url":"https://api.github.com/users/iwehrman/events{/privacy}","received_events_url":"https://api.github.com/users/iwehrman/received_events","type":"User","site_admin":false},"body":"Still need to group these decls. ","created_at":"2015-08-19T14:36:48Z","updated_at":"2015-08-19T14:36:48Z","html_url":"https://github.com/adobe-photoshop/spaces-design/pull/2063#discussion_r37421577","pull_request_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063","_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/37421577"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/2063#discussion_r37421577"},"pull_request":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063"}}},"pull_request":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063","id":42510000,"html_url":"https://github.com/adobe-photoshop/spaces-design/pull/2063","diff_url":"https://github.com/adobe-photoshop/spaces-design/pull/2063.diff","patch_url":"https://github.com/adobe-photoshop/spaces-design/pull/2063.patch","issue_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2063","number":2063,"state":"open","locked":false,"title":"Added new functionality to the Menu bar - Create Art From Template","user":{"login":"DivyaPrabhakar","id":3968848,"avatar_url":"https://avatars.githubusercontent.com/u/3968848?v=3","gravatar_id":"","url":"https://api.github.com/users/DivyaPrabhakar","html_url":"https://github.com/DivyaPrabhakar","followers_url":"https://api.github.com/users/DivyaPrabhakar/followers","following_url":"https://api.github.com/users/DivyaPrabhakar/following{/other_user}","gists_url":"https://api.github.com/users/DivyaPrabhakar/gists{/gist_id}","starred_url":"https://api.github.com/users/DivyaPrabhakar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DivyaPrabhakar/subscriptions","organizations_url":"https://api.github.com/users/DivyaPrabhakar/orgs","repos_url":"https://api.github.com/users/DivyaPrabhakar/repos","events_url":"https://api.github.com/users/DivyaPrabhakar/events{/privacy}","received_events_url":"https://api.github.com/users/DivyaPrabhakar/received_events","type":"User","site_admin":false},"body":"createArtboard can now handle inputs of type Bounds, payload, and undefined; if artboard selected, uses that as default size if no preset or Bounds have been passed in. Addresses issue #1905 ","created_at":"2015-08-15T00:41:46Z","updated_at":"2015-08-19T14:36:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"iwehrman","id":1075154,"avatar_url":"https://avatars.githubusercontent.com/u/1075154?v=3","gravatar_id":"","url":"https://api.github.com/users/iwehrman","html_url":"https://github.com/iwehrman","followers_url":"https://api.github.com/users/iwehrman/followers","following_url":"https://api.github.com/users/iwehrman/following{/other_user}","gists_url":"https://api.github.com/users/iwehrman/gists{/gist_id}","starred_url":"https://api.github.com/users/iwehrman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwehrman/subscriptions","organizations_url":"https://api.github.com/users/iwehrman/orgs","repos_url":"https://api.github.com/users/iwehrman/repos","events_url":"https://api.github.com/users/iwehrman/events{/privacy}","received_events_url":"https://api.github.com/users/iwehrman/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063/commits","review_comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063/comments","review_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2063/comments","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/5dd2ad0ac469f1ecb1e2e1f87227cc656f3aaf41","head":{"label":"adobe-photoshop:divyaprabhakar/1905","ref":"divyaprabhakar/1905","sha":"5dd2ad0ac469f1ecb1e2e1f87227cc656f3aaf41","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-08-18T06:36:14Z","pushed_at":"2015-08-19T13:53:59Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":17368,"stargazers_count":597,"watchers_count":597,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":216,"forks":42,"open_issues":216,"watchers":597,"default_branch":"master"}},"base":{"label":"adobe-photoshop:master","ref":"master","sha":"67178be7adb413d7f91fd1d85e05c077eff5e087","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-08-18T06:36:14Z","pushed_at":"2015-08-19T13:53:59Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":17368,"stargazers_count":597,"watchers_count":597,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":216,"forks":42,"open_issues":216,"watchers":597,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/2063"},"issue":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2063"},"comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2063/comments"},"review_comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063/comments"},"review_comment":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2063/commits"},"statuses":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/5dd2ad0ac469f1ecb1e2e1f87227cc656f3aaf41"}}}}