Commit 4c4476a7 by Brian Jacobel

Fix lint issues on feature branch

parent a60d456f
/* globals Content, Discussion, DiscussionUtil */ /* globals _, Backbone, Content, Discussion, DiscussionUtil */
(function() { (function() {
'use strict'; 'use strict';
var __hasProp = {}.hasOwnProperty, var __hasProp = {}.hasOwnProperty,
...@@ -156,16 +156,13 @@ ...@@ -156,16 +156,13 @@
/** /**
* Creates search alert model and adds it to collection * Creates search alert model and adds it to collection
* @param message - alert message * @param message - alert message
* @param css_class - Allows setting custom css class for a message. This can be used to style messages * @param cssClass - Allows setting custom css class for a message. This can be used to style messages
* of different types differently (i.e. other background, completely hide, etc.) * of different types differently (i.e. other background, completely hide, etc.)
* @returns {Backbone.Model} * @returns {Backbone.Model}
*/ */
DiscussionThreadListView.prototype.addSearchAlert = function(message, css_class) { DiscussionThreadListView.prototype.addSearchAlert = function(message, cssClass) {
var m; var m;
if (typeof css_class === 'undefined' || css_class === null) { m = new Backbone.Model({message: message, css_class: cssClass || ''});
css_class = '';
}
m = new Backbone.Model({'message': message, 'css_class': css_class});
this.searchAlertCollection.add(m); this.searchAlertCollection.add(m);
return m; return m;
}; };
...@@ -179,16 +176,16 @@ ...@@ -179,16 +176,16 @@
}; };
DiscussionThreadListView.prototype.reloadDisplayedCollection = function(thread) { DiscussionThreadListView.prototype.reloadDisplayedCollection = function(thread) {
var active, $content, current_el, thread_id; var active, $content, $currentElement, threadId;
this.clearSearchAlerts(); this.clearSearchAlerts();
thread_id = thread.get('id'); threadId = thread.get('id');
$content = this.renderThread(thread); $content = this.renderThread(thread);
current_el = this.$('.forum-nav-thread[data-id=' + thread_id + ']'); $currentElement = this.$('.forum-nav-thread[data-id=' + threadId + ']');
active = current_el.has('.forum-nav-thread-link.is-active').length !== 0; active = $currentElement.has('.forum-nav-thread-link.is-active').length !== 0;
current_el.replaceWith($content); $currentElement.replaceWith($content);
this.showMetadataAccordingToSort(); this.showMetadataAccordingToSort();
if (active) { if (active) {
return this.setActiveThread(thread_id); return this.setActiveThread(threadId);
} }
}; };
...@@ -198,14 +195,14 @@ ...@@ -198,14 +195,14 @@
DiscussionThreadListView.prototype.addAndSelectThread = function(thread) { DiscussionThreadListView.prototype.addAndSelectThread = function(thread) {
var commentable_id, menuItem, var commentableId, menuItem,
self = this; self = this;
commentable_id = thread.get('commentable_id'); commentableId = thread.get('commentable_id');
menuItem = this.$('.forum-nav-browse-menu-item[data-discussion-id]').filter(function() { menuItem = this.$('.forum-nav-browse-menu-item[data-discussion-id]').filter(function() {
return $(this).data('discussion-id') === commentable_id; return $(this).data('discussion-id') === commentableId;
}); });
this.setCurrentTopicDisplay(this.getPathText(menuItem)); this.setCurrentTopicDisplay(this.getPathText(menuItem));
return this.retrieveDiscussion(commentable_id, function() { return this.retrieveDiscussion(commentableId, function() {
return self.trigger('thread:created', thread.get('id')); return self.trigger('thread:created', thread.get('id'));
}); });
}; };
...@@ -403,27 +400,28 @@ ...@@ -403,27 +400,28 @@
this.trigger('thread:removed', thread); this.trigger('thread:removed', thread);
}; };
DiscussionThreadListView.prototype.setActiveThread = function(thread_id) { DiscussionThreadListView.prototype.setActiveThread = function(threadId) {
var $srElem; var $srElem;
this.$('.forum-nav-thread-link').find('.sr').remove(); this.$('.forum-nav-thread-link').find('.sr').remove();
this.$(".forum-nav-thread[data-id!='" + thread_id + "'] .forum-nav-thread-link") this.$(".forum-nav-thread[data-id!='" + threadId + "'] .forum-nav-thread-link")
.removeClass('is-active'); .removeClass('is-active');
$srElem = edx.HtmlUtils.joinHtml( $srElem = edx.HtmlUtils.joinHtml(
edx.HtmlUtils.HTML('<span class="sr">'), edx.HtmlUtils.HTML('<span class="sr">'),
edx.HtmlUtils.ensureHtml(gettext('Current conversation')), edx.HtmlUtils.ensureHtml(gettext('Current conversation')),
edx.HtmlUtils.HTML('</span>') edx.HtmlUtils.HTML('</span>')
).toString(); ).toString();
this.$(".forum-nav-thread[data-id='" + thread_id + "'] .forum-nav-thread-link") this.$(".forum-nav-thread[data-id='" + threadId + "'] .forum-nav-thread-link")
.addClass('is-active').find('.forum-nav-thread-wrapper-1') .addClass('is-active').find('.forum-nav-thread-wrapper-1')
.prepend($srElem); .prepend($srElem);
}; };
DiscussionThreadListView.prototype.goHome = function() { DiscussionThreadListView.prototype.goHome = function() {
var url, $tpl_content; var url, $templateContent;
this.template = _.template($('#discussion-home-template').html()); this.template = _.template($('#discussion-home-template').html());
$tpl_content = $(this.template()); $templateContent = $(this.template());
$('.forum-content').empty().append($tpl_content); $('.forum-content').empty().append($templateContent);
$('.forum-nav-thread-list a').removeClass('is-active').find('.sr').remove(); $('.forum-nav-thread-list a').removeClass('is-active').find('.sr')
.remove();
$('input.email-setting').bind('click', this.updateEmailNotifications); $('input.email-setting').bind('click', this.updateEmailNotifications);
url = DiscussionUtil.urlFor('notifications_status', window.user.get('id')); url = DiscussionUtil.urlFor('notifications_status', window.user.get('id'));
DiscussionUtil.safeAjax({ DiscussionUtil.safeAjax({
...@@ -480,12 +478,19 @@ ...@@ -480,12 +478,19 @@
}; };
DiscussionThreadListView.prototype.getBreadcrumbText = function($item) { DiscussionThreadListView.prototype.getBreadcrumbText = function($item) {
var subTopic = $('.forum-nav-browse-title', $item).first().text().trim(), var $parentSubMenus = $item.parents('.forum-nav-browse-submenu'),
$parentSubMenus = $item.parents('.forum-nav-browse-submenu'), crumbs = [],
crumbs = []; subTopic = $('.forum-nav-browse-title', $item)
.first()
.text()
.trim();
$parentSubMenus.each(function(i, el) { $parentSubMenus.each(function(i, el) {
crumbs.push($(el).siblings('.forum-nav-browse-title').first().text().trim()); crumbs.push($(el).siblings('.forum-nav-browse-title')
.first()
.text()
.trim()
);
}); });
if (subTopic !== 'All Discussions') { if (subTopic !== 'All Discussions') {
...@@ -505,15 +510,15 @@ ...@@ -505,15 +510,15 @@
} else { } else {
items.hide(); items.hide();
return items.each(function(i, item) { return items.each(function(i, item) {
var path, pathText; var path, pathText,
item = $(item); $item = $(item);
if (!item.is(':visible')) { if (!$item.is(':visible')) {
pathText = self.getPathText(item).toLowerCase(); pathText = self.getPathText($item).toLowerCase();
if (query.split(' ').every(function(term) { if (query.split(' ').every(function(term) {
return pathText.search(term.toLowerCase()) !== -1; return pathText.search(term.toLowerCase()) !== -1;
})) { })) {
path = item.parents('.forum-nav-browse-menu-item').andSelf(); path = $item.parents('.forum-nav-browse-menu-item').andSelf();
return path.add(item.find('.forum-nav-browse-menu-item')).show(); return path.add($item.find('.forum-nav-browse-menu-item')).show();
} }
} }
}); });
...@@ -559,7 +564,7 @@ ...@@ -559,7 +564,7 @@
_results.push(x.replace(/^\s+|\s+$/g, '')); _results.push(x.replace(/^\s+|\s+$/g, ''));
} }
return _results; return _results;
})(); }());
prefix = ''; prefix = '';
while (path.length > 1) { while (path.length > 1) {
prefix = gettext('…') + '/'; prefix = gettext('…') + '/';
...@@ -619,9 +624,10 @@ ...@@ -619,9 +624,10 @@
return this.retrieveFirstPage(); return this.retrieveFirstPage();
}; };
DiscussionThreadListView.prototype.retrieveDiscussion = function(discussion_id, callback) { DiscussionThreadListView.prototype.retrieveDiscussion = function(discussionId, callback) {
var url, self = this; var url,
url = DiscussionUtil.urlFor('retrieve_discussion', discussion_id); self = this;
url = DiscussionUtil.urlFor('retrieve_discussion', discussionId);
return DiscussionUtil.safeAjax({ return DiscussionUtil.safeAjax({
url: url, url: url,
type: 'GET', type: 'GET',
...@@ -671,7 +677,7 @@ ...@@ -671,7 +677,7 @@
this.hideBrowseMenu(); this.hideBrowseMenu();
this.setCurrentTopicDisplay(gettext('Search Results')); this.setCurrentTopicDisplay(gettext('Search Results'));
text = this.$('.forum-nav-search-input').val(); text = this.$('.forum-nav-search-input').val();
return this.searchFor(text); this.searchFor(text);
} }
}; };
...@@ -730,10 +736,10 @@ ...@@ -730,10 +736,10 @@
message = edx.HtmlUtils.interpolateHtml( message = edx.HtmlUtils.interpolateHtml(
noResponseMsg, noResponseMsg,
{ {
'original_query': edx.HtmlUtils.joinHtml( original_query: edx.HtmlUtils.joinHtml(
edx.HtmlUtils.HTML('<em>'), text, edx.HtmlUtils.HTML('</em>') edx.HtmlUtils.HTML('<em>'), text, edx.HtmlUtils.HTML('</em>')
), ),
'suggested_query': edx.HtmlUtils.joinHtml( suggested_query: edx.HtmlUtils.joinHtml(
edx.HtmlUtils.HTML('<em>'), edx.HtmlUtils.HTML('<em>'),
response.corrected_text, response.corrected_text,
edx.HtmlUtils.HTML('</em>') edx.HtmlUtils.HTML('</em>')
......
/* globals /* globals
Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper, _, Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
DiscussionThreadListView, DiscussionUtil, Thread DiscussionThreadListView, DiscussionUtil, Thread
*/ */
(function() { (function() {
...@@ -156,22 +156,22 @@ ...@@ -156,22 +156,22 @@
return expect(this.view.$('.forum-nav-filter-main-control').val()).toEqual('all'); return expect(this.view.$('.forum-nav-filter-main-control').val()).toEqual('all');
}); });
checkThreadsOrdering = function(view, sort_order, type) { checkThreadsOrdering = function(view, sortOrder, type) {
expect(view.$el.find('.forum-nav-thread').children().length).toEqual(4); expect(view.$el.find('.forum-nav-thread').children().length).toEqual(4);
expect(view.$el.find('.forum-nav-thread:nth-child(1) .forum-nav-thread-title').text()) expect(view.$el.find('.forum-nav-thread:nth-child(1) .forum-nav-thread-title').text())
.toEqual(sort_order[0]); .toEqual(sortOrder[0]);
expect(view.$el.find('.forum-nav-thread:nth-child(2) .forum-nav-thread-title').text()) expect(view.$el.find('.forum-nav-thread:nth-child(2) .forum-nav-thread-title').text())
.toEqual(sort_order[1]); .toEqual(sortOrder[1]);
expect(view.$el.find('.forum-nav-thread:nth-child(3) .forum-nav-thread-title').text()) expect(view.$el.find('.forum-nav-thread:nth-child(3) .forum-nav-thread-title').text())
.toEqual(sort_order[2]); .toEqual(sortOrder[2]);
expect(view.$el.find('.forum-nav-thread:nth-child(4) .forum-nav-thread-title').text()) expect(view.$el.find('.forum-nav-thread:nth-child(4) .forum-nav-thread-title').text())
.toEqual(sort_order[3]); .toEqual(sortOrder[3]);
return expect(view.$el.find('.forum-nav-sort-control').val()).toEqual(type); return expect(view.$el.find('.forum-nav-sort-control').val()).toEqual(type);
}; };
describe('thread rendering should be correct', function() { describe('thread rendering should be correct', function() {
var checkRender; var checkRender;
checkRender = function(threads, type, sort_order) { checkRender = function(threads, type, sortOrder) {
var discussion, view; var discussion, view;
discussion = new Discussion(_.map(threads, function(thread) { discussion = new Discussion(_.map(threads, function(thread) {
return new Thread(thread); return new Thread(thread);
...@@ -181,56 +181,56 @@ ...@@ -181,56 +181,56 @@
}); });
view = makeView(discussion); view = makeView(discussion);
view.render(); view.render();
checkThreadsOrdering(view, sort_order, type); checkThreadsOrdering(view, sortOrder, type);
expect(view.$el.find('.forum-nav-thread-comments-count:visible').length) expect(view.$el.find('.forum-nav-thread-comments-count:visible').length)
.toEqual(type === 'votes' ? 0 : 4); .toEqual(type === 'votes' ? 0 : 4);
expect(view.$el.find('.forum-nav-thread-votes-count:visible').length) expect(view.$el.find('.forum-nav-thread-votes-count:visible').length)
.toEqual(type === 'votes' ? 4 : 0); .toEqual(type === 'votes' ? 4 : 0);
if (type === 'votes') { if (type === 'votes') {
return expect(_.map(view.$el.find('.forum-nav-thread-votes-count'), function(element) { expect(_.map(view.$el.find('.forum-nav-thread-votes-count'), function(element) {
return $(element).text().trim(); return $(element).text().trim();
})).toEqual(['+25 votes', '+20 votes', '+42 votes', '+12 votes']); })).toEqual(['+25 votes', '+20 votes', '+42 votes', '+12 votes']);
} }
}; };
it('with sort preference activity', function() { it('with sort preference activity', function() {
return checkRender(this.threads, 'activity', ['Thread1', 'Thread2', 'Thread3', 'Thread4']); checkRender(this.threads, 'activity', ['Thread1', 'Thread2', 'Thread3', 'Thread4']);
}); });
it('with sort preference votes', function() { it('with sort preference votes', function() {
return checkRender(this.threads, 'votes', ['Thread4', 'Thread1', 'Thread2', 'Thread3']); checkRender(this.threads, 'votes', ['Thread4', 'Thread1', 'Thread2', 'Thread3']);
}); });
it('with sort preference comments', function() { it('with sort preference comments', function() {
return checkRender(this.threads, 'comments', ['Thread1', 'Thread4', 'Thread3', 'Thread2']); checkRender(this.threads, 'comments', ['Thread1', 'Thread4', 'Thread3', 'Thread2']);
}); });
}); });
describe('Sort change should be correct', function() { describe('Sort change should be correct', function() {
var changeSorting; var changeSorting;
changeSorting = function(threads, selected_type, new_type, sort_order) { changeSorting = function(threads, selectedType, newType, sortOrder) {
var discussion, sortControl, sorted_threads, view; var discussion, sortControl, sortedThreads, view;
discussion = new Discussion(_.map(threads, function(thread) { discussion = new Discussion(_.map(threads, function(thread) {
return new Thread(thread); return new Thread(thread);
}), { }), {
pages: 1, pages: 1,
sort: selected_type sort: selectedType
}); });
view = makeView(discussion); view = makeView(discussion);
view.render(); view.render();
sortControl = view.$el.find('.forum-nav-sort-control'); sortControl = view.$el.find('.forum-nav-sort-control');
expect(sortControl.val()).toEqual(selected_type); expect(sortControl.val()).toEqual(selectedType);
sorted_threads = []; sortedThreads = [];
if (new_type === 'activity') { if (newType === 'activity') {
sorted_threads = [threads[0], threads[3], threads[1], threads[2]]; sortedThreads = [threads[0], threads[3], threads[1], threads[2]];
} else if (new_type === 'comments') { } else if (newType === 'comments') {
sorted_threads = [threads[0], threads[3], threads[2], threads[1]]; sortedThreads = [threads[0], threads[3], threads[2], threads[1]];
} else if (new_type === 'votes') { } else if (newType === 'votes') {
sorted_threads = [threads[3], threads[0], threads[1], threads[2]]; sortedThreads = [threads[3], threads[0], threads[1], threads[2]];
} }
$.ajax.and.callFake(function(params) { $.ajax.and.callFake(function(params) {
params.success({ params.success({
'discussion_data': sorted_threads, discussion_data: sortedThreads,
page: 1, page: 1,
num_pages: 1 num_pages: 1
}); });
...@@ -239,9 +239,9 @@ ...@@ -239,9 +239,9 @@
} }
}; };
}); });
sortControl.val(new_type).change(); sortControl.val(newType).change();
expect($.ajax).toHaveBeenCalled(); expect($.ajax).toHaveBeenCalled();
checkThreadsOrdering(view, sort_order, new_type); checkThreadsOrdering(view, sortOrder, newType);
}; };
it('with sort preference activity', function() { it('with sort preference activity', function() {
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
}); });
it('renders search alert with custom class', function() { it('renders search alert with custom class', function() {
var foo, messages; var messages;
testAlertMessages([]); testAlertMessages([]);
this.view.addSearchAlert('foo', 'custom-class'); this.view.addSearchAlert('foo', 'custom-class');
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
expect(messages[0].text).toEqual('foo'); expect(messages[0].text).toEqual('foo');
expect(messages[0].css_class).toEqual('search-alert custom-class'); expect(messages[0].css_class).toEqual('search-alert custom-class');
foo = this.view.addSearchAlert('bar', 'other-class'); this.view.addSearchAlert('bar', 'other-class');
messages = getAlertMessagesAndClasses(); messages = getAlertMessagesAndClasses();
expect(messages.length).toEqual(2); expect(messages.length).toEqual(2);
...@@ -572,11 +572,7 @@ ...@@ -572,11 +572,7 @@
}); });
describe('when shown', function() { describe('when shown', function() {
beforeEach(function() { it('should show again when header button is clicked', function() {
return $('.forum-nav-browse').click();
});
it('should hide when header button is clicked', function() {
$('.forum-nav-browse').click(); $('.forum-nav-browse').click();
return expectBrowseMenuVisible(false); return expectBrowseMenuVisible(false);
}); });
......
...@@ -22,18 +22,18 @@ ...@@ -22,18 +22,18 @@
DiscussionSpecHelper.getTestRoleInfo = function() { DiscussionSpecHelper.getTestRoleInfo = function() {
return { return {
'Moderator': [], Moderator: [],
'Administrator': [], Administrator: [],
'Community TA': [] 'Community TA': []
}; };
}; };
DiscussionSpecHelper.makeTA = function() { DiscussionSpecHelper.makeTA = function() {
return DiscussionUtil.roleIds['Community TA'].push(parseInt(DiscussionUtil.getUser().id)); return DiscussionUtil.roleIds['Community TA'].push(parseInt(DiscussionUtil.getUser().id, 10));
}; };
DiscussionSpecHelper.makeModerator = function() { DiscussionSpecHelper.makeModerator = function() {
return DiscussionUtil.roleIds.Moderator.push(parseInt(DiscussionUtil.getUser().id)); return DiscussionUtil.roleIds.Moderator.push(parseInt(DiscussionUtil.getUser().id, 10));
}; };
DiscussionSpecHelper.makeAjaxSpy = function(fakeAjax) { DiscussionSpecHelper.makeAjaxSpy = function(fakeAjax) {
...@@ -50,25 +50,22 @@ ...@@ -50,25 +50,22 @@
return jasmine.createSpyObj('event', ['preventDefault', 'target']); return jasmine.createSpyObj('event', ['preventDefault', 'target']);
}; };
DiscussionSpecHelper.makeCourseSettings = function(isCohorted) { DiscussionSpecHelper.makeCourseSettings = function() {
if (typeof isCohorted === 'undefined' || isCohorted === null) {
isCohorted = true;
}
return new DiscussionCourseSettings({ return new DiscussionCourseSettings({
category_map: { category_map: {
children: ['Test Topic', 'Other Topic'], children: ['Test Topic', 'Other Topic'],
entries: { entries: {
'Test Topic': { 'Test Topic': {
is_cohorted: isCohorted, is_cohorted: true,
id: 'test_topic' id: 'test_topic'
}, },
'Other Topic': { 'Other Topic': {
is_cohorted: isCohorted, is_cohorted: true,
id: 'other_topic' id: 'other_topic'
} }
} }
}, },
is_cohorted: isCohorted is_cohorted: true
}); });
}; };
...@@ -106,7 +103,7 @@ ...@@ -106,7 +103,7 @@
// suppressing Line is too long (4272 characters!) // suppressing Line is too long (4272 characters!)
/* jshint -W101 */ /* jshint -W101 */
appendSetFixtures( appendSetFixtures(
"<script type=\'text/template\' id=\'thread-list-template\'>\n <div class=\'forum-nav-header\'>\n <button type=\'button\' class=\'forum-nav-browse\' id=\'forum-nav-browse\' aria-haspopup=\'true\'>\n <span class=\'icon fa fa-bars\' aria-hidden=\'true\'></span>\n <span class=\'sr\'>Discussion topics; currently listing: </span>\n <span class=\'forum-nav-browse-current\'>All Discussions</span>\n ▾\n </button>\n <form class=\'forum-nav-search\'>\n <label>\n <span class=\'sr\'>Search all posts</span>\n <input class=\'forum-nav-search-input\' id=\'forum-nav-search\' type=\'text\' placeholder=\'Search all posts\'>\n <span class=\'icon fa fa-search\' aria-hidden=\'true\'></span>\n </label>\n </form>\n </div>\n <div class=\'forum-nav-browse-menu-wrapper\' style=\'display: none\'>\n <form class=\'forum-nav-browse-filter\'>\n <label>\n <span class=\'sr\'>Filter Topics</span>\n <input type=\'text\' class=\'forum-nav-browse-filter-input\' placeholder=\'filter topics\'>\n </label>\n </form>\n <ul class=\'forum-nav-browse-menu\'>\n <li class=\'forum-nav-browse-menu-item forum-nav-browse-menu-all\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'>All Discussions</a>\n </li>\n <li class=\'forum-nav-browse-menu-item forum-nav-browse-menu-following\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'><span class=\'icon fa fa-star\' aria-hidden=\'true\'></span>Posts I'm Following</a>\n </li>\n <li class=\'forum-nav-browse-menu-item\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'>Parent</a>\n <ul class=\'forum-nav-browse-submenu\'>\n <li class=\'forum-nav-browse-menu-item\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'>Target</a>\n <ul class=\'forum-nav-browse-submenu\'>\n <li\n class=\'forum-nav-browse-menu-item\'\n data-discussion-id=\'child\'\n data-cohorted=\'false\'\n >\n <a href=\'#\' class=\'forum-nav-browse-title\'>Child</a>\n </li>\n </ul>\n <li\n class=\'forum-nav-browse-menu-item\'\n data-discussion-id=\'sibling\'\n data-cohorted=\'false\'\n >\n <a href=\'#\' class=\'forum-nav-browse-title\'>Sibling</a>\n </li>\n </ul>\n </li>\n <li\n class=\'forum-nav-browse-menu-item\'\n data-discussion-id=\'other\'\n data-cohorted=\'true\'\n >\n <a href=\'#\' class=\'forum-nav-browse-title\'>Other Category</a>\n </li>\n </ul>\n </div>\n <div class=\'forum-nav-thread-list-wrapper\' id=\'sort-filter-wrapper\' tabindex=\'-1\'>\n <div class=\'forum-nav-refine-bar\'>\n <label class=\'forum-nav-filter-main\'>\n <select class=\'forum-nav-filter-main-control\'>\n <option value=\'all\'>Show all</option>\n <option value=\'unread\'>Unread</option>\n <option value=\'unanswered\'>Unanswered</option>\n <option value=\'flagged\'>Flagged</option>\n </select>\n </label>\n <% if (isCohorted && isPrivilegedUser) { %>\n <label class=\'forum-nav-filter-cohort\'>\n <span class=\'sr\'>Cohort:</span>\n <select class=\'forum-nav-filter-cohort-control\'>\n <option value=\'\'>in all cohorts</option>\n <option value=\'1\'>Cohort1</option>\n <option value=\'2\'>Cohort2</option>\n </select>\n </label>\n <% } %>\n <label class=\'forum-nav-sort\'>\n <select class=\'forum-nav-sort-control\'>\n <option value=\'activity\'>by recent activity</option>\n <option value=\'comments\'>by most activity</option>\n <option value=\'votes\'>by most votes</option>\n </select>\n </label>\n </div>\n </div>\n <div class=\'search-alerts\'></div>\n <ul class=\'forum-nav-thread-list\'></ul>\n</script>"); "<script type=\'text/template\' id=\'thread-list-template\'>\n <div class=\'forum-nav-header\'>\n <button type=\'button\' class=\'forum-nav-browse\' id=\'forum-nav-browse\' aria-haspopup=\'true\'>\n <span class=\'icon fa fa-bars\' aria-hidden=\'true\'></span>\n <span class=\'sr\'>Discussion topics; currently listing: </span>\n <span class=\'forum-nav-browse-current\'>All Discussions</span>\n ▾\n </button>\n <form class=\'forum-nav-search\'>\n <label>\n <span class=\'sr\'>Search all posts</span>\n <input class=\'forum-nav-search-input\' id=\'forum-nav-search\' type=\'text\' placeholder=\'Search all posts\'>\n <span class=\'icon fa fa-search\' aria-hidden=\'true\'></span>\n </label>\n </form>\n </div>\n <div class=\'forum-nav-browse-menu-wrapper\' style=\'display: none\'>\n <form class=\'forum-nav-browse-filter\'>\n <label>\n <span class=\'sr\'>Filter Topics</span>\n <input type=\'text\' class=\'forum-nav-browse-filter-input\' placeholder=\'filter topics\'>\n </label>\n </form>\n <ul class=\'forum-nav-browse-menu\'>\n <li class=\'forum-nav-browse-menu-item forum-nav-browse-menu-all\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'>All Discussions</a>\n </li>\n <li class=\'forum-nav-browse-menu-item forum-nav-browse-menu-following\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'><span class=\'icon fa fa-star\' aria-hidden=\'true\'></span>Posts I'm Following</a>\n </li>\n <li class=\'forum-nav-browse-menu-item\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'>Parent</a>\n <ul class=\'forum-nav-browse-submenu\'>\n <li class=\'forum-nav-browse-menu-item\'>\n <a href=\'#\' class=\'forum-nav-browse-title\'>Target</a>\n <ul class=\'forum-nav-browse-submenu\'>\n <li\n class=\'forum-nav-browse-menu-item\'\n data-discussion-id=\'child\'\n data-cohorted=\'false\'\n >\n <a href=\'#\' class=\'forum-nav-browse-title\'>Child</a>\n </li>\n </ul>\n <li\n class=\'forum-nav-browse-menu-item\'\n data-discussion-id=\'sibling\'\n data-cohorted=\'false\'\n >\n <a href=\'#\' class=\'forum-nav-browse-title\'>Sibling</a>\n </li>\n </ul>\n </li>\n <li\n class=\'forum-nav-browse-menu-item\'\n data-discussion-id=\'other\'\n data-cohorted=\'true\'\n >\n <a href=\'#\' class=\'forum-nav-browse-title\'>Other Category</a>\n </li>\n </ul>\n </div>\n <div class=\'forum-nav-thread-list-wrapper\' id=\'sort-filter-wrapper\' tabindex=\'-1\'>\n <div class=\'forum-nav-refine-bar\'>\n <label class=\'forum-nav-filter-main\'>\n <select class=\'forum-nav-filter-main-control\'>\n <option value=\'all\'>Show all</option>\n <option value=\'unread\'>Unread</option>\n <option value=\'unanswered\'>Unanswered</option>\n <option value=\'flagged\'>Flagged</option>\n </select>\n </label>\n <% if (isCohorted && isPrivilegedUser) { %>\n <label class=\'forum-nav-filter-cohort\'>\n <span class=\'sr\'>Cohort:</span>\n <select class=\'forum-nav-filter-cohort-control\'>\n <option value=\'\'>in all cohorts</option>\n <option value=\'1\'>Cohort1</option>\n <option value=\'2\'>Cohort2</option>\n </select>\n </label>\n <% } %>\n <label class=\'forum-nav-sort\'>\n <select class=\'forum-nav-sort-control\'>\n <option value=\'activity\'>by recent activity</option>\n <option value=\'comments\'>by most activity</option>\n <option value=\'votes\'>by most votes</option>\n </select>\n </label>\n </div>\n </div>\n <div class=\'search-alerts\'></div>\n <ul class=\'forum-nav-thread-list\'></ul>\n</script>"); // eslint-disable-line max-len, no-useless-escape
appendSetFixtures( appendSetFixtures(
'<div id=\'fixture-element\'></div>\n' + '<div id=\'fixture-element\'></div>\n' +
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
BreadcrumbsModel = Backbone.Model.extend({ BreadcrumbsModel = Backbone.Model.extend({
defaults: { defaults: {
contents: [], contents: []
} }
}); });
......
...@@ -11,14 +11,13 @@ ...@@ -11,14 +11,13 @@
numPages = options.numPages; numPages = options.numPages;
// Roles are not included in user profile page, but they are not used for anything // Roles are not included in user profile page, but they are not used for anything
window.DiscussionUtil.loadRoles({ window.DiscussionUtil.loadRoles({
'Moderator': [], Moderator: [],
'Administrator': [], Administrator: [],
'Community TA': [] 'Community TA': []
}); });
window.$$course_id = options.courseId; window.$$course_id = options.courseId;
window.user = new window.DiscussionUser(userInfo); window.user = new window.DiscussionUser(userInfo);
// jshint nonew:false new DiscussionUserProfileView({ // eslint-disable-line no-new
new DiscussionUserProfileView({
el: $element, el: $element,
collection: threads, collection: threads,
page: page, page: page,
......
...@@ -62,15 +62,7 @@ define( ...@@ -62,15 +62,7 @@ define(
}); });
describe('pagination rendering should be correct', function() { describe('pagination rendering should be correct', function() {
var baseUri, checkRender, pageInfo; var checkRender = function(params) {
baseUri = URI(window.location);
pageInfo = function(page) {
return {
url: baseUri.clone().addSearch('page', page).toString(),
number: page
};
};
checkRender = function(params) {
var getPageNumber, paginator, view; var getPageNumber, paginator, view;
view = makeView([], params.page, params.numPages); view = makeView([], params.page, params.numPages);
paginator = view.$('.discussion-paginator'); paginator = view.$('.discussion-paginator');
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
define([ define([
'backbone', 'backbone',
'edx-ui-toolkit/js/utils/html-utils', 'edx-ui-toolkit/js/utils/html-utils',
'text!discussion/templates/fake-breadcrumbs.underscore', 'text!discussion/templates/fake-breadcrumbs.underscore'
], ],
function(Backbone, HtmlUtils, breadcrumbsTemplate) { function(Backbone, HtmlUtils, breadcrumbsTemplate) {
var DiscussionFakeBreadcrumbs = Backbone.View.extend({ var DiscussionFakeBreadcrumbs = Backbone.View.extend({
......
...@@ -12,7 +12,7 @@ define(['jquery', 'logger', 'js/courseware/courseware_factory'], function($, Log ...@@ -12,7 +12,7 @@ define(['jquery', 'logger', 'js/courseware/courseware_factory'], function($, Log
$('.external-link').click(); $('.external-link').click();
expect(Logger.log).toHaveBeenCalledWith('edx.ui.lms.link_clicked', { expect(Logger.log).toHaveBeenCalledWith('edx.ui.lms.link_clicked', {
target_url: 'http://example.com/', target_url: 'http://example.com/',
current_url: 'http://' + window.location.host + '/context.html' current_url: window.location.toString()
}); });
}); });
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
paths: { paths: {
'gettext': 'xmodule_js/common_static/js/test/i18n', 'gettext': 'xmodule_js/common_static/js/test/i18n',
'codemirror': 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror', 'codemirror': 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror',
'jquery': 'common/js/vendor/jquery', jquery: 'common/js/vendor/jquery',
'jquery-migrate': 'common/js/vendor/jquery-migrate', 'jquery-migrate': 'common/js/vendor/jquery-migrate',
'jquery.ui': 'xmodule_js/common_static/js/vendor/jquery-ui.min', 'jquery.ui': 'xmodule_js/common_static/js/vendor/jquery-ui.min',
'jquery.eventDrag': 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2', 'jquery.eventDrag': 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment