{"action":"created","comment":{"url":"https://api.github.com/repos/bluebox/godavari/pulls/comments/37774180","id":37774180,"diff_hunk":"@@ -0,0 +1,157 @@\n+define([\n+    \"./Errors\",\n+    \"./Joint\",\n+    \"./Finishing\",\n+    \"./Plank\",\n+    \"../lib/underscore.string.min\"\n+    ],function (Errors,Joint,Finishing,Plank,String) {\n+    \"use strict\";\n+\n+    var Panel = function (cabinetConfig, currentPanelType, previousPanelType, nextPanelType, isVertical) {\n+        this.planks = [];\n+        this.cabinetConfig = cabinetConfig;\n+        this.currentPanelType = currentPanelType;\n+        this.previousPanelType = previousPanelType;\n+        this.nextPanelType = nextPanelType;\n+\n+        this.currentPanelConfig = this.getPanelConfig(this.currentPanelType);\n+        this.previousPanelConfig = this.getPanelConfig(this.previousPanelType);\n+        this.nextPanelConfig = this.getPanelConfig(this.nextPanelType);\n+\n+        this.previousJointConfig = this.getJointConfig(this.currentPanelType,this.previousPanelType);\n+        this.nextJointConfig = this.getJointConfig(this.currentPanelType,this.nextPanelType);\n+\n+        this.isVertical = isVertical;\n+\n+        this.construct();\n+        this.transform();\n+        this.applyFinishing();\n+    };\n+\n+    Panel.prototype.getPanelConfig = function (panelType) {\n+        return this.cabinetConfig['panels'][panelType];\n+    };\n+\n+    Panel.prototype.getJointConfigByKey = function (jointKey) {\n+        return this.cabinetConfig['joints'][jointKey];\n+    };\n+\n+    Panel.prototype.getJointConfig = function (intersectingPanelType1,intersectingPanelType2) {\n+        if(intersectingPanelType1=='back'||intersectingPanelType2=='back')\n+            return this.getJointConfigByKey('back');\n+        var jointKey = String.decapitalize(intersectingPanelType1)+String.capitalize(intersectingPanelType2,true);\n+        var jointConfig = this.getJointConfigByKey(jointKey);\n+        if(jointConfig)\n+            return jointConfig;\n+        jointKey = String.decapitalize(intersectingPanelType2)+String.capitalize(intersectingPanelType1,true);\n+        var jointConfig = this.getJointConfigByKey(jointKey);\n+        if(jointConfig)\n+            return jointConfig;\n+        else\n+            throw new Errors.InvalidArgumentsError(\"No joint available with the provided intersecting panel\");\n+    };\n+\n+    Panel.prototype.getFullLength = function () {\n+        throw new Errors.NotImplementedError(\"Full length should be defined by the inheriting class\");\n+    };\n+    \n+    Panel.prototype.construct = function () {\n+        var decreaseInLengthDueToPreviousPanel = 0, decreaseInLengthDueToNextPanel = 0;\n+\n+        if (this.doesJointRequiresReductionInLength(this.previousJointConfig)) {\n+            decreaseInLengthDueToPreviousPanel = this.previousPanelConfig.thickness;\n+        }\n+\n+        if (this.doesJointRequiresReductionInLength(this.nextJointConfig)) {\n+            decreaseInLengthDueToNextPanel = this.nextPanelConfig.thickness;\n+        }\n+\n+        this.planks = [];\n+        var length =  this.getFullLength() - decreaseInLengthDueToPreviousPanel - decreaseInLengthDueToNextPanel;\n+        var thickness = this.currentPanelConfig.thickness;\n+        var width;\n+\n+        if (this.currentPanelConfig.isStretchered) {\n+            width = this.currentPanelConfig.stretcherWidth;\n+            var currentStretcher;\n+\n+            for (currentStretcher = 0; currentStretcher < this.currentPanelConfig.noOfStretchers; currentStretcher++) {\n+                this.planks.push(new Plank(length, width, thickness));\n+            }\n+        } else {\n+            width = this.cabinetConfig.dimensions.depth - this.currentPanelConfig.distanceFromFront - this.currentPanelConfig.distanceFromBack;\n+            this.planks.push(new Plank(length, width, thickness));\n+        }\n+    };\n+\n+\n+\n+    Panel.prototype.isPrimaryFaceInJoint = function (jointConfig) {\n+        return jointConfig.primaryFace === this.currentPanelType;\n+    };\n+\n+    Panel.prototype.doesJointRequiresReductionInLength = function (jointConfig) {\n+        return ((jointConfig.type === Joint.BUTT ||\n+            jointConfig.type === Joint.GROOVE) && (jointConfig.primaryFace !== this.currentPanelType))\n+    };","path":"cabinet-studio/js/cabinetstudio/Panel.js","position":96,"original_position":96,"commit_id":"bda2679903e930da001c0bfc5c62a688b1f3420f","original_commit_id":"bda2679903e930da001c0bfc5c62a688b1f3420f","user":{"login":"mithuntnt","id":699539,"avatar_url":"https://avatars.githubusercontent.com/u/699539?v=3","gravatar_id":"","url":"https://api.github.com/users/mithuntnt","html_url":"https://github.com/mithuntnt","followers_url":"https://api.github.com/users/mithuntnt/followers","following_url":"https://api.github.com/users/mithuntnt/following{/other_user}","gists_url":"https://api.github.com/users/mithuntnt/gists{/gist_id}","starred_url":"https://api.github.com/users/mithuntnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mithuntnt/subscriptions","organizations_url":"https://api.github.com/users/mithuntnt/orgs","repos_url":"https://api.github.com/users/mithuntnt/repos","events_url":"https://api.github.com/users/mithuntnt/events{/privacy}","received_events_url":"https://api.github.com/users/mithuntnt/received_events","type":"User","site_admin":false},"body":"Ideally not supported configuration should throw assert or not implemented.","created_at":"2015-08-24T17:00:34Z","updated_at":"2015-08-24T17:00:34Z","html_url":"https://github.com/bluebox/godavari/pull/71#discussion_r37774180","pull_request_url":"https://api.github.com/repos/bluebox/godavari/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/bluebox/godavari/pulls/comments/37774180"},"html":{"href":"https://github.com/bluebox/godavari/pull/71#discussion_r37774180"},"pull_request":{"href":"https://api.github.com/repos/bluebox/godavari/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/bluebox/godavari/pulls/71","id":43168037,"html_url":"https://github.com/bluebox/godavari/pull/71","diff_url":"https://github.com/bluebox/godavari/pull/71.diff","patch_url":"https://github.com/bluebox/godavari/pull/71.patch","issue_url":"https://api.github.com/repos/bluebox/godavari/issues/71","number":71,"state":"closed","locked":false,"title":"Cabinet studio core","user":{"login":"abhinavvarma","id":3599692,"avatar_url":"https://avatars.githubusercontent.com/u/3599692?v=3","gravatar_id":"","url":"https://api.github.com/users/abhinavvarma","html_url":"https://github.com/abhinavvarma","followers_url":"https://api.github.com/users/abhinavvarma/followers","following_url":"https://api.github.com/users/abhinavvarma/following{/other_user}","gists_url":"https://api.github.com/users/abhinavvarma/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavvarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavvarma/subscriptions","organizations_url":"https://api.github.com/users/abhinavvarma/orgs","repos_url":"https://api.github.com/users/abhinavvarma/repos","events_url":"https://api.github.com/users/abhinavvarma/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavvarma/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-24T12:15:47Z","updated_at":"2015-08-24T17:00:34Z","closed_at":"2015-08-24T12:15:52Z","merged_at":"2015-08-24T12:15:52Z","merge_commit_sha":"4236177a3b4770b772d8efa5190511fe96428256","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bluebox/godavari/pulls/71/commits","review_comments_url":"https://api.github.com/repos/bluebox/godavari/pulls/71/comments","review_comment_url":"https://api.github.com/repos/bluebox/godavari/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bluebox/godavari/issues/71/comments","statuses_url":"https://api.github.com/repos/bluebox/godavari/statuses/bda2679903e930da001c0bfc5c62a688b1f3420f","head":{"label":"bluebox:cabinet-studio-core","ref":"cabinet-studio-core","sha":"bda2679903e930da001c0bfc5c62a688b1f3420f","user":{"login":"bluebox","id":2654862,"avatar_url":"https://avatars.githubusercontent.com/u/2654862?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebox","html_url":"https://github.com/bluebox","followers_url":"https://api.github.com/users/bluebox/followers","following_url":"https://api.github.com/users/bluebox/following{/other_user}","gists_url":"https://api.github.com/users/bluebox/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebox/subscriptions","organizations_url":"https://api.github.com/users/bluebox/orgs","repos_url":"https://api.github.com/users/bluebox/repos","events_url":"https://api.github.com/users/bluebox/events{/privacy}","received_events_url":"https://api.github.com/users/bluebox/received_events","type":"Organization","site_admin":false},"repo":{"id":40375331,"name":"godavari","full_name":"bluebox/godavari","owner":{"login":"bluebox","id":2654862,"avatar_url":"https://avatars.githubusercontent.com/u/2654862?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebox","html_url":"https://github.com/bluebox","followers_url":"https://api.github.com/users/bluebox/followers","following_url":"https://api.github.com/users/bluebox/following{/other_user}","gists_url":"https://api.github.com/users/bluebox/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebox/subscriptions","organizations_url":"https://api.github.com/users/bluebox/orgs","repos_url":"https://api.github.com/users/bluebox/repos","events_url":"https://api.github.com/users/bluebox/events{/privacy}","received_events_url":"https://api.github.com/users/bluebox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bluebox/godavari","description":"Full house workflow automation","fork":false,"url":"https://api.github.com/repos/bluebox/godavari","forks_url":"https://api.github.com/repos/bluebox/godavari/forks","keys_url":"https://api.github.com/repos/bluebox/godavari/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluebox/godavari/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluebox/godavari/teams","hooks_url":"https://api.github.com/repos/bluebox/godavari/hooks","issue_events_url":"https://api.github.com/repos/bluebox/godavari/issues/events{/number}","events_url":"https://api.github.com/repos/bluebox/godavari/events","assignees_url":"https://api.github.com/repos/bluebox/godavari/assignees{/user}","branches_url":"https://api.github.com/repos/bluebox/godavari/branches{/branch}","tags_url":"https://api.github.com/repos/bluebox/godavari/tags","blobs_url":"https://api.github.com/repos/bluebox/godavari/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluebox/godavari/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluebox/godavari/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluebox/godavari/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluebox/godavari/statuses/{sha}","languages_url":"https://api.github.com/repos/bluebox/godavari/languages","stargazers_url":"https://api.github.com/repos/bluebox/godavari/stargazers","contributors_url":"https://api.github.com/repos/bluebox/godavari/contributors","subscribers_url":"https://api.github.com/repos/bluebox/godavari/subscribers","subscription_url":"https://api.github.com/repos/bluebox/godavari/subscription","commits_url":"https://api.github.com/repos/bluebox/godavari/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluebox/godavari/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluebox/godavari/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluebox/godavari/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluebox/godavari/contents/{+path}","compare_url":"https://api.github.com/repos/bluebox/godavari/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluebox/godavari/merges","archive_url":"https://api.github.com/repos/bluebox/godavari/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluebox/godavari/downloads","issues_url":"https://api.github.com/repos/bluebox/godavari/issues{/number}","pulls_url":"https://api.github.com/repos/bluebox/godavari/pulls{/number}","milestones_url":"https://api.github.com/repos/bluebox/godavari/milestones{/number}","notifications_url":"https://api.github.com/repos/bluebox/godavari/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluebox/godavari/labels{/name}","releases_url":"https://api.github.com/repos/bluebox/godavari/releases{/id}","created_at":"2015-08-07T18:37:22Z","updated_at":"2015-08-16T19:36:19Z","pushed_at":"2015-08-24T14:40:35Z","git_url":"git://github.com/bluebox/godavari.git","ssh_url":"git@github.com:bluebox/godavari.git","clone_url":"https://github.com/bluebox/godavari.git","svn_url":"https://github.com/bluebox/godavari","homepage":null,"size":1697,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"bluebox:cabinet-studio","ref":"cabinet-studio","sha":"139edfbe961e1322012f8d0ea5bdf2ae4d5be016","user":{"login":"bluebox","id":2654862,"avatar_url":"https://avatars.githubusercontent.com/u/2654862?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebox","html_url":"https://github.com/bluebox","followers_url":"https://api.github.com/users/bluebox/followers","following_url":"https://api.github.com/users/bluebox/following{/other_user}","gists_url":"https://api.github.com/users/bluebox/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebox/subscriptions","organizations_url":"https://api.github.com/users/bluebox/orgs","repos_url":"https://api.github.com/users/bluebox/repos","events_url":"https://api.github.com/users/bluebox/events{/privacy}","received_events_url":"https://api.github.com/users/bluebox/received_events","type":"Organization","site_admin":false},"repo":{"id":40375331,"name":"godavari","full_name":"bluebox/godavari","owner":{"login":"bluebox","id":2654862,"avatar_url":"https://avatars.githubusercontent.com/u/2654862?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebox","html_url":"https://github.com/bluebox","followers_url":"https://api.github.com/users/bluebox/followers","following_url":"https://api.github.com/users/bluebox/following{/other_user}","gists_url":"https://api.github.com/users/bluebox/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebox/subscriptions","organizations_url":"https://api.github.com/users/bluebox/orgs","repos_url":"https://api.github.com/users/bluebox/repos","events_url":"https://api.github.com/users/bluebox/events{/privacy}","received_events_url":"https://api.github.com/users/bluebox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bluebox/godavari","description":"Full house workflow automation","fork":false,"url":"https://api.github.com/repos/bluebox/godavari","forks_url":"https://api.github.com/repos/bluebox/godavari/forks","keys_url":"https://api.github.com/repos/bluebox/godavari/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluebox/godavari/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluebox/godavari/teams","hooks_url":"https://api.github.com/repos/bluebox/godavari/hooks","issue_events_url":"https://api.github.com/repos/bluebox/godavari/issues/events{/number}","events_url":"https://api.github.com/repos/bluebox/godavari/events","assignees_url":"https://api.github.com/repos/bluebox/godavari/assignees{/user}","branches_url":"https://api.github.com/repos/bluebox/godavari/branches{/branch}","tags_url":"https://api.github.com/repos/bluebox/godavari/tags","blobs_url":"https://api.github.com/repos/bluebox/godavari/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluebox/godavari/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluebox/godavari/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluebox/godavari/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluebox/godavari/statuses/{sha}","languages_url":"https://api.github.com/repos/bluebox/godavari/languages","stargazers_url":"https://api.github.com/repos/bluebox/godavari/stargazers","contributors_url":"https://api.github.com/repos/bluebox/godavari/contributors","subscribers_url":"https://api.github.com/repos/bluebox/godavari/subscribers","subscription_url":"https://api.github.com/repos/bluebox/godavari/subscription","commits_url":"https://api.github.com/repos/bluebox/godavari/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluebox/godavari/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluebox/godavari/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluebox/godavari/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluebox/godavari/contents/{+path}","compare_url":"https://api.github.com/repos/bluebox/godavari/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluebox/godavari/merges","archive_url":"https://api.github.com/repos/bluebox/godavari/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluebox/godavari/downloads","issues_url":"https://api.github.com/repos/bluebox/godavari/issues{/number}","pulls_url":"https://api.github.com/repos/bluebox/godavari/pulls{/number}","milestones_url":"https://api.github.com/repos/bluebox/godavari/milestones{/number}","notifications_url":"https://api.github.com/repos/bluebox/godavari/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluebox/godavari/labels{/name}","releases_url":"https://api.github.com/repos/bluebox/godavari/releases{/id}","created_at":"2015-08-07T18:37:22Z","updated_at":"2015-08-16T19:36:19Z","pushed_at":"2015-08-24T14:40:35Z","git_url":"git://github.com/bluebox/godavari.git","ssh_url":"git@github.com:bluebox/godavari.git","clone_url":"https://github.com/bluebox/godavari.git","svn_url":"https://github.com/bluebox/godavari","homepage":null,"size":1697,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bluebox/godavari/pulls/71"},"html":{"href":"https://github.com/bluebox/godavari/pull/71"},"issue":{"href":"https://api.github.com/repos/bluebox/godavari/issues/71"},"comments":{"href":"https://api.github.com/repos/bluebox/godavari/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/bluebox/godavari/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/bluebox/godavari/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bluebox/godavari/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/bluebox/godavari/statuses/bda2679903e930da001c0bfc5c62a688b1f3420f"}}}}