{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments/26225050","id":26225050,"diff_hunk":"@@ -268,4 +280,52 @@ angular.module('encore.ui.rxForm', ['ngSanitize', 'encore.ui.rxMisc'])\n         }\n \n     };\n+})\n+/**\n+ * @ngdoc service\n+ * @name encore.ui.rxModalForm:rxFormUtils\n+ * @description\n+ * Set of utility functions used by rxForm to access form data\n+ *\n+ * @example\n+ * <pre>\n+ * // Returns an array of selected options in all tables with id tableId\n+ * // [{ tableId: 'tableId', fieldId: 'fieldId', rowId: 'rowId' }]\n+ * rxFormUtils.rxFormOptionTableSelected(tableId)\n+ * </pre>\n+ */\n+.service('rxFormUtils', function () {\n+\n+    var self = this;\n+\n+    // Returns the selected option for the rxFormOptionTables with id: tableId\n+    // and fieldId: fieldId (optional)\n+    // @param {String} tableId - The id of the table\n+    // @returns {object} The rowId of the selected option\n+    self.getSelectedOptionForTable = function (tableId) {\n+        var selectedRow;\n+        var row = document.querySelector('rx-form-option-table#' + tableId + ' .selected input');\n+        if (!_.isEmpty(row)) {\n+            selectedRow = { rowId: row.value };\n+        }\n+        return selectedRow;\n+    };\n+\n+    // Returns the selected option within the tabset\n+    // @param {String} tabsetId - The id of the tabset\n+    // @returns {object} The tableId, fieldId, and rowId of the selected option\n+    self.getSelectedOptionForTabSet = function (tabsetId) {\n+        var selectedOption;\n+        var xpathToTable = '//div[@id=\"' + tabsetId +\n+            '\"]//tr[contains(@class, \"selected\")]//ancestor::rx-form-option-table';\n+        var result = document.evaluate(xpathToTable, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);\n+        if (result.singleNodeValue) {\n+            var table = result.singleNodeValue;\n+            var fieldId = table.getAttribute('field-id');\n+            var rowId = self.getSelectedOptionForTable(table.id).rowId;\n+            selectedOption = { tableId: table.id, fieldId: fieldId, rowId: rowId };\n+        }\n+        return selectedOption;\n+    };\n+","path":"src/rxForm/rxForm.js","position":95,"original_position":95,"commit_id":"6fa63e2733b213da368eea324b5df63827d30409","original_commit_id":"6fa63e2733b213da368eea324b5df63827d30409","user":{"login":"parlarjb","id":9376,"avatar_url":"https://avatars.githubusercontent.com/u/9376?v=3","gravatar_id":"","url":"https://api.github.com/users/parlarjb","html_url":"https://github.com/parlarjb","followers_url":"https://api.github.com/users/parlarjb/followers","following_url":"https://api.github.com/users/parlarjb/following{/other_user}","gists_url":"https://api.github.com/users/parlarjb/gists{/gist_id}","starred_url":"https://api.github.com/users/parlarjb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parlarjb/subscriptions","organizations_url":"https://api.github.com/users/parlarjb/orgs","repos_url":"https://api.github.com/users/parlarjb/repos","events_url":"https://api.github.com/users/parlarjb/events{/privacy}","received_events_url":"https://api.github.com/users/parlarjb/received_events","type":"User","site_admin":false},"body":"Since we're already down the rabbit hole, my preferred way to do this is actually:\r\n\r\n```\r\n.factory('rxFormUtils', function() {\r\n    var rxFormUtils = {};\r\n    rxFormUtils.getSelectedOptionForTable = function() {\r\n        ...\r\n    };\r\n    rxFormUtils.getSelectedOptionForTabSet: function() {\r\n        ...\r\n    };\r\n\r\n    return rxFormUtils;\r\n});\r\n```\r\n\r\n(I originally saw this pattern in http://toddmotto.com/opinionated-angular-js-styleguide-for-teams/ and I agree with it)","created_at":"2015-03-11T15:54:50Z","updated_at":"2015-03-11T15:54:50Z","html_url":"https://github.com/rackerlabs/encore-ui/pull/836#discussion_r26225050","pull_request_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments/26225050"},"html":{"href":"https://github.com/rackerlabs/encore-ui/pull/836#discussion_r26225050"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836","id":30510169,"html_url":"https://github.com/rackerlabs/encore-ui/pull/836","diff_url":"https://github.com/rackerlabs/encore-ui/pull/836.diff","patch_url":"https://github.com/rackerlabs/encore-ui/pull/836.patch","issue_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/836","number":836,"state":"open","locked":false,"title":"feat(rxForm): Disable options","user":{"login":"rogerza","id":2261336,"avatar_url":"https://avatars.githubusercontent.com/u/2261336?v=3","gravatar_id":"","url":"https://api.github.com/users/rogerza","html_url":"https://github.com/rogerza","followers_url":"https://api.github.com/users/rogerza/followers","following_url":"https://api.github.com/users/rogerza/following{/other_user}","gists_url":"https://api.github.com/users/rogerza/gists{/gist_id}","starred_url":"https://api.github.com/users/rogerza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogerza/subscriptions","organizations_url":"https://api.github.com/users/rogerza/orgs","repos_url":"https://api.github.com/users/rogerza/repos","events_url":"https://api.github.com/users/rogerza/events{/privacy}","received_events_url":"https://api.github.com/users/rogerza/received_events","type":"User","site_admin":false},"body":"Add ability to disable options in rx-form-table-options","created_at":"2015-03-04T22:14:26Z","updated_at":"2015-03-11T15:54:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5df4fcf2539949f8e2f3871960565635f3e799a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/836/comments","statuses_url":"https://api.github.com/repos/rackerlabs/encore-ui/statuses/6fa63e2733b213da368eea324b5df63827d30409","head":{"label":"rogerza:rx-form-disable-options","ref":"rx-form-disable-options","sha":"6fa63e2733b213da368eea324b5df63827d30409","user":{"login":"rogerza","id":2261336,"avatar_url":"https://avatars.githubusercontent.com/u/2261336?v=3","gravatar_id":"","url":"https://api.github.com/users/rogerza","html_url":"https://github.com/rogerza","followers_url":"https://api.github.com/users/rogerza/followers","following_url":"https://api.github.com/users/rogerza/following{/other_user}","gists_url":"https://api.github.com/users/rogerza/gists{/gist_id}","starred_url":"https://api.github.com/users/rogerza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogerza/subscriptions","organizations_url":"https://api.github.com/users/rogerza/orgs","repos_url":"https://api.github.com/users/rogerza/repos","events_url":"https://api.github.com/users/rogerza/events{/privacy}","received_events_url":"https://api.github.com/users/rogerza/received_events","type":"User","site_admin":false},"repo":{"id":25133567,"name":"encore-ui","full_name":"rogerza/encore-ui","owner":{"login":"rogerza","id":2261336,"avatar_url":"https://avatars.githubusercontent.com/u/2261336?v=3","gravatar_id":"","url":"https://api.github.com/users/rogerza","html_url":"https://github.com/rogerza","followers_url":"https://api.github.com/users/rogerza/followers","following_url":"https://api.github.com/users/rogerza/following{/other_user}","gists_url":"https://api.github.com/users/rogerza/gists{/gist_id}","starred_url":"https://api.github.com/users/rogerza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogerza/subscriptions","organizations_url":"https://api.github.com/users/rogerza/orgs","repos_url":"https://api.github.com/users/rogerza/repos","events_url":"https://api.github.com/users/rogerza/events{/privacy}","received_events_url":"https://api.github.com/users/rogerza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rogerza/encore-ui","description":"UI Framework for Encore","fork":true,"url":"https://api.github.com/repos/rogerza/encore-ui","forks_url":"https://api.github.com/repos/rogerza/encore-ui/forks","keys_url":"https://api.github.com/repos/rogerza/encore-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rogerza/encore-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rogerza/encore-ui/teams","hooks_url":"https://api.github.com/repos/rogerza/encore-ui/hooks","issue_events_url":"https://api.github.com/repos/rogerza/encore-ui/issues/events{/number}","events_url":"https://api.github.com/repos/rogerza/encore-ui/events","assignees_url":"https://api.github.com/repos/rogerza/encore-ui/assignees{/user}","branches_url":"https://api.github.com/repos/rogerza/encore-ui/branches{/branch}","tags_url":"https://api.github.com/repos/rogerza/encore-ui/tags","blobs_url":"https://api.github.com/repos/rogerza/encore-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rogerza/encore-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rogerza/encore-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/rogerza/encore-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rogerza/encore-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/rogerza/encore-ui/languages","stargazers_url":"https://api.github.com/repos/rogerza/encore-ui/stargazers","contributors_url":"https://api.github.com/repos/rogerza/encore-ui/contributors","subscribers_url":"https://api.github.com/repos/rogerza/encore-ui/subscribers","subscription_url":"https://api.github.com/repos/rogerza/encore-ui/subscription","commits_url":"https://api.github.com/repos/rogerza/encore-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/rogerza/encore-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/rogerza/encore-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/rogerza/encore-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/rogerza/encore-ui/contents/{+path}","compare_url":"https://api.github.com/repos/rogerza/encore-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rogerza/encore-ui/merges","archive_url":"https://api.github.com/repos/rogerza/encore-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rogerza/encore-ui/downloads","issues_url":"https://api.github.com/repos/rogerza/encore-ui/issues{/number}","pulls_url":"https://api.github.com/repos/rogerza/encore-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/rogerza/encore-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/rogerza/encore-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rogerza/encore-ui/labels{/name}","releases_url":"https://api.github.com/repos/rogerza/encore-ui/releases{/id}","created_at":"2014-10-12T22:08:00Z","updated_at":"2015-03-04T21:57:42Z","pushed_at":"2015-03-11T15:08:47Z","git_url":"git://github.com/rogerza/encore-ui.git","ssh_url":"git@github.com:rogerza/encore-ui.git","clone_url":"https://github.com/rogerza/encore-ui.git","svn_url":"https://github.com/rogerza/encore-ui","homepage":"http://rackerlabs.github.io/encore-ui/","size":10885,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"586deea9ea823e2317f95f2f94fa25c2754213d3","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":11432401,"name":"encore-ui","full_name":"rackerlabs/encore-ui","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/encore-ui","description":"UI Framework for Encore","fork":false,"url":"https://api.github.com/repos/rackerlabs/encore-ui","forks_url":"https://api.github.com/repos/rackerlabs/encore-ui/forks","keys_url":"https://api.github.com/repos/rackerlabs/encore-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/encore-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/encore-ui/teams","hooks_url":"https://api.github.com/repos/rackerlabs/encore-ui/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/encore-ui/events","assignees_url":"https://api.github.com/repos/rackerlabs/encore-ui/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/encore-ui/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/encore-ui/tags","blobs_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/encore-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/encore-ui/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/encore-ui/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/encore-ui/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/encore-ui/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/encore-ui/subscription","commits_url":"https://api.github.com/repos/rackerlabs/encore-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/encore-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/encore-ui/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/encore-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/encore-ui/merges","archive_url":"https://api.github.com/repos/rackerlabs/encore-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/encore-ui/downloads","issues_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/encore-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/encore-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/encore-ui/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/encore-ui/releases{/id}","created_at":"2013-07-15T20:06:52Z","updated_at":"2015-03-03T19:35:59Z","pushed_at":"2015-03-06T21:41:15Z","git_url":"git://github.com/rackerlabs/encore-ui.git","ssh_url":"git@github.com:rackerlabs/encore-ui.git","clone_url":"https://github.com/rackerlabs/encore-ui.git","svn_url":"https://github.com/rackerlabs/encore-ui","homepage":"http://rackerlabs.github.io/encore-ui/","size":25669,"stargazers_count":24,"watchers_count":24,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":63,"forks":23,"open_issues":63,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836"},"html":{"href":"https://github.com/rackerlabs/encore-ui/pull/836"},"issue":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/issues/836"},"comments":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/issues/836/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/836/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/statuses/6fa63e2733b213da368eea324b5df63827d30409"}}}}