GitHub PullRequestReviewCommentEvent at 2014-09-19 08:07:28
Repository: edx-platform
Actor: jmclaus
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/17773260","id":17773260,"diff_hunk":"@@ -0,0 +1,203 @@\n+(function(Backbone) {\n+    'use strict';\n+    if (Backbone) {\n+        this.DiscussionTopicView = Backbone.View.extend({\n+            events: {\n+                'click .post-topic-button': 'toggleTopicDropdown',\n+                'click .topic-menu-wrapper': 'handleTopicEvent',\n+                'click .topic-filter-label': 'ignoreClick',\n+                'keyup .topic-filter-input': this.DiscussionFilter.filterDrop\n+            },\n+\n+            attributes: {\n+                'class': 'post-field'\n+            },\n+\n+            initialize: function(options) {\n+                this.course_settings = options.course_settings;\n+                this.topicId = options.topicId;\n+                this.mode = options.mode;\n+                this.maxNameWidth = 100;\n+                _.bindAll(this);\n+                return this;\n+            },\n+\n+            /**\n+             * Because we want the behavior that when the body is clicked the menu is\n+             * closed, we need to ignore clicks in the search field and stop propagation.\n+             * Without this, clicking the search field would also close the menu.\n+             */\n+            ignoreClick: function(event) {\n+                event.stopPropagation();\n+                return this;\n+            },\n+\n+            render: function() {\n+                var context = _.clone(this.course_settings.attributes);\n+\n+                if (this.isTabMode()) {\n+                    // set up the topic dropdown in tab mode\n+                    context.topics_html = this.renderCategoryMap(this.course_settings.get('category_map'));\n+                    this.$el.html(_.template($('#topic-template').html(), context));\n+                    this.dropdownButton = this.$('.post-topic-button');\n+                    this.topicMenu = this.$('.topic-menu-wrapper');\n+                    this.selectedTopic = this.$('.js-selected-topic');\n+                    this.hideTopicDropdown();\n+                    if (this.getTopicId()) {\n+                        this.setTopic(this.$('a.topic-title').filter('[data-discussion-id=' + this.getTopicId() + ']'));\n+                    } else {\n+                        this.setTopic(this.$('a.topic-title').first());\n+                    }\n+                }\n+                return this.$el;\n+            },\n+\n+            renderCategoryMap: function(map) {\n+                var category_template = _.template($('#new-post-menu-category-template').html()),\n+                    entry_template = _.template($('#new-post-menu-entry-template').html());\n+\n+                return _.map(map.children, function(name) {\n+                    var html = '', entry;\n+                    if (_.has(map.entries, name)) {\n+                        entry = map.entries[name];\n+                        html = entry_template({\n+                            text: name,\n+                            id: entry.id,\n+                            is_cohorted: entry.is_cohorted\n+                        });\n+                    } else { // subcategory\n+                        html = category_template({\n+                            text: name,\n+                            entries: this.renderCategoryMap(map.subcategories[name])\n+                        });\n+                    }\n+                    return html;\n+                }, this).join('');\n+            },\n+\n+            isTabMode: function() {\n+                return this.mode === 'tab';\n+            },\n+\n+            toggleTopicDropdown: function(event) {\n+                event.preventDefault();\n+                event.stopPropagation();\n+                if (this.menuOpen) {\n+                    this.hideTopicDropdown();\n+                } else {\n+                    this.showTopicDropdown();\n+                }\n+                return this;\n+            },\n+\n+            showTopicDropdown: function() {\n+                this.menuOpen = true;\n+                this.dropdownButton.addClass('dropped');\n+                this.topicMenu.show();\n+                $(document.body).on('click.topicMenu', this.hideTopicDropdown);\n+                // Set here because 1) the window might get resized and things could\n+                // change and 2) can't set in initialize because the button is hidden\n+                this.maxNameWidth = this.dropdownButton.width() - 40;\n+                return this;\n+            },\n+\n+            // Need a fat arrow because hideTopicDropdown is passed as a callback to bind\n+            hideTopicDropdown: function() {\n+                this.menuOpen = false;\n+                this.dropdownButton.removeClass('dropped');\n+                this.topicMenu.hide();\n+                $(document.body).off('click.topicMenu');\n+                return this;\n+            },\n+\n+            handleTopicEvent: function(event) {\n+                event.preventDefault();\n+                event.stopPropagation();\n+                this.setTopic($(event.target));\n+                return this;\n+            },\n+\n+            setTopic: function($target) {\n+                if ($target.data('discussion-id')) {\n+                    this.topicText = this.getFullTopicName($target);\n+                    this.topicId = $target.data('discussion-id');\n+                    this.setSelectedTopicName(this.topicText);\n+                    this.trigger('thread:topic_change', $target);\n+                    this.hideTopicDropdown();\n+                }\n+                return this;\n+            },\n+\n+            getTopicId: function() {\n+                return this.topicId;\n+            },\n+\n+            setSelectedTopicName: function(text) {\n+                return this.selectedTopic.html(this.fitName(text));\n+            },\n+            /**\n+             * Return full name for the `topicElement` if it is passed.\n+             * Otherwise, full name for the current topic will be returned.\n+             * @param {jQuery Element} [topicElement]\n+             * @return {String}\n+             */\n+            getFullTopicName: function(topicElement) {\n+                var name;\n+                if (topicElement) {\n+                    name = topicElement.html();\n+                    _.each(topicElement.parents('.topic-submenu'), function(item) {\n+                        name = $(item).siblings('.topic-title').text() + ' / ' + name;\n+                    });\n+                    return name;\n+                } else {\n+                    return this.topicText;\n+                }\n+            },\n+\n+            // @TODO move into utils.coffee","path":"common/static/coffee/src/discussion/views/discussion_topic_view.js","position":157,"original_position":157,"commit_id":"f97155798cf45a70b8b3149ecafb8a6778dd027a","original_commit_id":"f97155798cf45a70b8b3149ecafb8a6778dd027a","user":{"login":"jmclaus","id":1427382,"avatar_url":"https://avatars.githubusercontent.com/u/1427382?v=2","gravatar_id":"3d5a5b850789d1ed61841d46f54635bb","url":"https://api.github.com/users/jmclaus","html_url":"https://github.com/jmclaus","followers_url":"https://api.github.com/users/jmclaus/followers","following_url":"https://api.github.com/users/jmclaus/following{/other_user}","gists_url":"https://api.github.com/users/jmclaus/gists{/gist_id}","starred_url":"https://api.github.com/users/jmclaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmclaus/subscriptions","organizations_url":"https://api.github.com/users/jmclaus/orgs","repos_url":"https://api.github.com/users/jmclaus/repos","events_url":"https://api.github.com/users/jmclaus/events{/privacy}","received_events_url":"https://api.github.com/users/jmclaus/received_events","type":"User","site_admin":false},"body":"@polesye Please move into 'utils.coffee' as mentioned in the TODO.","created_at":"2014-09-19T08:07:28Z","updated_at":"2014-09-19T08:07:28Z","html_url":"https://github.com/edx/edx-platform/pull/5276#discussion_r17773260","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/5276","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/17773260"},"html":{"href":"https://github.com/edx/edx-platform/pull/5276#discussion_r17773260"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5276"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/5276","id":21418011,"html_url":"https://github.com/edx/edx-platform/pull/5276","diff_url":"https://github.com/edx/edx-platform/pull/5276.diff","patch_url":"https://github.com/edx/edx-platform/pull/5276.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/5276","number":5276,"state":"open","locked":false,"title":"Change the topic of a previously posted post.","user":{"login":"polesye","id":1247491,"avatar_url":"https://avatars.githubusercontent.com/u/1247491?v=2","gravatar_id":"d1c0cb415bb2b43f91a79ae310c8770a","url":"https://api.github.com/users/polesye","html_url":"https://github.com/polesye","followers_url":"https://api.github.com/users/polesye/followers","following_url":"https://api.github.com/users/polesye/following{/other_user}","gists_url":"https://api.github.com/users/polesye/gists{/gist_id}","starred_url":"https://api.github.com/users/polesye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polesye/subscriptions","organizations_url":"https://api.github.com/users/polesye/orgs","repos_url":"https://api.github.com/users/polesye/repos","events_url":"https://api.github.com/users/polesye/events{/privacy}","received_events_url":"https://api.github.com/users/polesye/received_events","type":"User","site_admin":false},"body":"Ticket: [TNL-171](https://openedx.atlassian.net/browse/TNL-171)\r\n\r\n**Acceptance criteria:**\r\nShare the Topic Area dropdown from the New Post view to the Edit view of a post.\r\n\r\n**sandbox:** http://polesye.m.sandbox.edx.org/\r\n\r\n@jimabramson , @jmclaus , @talbs , @explorerleslie please review.\r\n","created_at":"2014-09-18T08:17:36Z","updated_at":"2014-09-19T08:07:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"860365e3112dc0f7299aba8c3e0cc7051a132977","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/5276/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/5276/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/5276/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/f97155798cf45a70b8b3149ecafb8a6778dd027a","head":{"label":"edx:anton/forums-topic","ref":"anton/forums-topic","sha":"f97155798cf45a70b8b3149ecafb8a6778dd027a","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2014-09-18T10:57:23Z","pushed_at":"2014-09-19T08:04:20Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1620268,"stargazers_count":1424,"watchers_count":1424,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":815,"mirror_url":null,"open_issues_count":99,"forks":815,"open_issues":99,"watchers":1424,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"7f492aa04fe262adecb58cb6a806e4ea948790e3","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2014-09-18T10:57:23Z","pushed_at":"2014-09-19T08:04:20Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1620268,"stargazers_count":1424,"watchers_count":1424,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":815,"mirror_url":null,"open_issues_count":99,"forks":815,"open_issues":99,"watchers":1424,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5276"},"html":{"href":"https://github.com/edx/edx-platform/pull/5276"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/5276"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/5276/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5276/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5276/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/f97155798cf45a70b8b3149ecafb8a6778dd027a"}}}}