diff --git a/common/static/common/js/discussion/utils.js b/common/static/common/js/discussion/utils.js index 6e5e564c3e..de3507495f 100644 --- a/common/static/common/js/discussion/utils.js +++ b/common/static/common/js/discussion/utils.js @@ -95,9 +95,6 @@ retrieve_discussion: '/courses/' + $$course_id + '/discussion/forum/' + param + '/inline', retrieve_single_thread: '/courses/' + $$course_id + '/discussion/forum/' + param + '/threads/' + param1, openclose_thread: '/courses/' + $$course_id + '/discussion/threads/' + param + '/close', - permanent_link_thread: '/courses/' + $$course_id + '/discussion/forum/' + param + '/threads/' + param1, - permanent_link_comment: '/courses/' + $$course_id + - '/discussion/forum/' + param + '/threads/' + param1 + '#' + param2, user_profile: '/courses/' + $$course_id + '/discussion/forum/users/' + param, followed_threads: '/courses/' + $$course_id + '/discussion/forum/users/' + param + '/followed', threads: '/courses/' + $$course_id + '/discussion/forum', diff --git a/common/static/common/js/discussion/views/discussion_thread_list_view.js b/common/static/common/js/discussion/views/discussion_thread_list_view.js index 6199d776fe..7548f9ad70 100644 --- a/common/static/common/js/discussion/views/discussion_thread_list_view.js +++ b/common/static/common/js/discussion/views/discussion_thread_list_view.js @@ -136,7 +136,7 @@ 'css_class': searchAlert.attributes.css_class }); edx.HtmlUtils.append(self.$('.search-alerts'), content); - return self.$('#search-alert-' + searchAlert.cid + ' a.dismiss') + return self.$('#search-alert-' + searchAlert.cid + ' .dismiss') .bind('click', searchAlert, function(event) { return self.removeSearchAlert(event.data.cid); }); @@ -374,7 +374,8 @@ neverRead = !thread.get('read') && threadUnreadCommentCount === threadCommentCount, context = _.extend( { - neverRead: neverRead + neverRead: neverRead, + threadUrl: thread.urlFor('retrieve') }, thread.toJSON() ); diff --git a/common/static/common/js/discussion/views/discussion_topic_menu_view.js b/common/static/common/js/discussion/views/discussion_topic_menu_view.js index bebd6c7db7..bb1e88cbdb 100644 --- a/common/static/common/js/discussion/views/discussion_topic_menu_view.js +++ b/common/static/common/js/discussion/views/discussion_topic_menu_view.js @@ -42,11 +42,11 @@ this.selectedTopic = this.$('.js-selected-topic'); this.hideTopicDropdown(); if (this.getCurrentTopicId()) { - this.setTopic(this.$('a.topic-title').filter( + this.setTopic(this.$('.topic-title').filter( '[data-discussion-id="' + this.getCurrentTopicId() + '"]') ); } else { - this.setTopic(this.$('a.topic-title').first()); + this.setTopic(this.$('.topic-title').first()); } return this.$el; }, diff --git a/common/static/common/js/discussion/views/new_post_view.js b/common/static/common/js/discussion/views/new_post_view.js index 4bbadff0e0..6d2396870b 100644 --- a/common/static/common/js/discussion/views/new_post_view.js +++ b/common/static/common/js/discussion/views/new_post_view.js @@ -177,7 +177,7 @@ DiscussionUtil.clearFormErrors(this.$('.post-errors')); this.$('.wmd-preview p').html(''); if (this.isTabMode()) { - return this.topicView.setTopic(this.$('a.topic-title').first()); + return this.topicView.setTopic(this.$('.topic-title').first()); } }; diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js index e944985c9e..2467a4564f 100644 --- a/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js @@ -43,7 +43,7 @@ }; }); - view.$el.find('a.topic-title').filter(function(idx, el) { + view.$el.find('.topic-title').filter(function(idx, el) { return $(el).data('discussionId') === newTopicId; }).click(); // set new topic view.$('.edit-post-title').val('changed thread title'); // set new title diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js index 71fd7df95b..b13c9d6c23 100644 --- a/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js @@ -141,9 +141,9 @@ return this.thread.set('user_url', 'test_user_url'); }); checkUserLink = function(element, is_ta, is_staff) { - expect(element.find('a.username').length).toEqual(1); - expect(element.find('a.username').text()).toEqual('test_user'); - expect(element.find('a.username').attr('href')).toEqual('test_user_url'); + expect(element.find('.username').length).toEqual(1); + expect(element.find('.username').text()).toEqual('test_user'); + expect(element.find('.username').attr('href')).toEqual('test_user_url'); expect(element.find('.user-label-community-ta').length).toEqual(is_ta ? 1 : 0); return expect(element.find('.user-label-staff').length).toEqual(is_staff ? 1 : 0); }; @@ -168,7 +168,7 @@ var $el; this.thread.set('username', null); $el = $('#fixture-element').html(this.view.getAuthorDisplay()); - expect($el.find('a.username').length).toEqual(0); + expect($el.find('.username').length).toEqual(0); return expect($el.text()).toMatch(/^(\s*)anonymous(\s*)$/); }); }); diff --git a/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js index 1637d4dc3f..08684d9dfd 100644 --- a/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js @@ -98,7 +98,7 @@ var dropdownText; this.createTopicView(); this.view.maxNameWidth = this.defaultTextWidth + 1; - this.view.$el.find('a.topic-title').first().click(); + this.view.$el.find('.topic-menu-entry').first().click(); dropdownText = this.view.$el.find('.js-selected-topic').text(); expect(this.completeText).toEqual(dropdownText); }); @@ -106,11 +106,11 @@ it('truncation happens with specific title lengths', function() { var dropdownText; this.createTopicView(); - this.view.$el.find('a.topic-title')[2].click(); + this.view.$el.find('.topic-menu-entry')[2].click(); dropdownText = this.view.$el.find('.js-selected-topic').text(); expect(dropdownText).toEqual('…/Very long category name'); - this.view.$el.find('a.topic-title')[5].click(); + this.view.$el.find('.topic-menu-entry')[5].click(); dropdownText = this.view.$el.find('.js-selected-topic').text(); expect(dropdownText).toEqual('… / What Are Your Goals f …'); }); @@ -118,7 +118,7 @@ it('truncation happens with longer title lengths', function() { var dropdownText; this.createTopicView(); - this.view.$el.find('a.topic-title')[3].click(); + this.view.$el.find('.topic-menu-entry')[3].click(); dropdownText = this.view.$el.find('.js-selected-topic').text(); expect(dropdownText).toEqual('… / Very very very very l …'); }); @@ -126,7 +126,7 @@ it('titles are escaped before display', function() { var dropdownText; this.createTopicView(); - this.view.$el.find('a.topic-title')[4].click(); + this.view.$el.find('.topic-menu-entry')[4].click(); dropdownText = this.view.$el.find('.js-selected-topic').text(); expect(dropdownText).toContain('em>'); }); @@ -135,7 +135,7 @@ var dropdownText; this.createTopicView(); this.view.maxNameWidth = this.selectedOptionText.length + 100; - this.view.$el.find('a.topic-title').first().click(); + this.view.$el.find('.topic-title').first().click(); dropdownText = this.view.$el.find('.js-selected-topic').text(); expect(dropdownText.indexOf('/ span>')).toEqual(-1); }); diff --git a/common/static/common/js/spec/discussion/view/new_post_view_spec.js b/common/static/common/js/spec/discussion/view/new_post_view_spec.js index 4b6ad4e3ed..0582fbcc61 100644 --- a/common/static/common/js/spec/discussion/view/new_post_view_spec.js +++ b/common/static/common/js/spec/discussion/view/new_post_view_spec.js @@ -82,9 +82,9 @@ it('only enables the cohort selector when applicable', function() { DiscussionSpecHelper.makeModerator(); checkVisibility(this.view, true, false, true); - $('.topic-title:contains(General)').click(); + $('.topic-menu-entry:contains(General)').click(); checkVisibility(this.view, true, true, false); - $('.topic-title:contains(Topic)').click(); + $('.topic-menu-entry:contains(Topic)').click(); return checkVisibility(this.view, true, false, false); }); it('allows the user to make a cohort selection', function() { diff --git a/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js b/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js index f445aef452..a177a9ec9f 100644 --- a/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js +++ b/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js @@ -234,9 +234,9 @@ return spyOn(DiscussionUtil, 'urlFor').and.returnValue('test_endorser_url'); }); checkUserLink = function(element, is_ta, is_staff) { - expect(element.find('a.username').length).toEqual(1); - expect(element.find('a.username').text()).toEqual('test_endorser'); - expect(element.find('a.username').attr('href')).toEqual('test_endorser_url'); + expect(element.find('.username').length).toEqual(1); + expect(element.find('.username').text()).toEqual('test_endorser'); + expect(element.find('.username').attr('href')).toEqual('test_endorser_url'); expect(element.find('.user-label-community-ta').length).toEqual(is_ta ? 1 : 0); return expect(element.find('.user-label-staff').length).toEqual(is_staff ? 1 : 0); }; diff --git a/common/static/common/templates/discussion/alert-popup.underscore b/common/static/common/templates/discussion/alert-popup.underscore index f00bdc53a5..0442f5580b 100644 --- a/common/static/common/templates/discussion/alert-popup.underscore +++ b/common/static/common/templates/discussion/alert-popup.underscore @@ -1,6 +1,6 @@