Fix lint issues on feature branch
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* globals Content, Discussion, DiscussionUtil */
|
||||
/* globals _, Backbone, Content, Discussion, DiscussionUtil */
|
||||
(function() {
|
||||
'use strict';
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
@@ -156,16 +156,13 @@
|
||||
/**
|
||||
* Creates search alert model and adds it to collection
|
||||
* @param message - alert message
|
||||
* @param css_class - 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.)
|
||||
* @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.)
|
||||
* @returns {Backbone.Model}
|
||||
*/
|
||||
DiscussionThreadListView.prototype.addSearchAlert = function(message, css_class) {
|
||||
DiscussionThreadListView.prototype.addSearchAlert = function(message, cssClass) {
|
||||
var m;
|
||||
if (typeof css_class === 'undefined' || css_class === null) {
|
||||
css_class = '';
|
||||
}
|
||||
m = new Backbone.Model({'message': message, 'css_class': css_class});
|
||||
m = new Backbone.Model({message: message, css_class: cssClass || ''});
|
||||
this.searchAlertCollection.add(m);
|
||||
return m;
|
||||
};
|
||||
@@ -179,16 +176,16 @@
|
||||
};
|
||||
|
||||
DiscussionThreadListView.prototype.reloadDisplayedCollection = function(thread) {
|
||||
var active, $content, current_el, thread_id;
|
||||
var active, $content, $currentElement, threadId;
|
||||
this.clearSearchAlerts();
|
||||
thread_id = thread.get('id');
|
||||
threadId = thread.get('id');
|
||||
$content = this.renderThread(thread);
|
||||
current_el = this.$('.forum-nav-thread[data-id=' + thread_id + ']');
|
||||
active = current_el.has('.forum-nav-thread-link.is-active').length !== 0;
|
||||
current_el.replaceWith($content);
|
||||
$currentElement = this.$('.forum-nav-thread[data-id=' + threadId + ']');
|
||||
active = $currentElement.has('.forum-nav-thread-link.is-active').length !== 0;
|
||||
$currentElement.replaceWith($content);
|
||||
this.showMetadataAccordingToSort();
|
||||
if (active) {
|
||||
return this.setActiveThread(thread_id);
|
||||
return this.setActiveThread(threadId);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -198,14 +195,14 @@
|
||||
|
||||
|
||||
DiscussionThreadListView.prototype.addAndSelectThread = function(thread) {
|
||||
var commentable_id, menuItem,
|
||||
var commentableId, menuItem,
|
||||
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() {
|
||||
return $(this).data('discussion-id') === commentable_id;
|
||||
return $(this).data('discussion-id') === commentableId;
|
||||
});
|
||||
this.setCurrentTopicDisplay(this.getPathText(menuItem));
|
||||
return this.retrieveDiscussion(commentable_id, function() {
|
||||
return this.retrieveDiscussion(commentableId, function() {
|
||||
return self.trigger('thread:created', thread.get('id'));
|
||||
});
|
||||
};
|
||||
@@ -403,27 +400,28 @@
|
||||
this.trigger('thread:removed', thread);
|
||||
};
|
||||
|
||||
DiscussionThreadListView.prototype.setActiveThread = function(thread_id) {
|
||||
DiscussionThreadListView.prototype.setActiveThread = function(threadId) {
|
||||
var $srElem;
|
||||
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');
|
||||
$srElem = edx.HtmlUtils.joinHtml(
|
||||
edx.HtmlUtils.HTML('<span class="sr">'),
|
||||
edx.HtmlUtils.ensureHtml(gettext('Current conversation')),
|
||||
edx.HtmlUtils.HTML('</span>')
|
||||
).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')
|
||||
.prepend($srElem);
|
||||
};
|
||||
|
||||
DiscussionThreadListView.prototype.goHome = function() {
|
||||
var url, $tpl_content;
|
||||
var url, $templateContent;
|
||||
this.template = _.template($('#discussion-home-template').html());
|
||||
$tpl_content = $(this.template());
|
||||
$('.forum-content').empty().append($tpl_content);
|
||||
$('.forum-nav-thread-list a').removeClass('is-active').find('.sr').remove();
|
||||
$templateContent = $(this.template());
|
||||
$('.forum-content').empty().append($templateContent);
|
||||
$('.forum-nav-thread-list a').removeClass('is-active').find('.sr')
|
||||
.remove();
|
||||
$('input.email-setting').bind('click', this.updateEmailNotifications);
|
||||
url = DiscussionUtil.urlFor('notifications_status', window.user.get('id'));
|
||||
DiscussionUtil.safeAjax({
|
||||
@@ -480,12 +478,19 @@
|
||||
};
|
||||
|
||||
DiscussionThreadListView.prototype.getBreadcrumbText = function($item) {
|
||||
var subTopic = $('.forum-nav-browse-title', $item).first().text().trim(),
|
||||
$parentSubMenus = $item.parents('.forum-nav-browse-submenu'),
|
||||
crumbs = [];
|
||||
var $parentSubMenus = $item.parents('.forum-nav-browse-submenu'),
|
||||
crumbs = [],
|
||||
subTopic = $('.forum-nav-browse-title', $item)
|
||||
.first()
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
$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') {
|
||||
@@ -505,15 +510,15 @@
|
||||
} else {
|
||||
items.hide();
|
||||
return items.each(function(i, item) {
|
||||
var path, pathText;
|
||||
item = $(item);
|
||||
if (!item.is(':visible')) {
|
||||
pathText = self.getPathText(item).toLowerCase();
|
||||
var path, pathText,
|
||||
$item = $(item);
|
||||
if (!$item.is(':visible')) {
|
||||
pathText = self.getPathText($item).toLowerCase();
|
||||
if (query.split(' ').every(function(term) {
|
||||
return pathText.search(term.toLowerCase()) !== -1;
|
||||
})) {
|
||||
path = item.parents('.forum-nav-browse-menu-item').andSelf();
|
||||
return path.add(item.find('.forum-nav-browse-menu-item')).show();
|
||||
path = $item.parents('.forum-nav-browse-menu-item').andSelf();
|
||||
return path.add($item.find('.forum-nav-browse-menu-item')).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -559,7 +564,7 @@
|
||||
_results.push(x.replace(/^\s+|\s+$/g, ''));
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
}());
|
||||
prefix = '';
|
||||
while (path.length > 1) {
|
||||
prefix = gettext('…') + '/';
|
||||
@@ -619,9 +624,10 @@
|
||||
return this.retrieveFirstPage();
|
||||
};
|
||||
|
||||
DiscussionThreadListView.prototype.retrieveDiscussion = function(discussion_id, callback) {
|
||||
var url, self = this;
|
||||
url = DiscussionUtil.urlFor('retrieve_discussion', discussion_id);
|
||||
DiscussionThreadListView.prototype.retrieveDiscussion = function(discussionId, callback) {
|
||||
var url,
|
||||
self = this;
|
||||
url = DiscussionUtil.urlFor('retrieve_discussion', discussionId);
|
||||
return DiscussionUtil.safeAjax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
@@ -671,7 +677,7 @@
|
||||
this.hideBrowseMenu();
|
||||
this.setCurrentTopicDisplay(gettext('Search Results'));
|
||||
text = this.$('.forum-nav-search-input').val();
|
||||
return this.searchFor(text);
|
||||
this.searchFor(text);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -730,10 +736,10 @@
|
||||
message = edx.HtmlUtils.interpolateHtml(
|
||||
noResponseMsg,
|
||||
{
|
||||
'original_query': edx.HtmlUtils.joinHtml(
|
||||
original_query: edx.HtmlUtils.joinHtml(
|
||||
edx.HtmlUtils.HTML('<em>'), text, edx.HtmlUtils.HTML('</em>')
|
||||
),
|
||||
'suggested_query': edx.HtmlUtils.joinHtml(
|
||||
suggested_query: edx.HtmlUtils.joinHtml(
|
||||
edx.HtmlUtils.HTML('<em>'),
|
||||
response.corrected_text,
|
||||
edx.HtmlUtils.HTML('</em>')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* globals
|
||||
Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
|
||||
_, Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
|
||||
DiscussionThreadListView, DiscussionUtil, Thread
|
||||
*/
|
||||
(function() {
|
||||
@@ -156,22 +156,22 @@
|
||||
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: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())
|
||||
.toEqual(sort_order[1]);
|
||||
.toEqual(sortOrder[1]);
|
||||
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())
|
||||
.toEqual(sort_order[3]);
|
||||
.toEqual(sortOrder[3]);
|
||||
return expect(view.$el.find('.forum-nav-sort-control').val()).toEqual(type);
|
||||
};
|
||||
|
||||
describe('thread rendering should be correct', function() {
|
||||
var checkRender;
|
||||
checkRender = function(threads, type, sort_order) {
|
||||
checkRender = function(threads, type, sortOrder) {
|
||||
var discussion, view;
|
||||
discussion = new Discussion(_.map(threads, function(thread) {
|
||||
return new Thread(thread);
|
||||
@@ -181,56 +181,56 @@
|
||||
});
|
||||
view = makeView(discussion);
|
||||
view.render();
|
||||
checkThreadsOrdering(view, sort_order, type);
|
||||
checkThreadsOrdering(view, sortOrder, type);
|
||||
expect(view.$el.find('.forum-nav-thread-comments-count:visible').length)
|
||||
.toEqual(type === 'votes' ? 0 : 4);
|
||||
expect(view.$el.find('.forum-nav-thread-votes-count:visible').length)
|
||||
.toEqual(type === 'votes' ? 4 : 0);
|
||||
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();
|
||||
})).toEqual(['+25 votes', '+20 votes', '+42 votes', '+12 votes']);
|
||||
}
|
||||
};
|
||||
|
||||
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() {
|
||||
return checkRender(this.threads, 'votes', ['Thread4', 'Thread1', 'Thread2', 'Thread3']);
|
||||
checkRender(this.threads, 'votes', ['Thread4', 'Thread1', 'Thread2', 'Thread3']);
|
||||
});
|
||||
|
||||
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() {
|
||||
var changeSorting;
|
||||
changeSorting = function(threads, selected_type, new_type, sort_order) {
|
||||
var discussion, sortControl, sorted_threads, view;
|
||||
changeSorting = function(threads, selectedType, newType, sortOrder) {
|
||||
var discussion, sortControl, sortedThreads, view;
|
||||
discussion = new Discussion(_.map(threads, function(thread) {
|
||||
return new Thread(thread);
|
||||
}), {
|
||||
pages: 1,
|
||||
sort: selected_type
|
||||
sort: selectedType
|
||||
});
|
||||
view = makeView(discussion);
|
||||
view.render();
|
||||
sortControl = view.$el.find('.forum-nav-sort-control');
|
||||
expect(sortControl.val()).toEqual(selected_type);
|
||||
sorted_threads = [];
|
||||
if (new_type === 'activity') {
|
||||
sorted_threads = [threads[0], threads[3], threads[1], threads[2]];
|
||||
} else if (new_type === 'comments') {
|
||||
sorted_threads = [threads[0], threads[3], threads[2], threads[1]];
|
||||
} else if (new_type === 'votes') {
|
||||
sorted_threads = [threads[3], threads[0], threads[1], threads[2]];
|
||||
expect(sortControl.val()).toEqual(selectedType);
|
||||
sortedThreads = [];
|
||||
if (newType === 'activity') {
|
||||
sortedThreads = [threads[0], threads[3], threads[1], threads[2]];
|
||||
} else if (newType === 'comments') {
|
||||
sortedThreads = [threads[0], threads[3], threads[2], threads[1]];
|
||||
} else if (newType === 'votes') {
|
||||
sortedThreads = [threads[3], threads[0], threads[1], threads[2]];
|
||||
}
|
||||
$.ajax.and.callFake(function(params) {
|
||||
params.success({
|
||||
'discussion_data': sorted_threads,
|
||||
discussion_data: sortedThreads,
|
||||
page: 1,
|
||||
num_pages: 1
|
||||
});
|
||||
@@ -239,9 +239,9 @@
|
||||
}
|
||||
};
|
||||
});
|
||||
sortControl.val(new_type).change();
|
||||
sortControl.val(newType).change();
|
||||
expect($.ajax).toHaveBeenCalled();
|
||||
checkThreadsOrdering(view, sort_order, new_type);
|
||||
checkThreadsOrdering(view, sortOrder, newType);
|
||||
};
|
||||
|
||||
it('with sort preference activity', function() {
|
||||
@@ -290,7 +290,7 @@
|
||||
});
|
||||
|
||||
it('renders search alert with custom class', function() {
|
||||
var foo, messages;
|
||||
var messages;
|
||||
testAlertMessages([]);
|
||||
|
||||
this.view.addSearchAlert('foo', 'custom-class');
|
||||
@@ -299,7 +299,7 @@
|
||||
expect(messages[0].text).toEqual('foo');
|
||||
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();
|
||||
expect(messages.length).toEqual(2);
|
||||
@@ -572,11 +572,7 @@
|
||||
});
|
||||
|
||||
describe('when shown', function() {
|
||||
beforeEach(function() {
|
||||
return $('.forum-nav-browse').click();
|
||||
});
|
||||
|
||||
it('should hide when header button is clicked', function() {
|
||||
it('should show again when header button is clicked', function() {
|
||||
$('.forum-nav-browse').click();
|
||||
return expectBrowseMenuVisible(false);
|
||||
});
|
||||
|
||||
@@ -22,18 +22,18 @@
|
||||
|
||||
DiscussionSpecHelper.getTestRoleInfo = function() {
|
||||
return {
|
||||
'Moderator': [],
|
||||
'Administrator': [],
|
||||
Moderator: [],
|
||||
Administrator: [],
|
||||
'Community TA': []
|
||||
};
|
||||
};
|
||||
|
||||
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() {
|
||||
return DiscussionUtil.roleIds.Moderator.push(parseInt(DiscussionUtil.getUser().id));
|
||||
return DiscussionUtil.roleIds.Moderator.push(parseInt(DiscussionUtil.getUser().id, 10));
|
||||
};
|
||||
|
||||
DiscussionSpecHelper.makeAjaxSpy = function(fakeAjax) {
|
||||
@@ -50,25 +50,22 @@
|
||||
return jasmine.createSpyObj('event', ['preventDefault', 'target']);
|
||||
};
|
||||
|
||||
DiscussionSpecHelper.makeCourseSettings = function(isCohorted) {
|
||||
if (typeof isCohorted === 'undefined' || isCohorted === null) {
|
||||
isCohorted = true;
|
||||
}
|
||||
DiscussionSpecHelper.makeCourseSettings = function() {
|
||||
return new DiscussionCourseSettings({
|
||||
category_map: {
|
||||
children: ['Test Topic', 'Other Topic'],
|
||||
entries: {
|
||||
'Test Topic': {
|
||||
is_cohorted: isCohorted,
|
||||
is_cohorted: true,
|
||||
id: 'test_topic'
|
||||
},
|
||||
'Other Topic': {
|
||||
is_cohorted: isCohorted,
|
||||
is_cohorted: true,
|
||||
id: 'other_topic'
|
||||
}
|
||||
}
|
||||
},
|
||||
is_cohorted: isCohorted
|
||||
is_cohorted: true
|
||||
});
|
||||
};
|
||||
|
||||
@@ -106,7 +103,7 @@
|
||||
// suppressing Line is too long (4272 characters!)
|
||||
/* jshint -W101 */
|
||||
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(
|
||||
'<div id=\'fixture-element\'></div>\n' +
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
BreadcrumbsModel = Backbone.Model.extend({
|
||||
defaults: {
|
||||
contents: [],
|
||||
contents: []
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -11,14 +11,13 @@
|
||||
numPages = options.numPages;
|
||||
// Roles are not included in user profile page, but they are not used for anything
|
||||
window.DiscussionUtil.loadRoles({
|
||||
'Moderator': [],
|
||||
'Administrator': [],
|
||||
Moderator: [],
|
||||
Administrator: [],
|
||||
'Community TA': []
|
||||
});
|
||||
window.$$course_id = options.courseId;
|
||||
window.user = new window.DiscussionUser(userInfo);
|
||||
// jshint nonew:false
|
||||
new DiscussionUserProfileView({
|
||||
new DiscussionUserProfileView({ // eslint-disable-line no-new
|
||||
el: $element,
|
||||
collection: threads,
|
||||
page: page,
|
||||
|
||||
@@ -62,15 +62,7 @@ define(
|
||||
});
|
||||
|
||||
describe('pagination rendering should be correct', function() {
|
||||
var baseUri, checkRender, pageInfo;
|
||||
baseUri = URI(window.location);
|
||||
pageInfo = function(page) {
|
||||
return {
|
||||
url: baseUri.clone().addSearch('page', page).toString(),
|
||||
number: page
|
||||
};
|
||||
};
|
||||
checkRender = function(params) {
|
||||
var checkRender = function(params) {
|
||||
var getPageNumber, paginator, view;
|
||||
view = makeView([], params.page, params.numPages);
|
||||
paginator = view.$('.discussion-paginator');
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
define([
|
||||
'backbone',
|
||||
'edx-ui-toolkit/js/utils/html-utils',
|
||||
'text!discussion/templates/fake-breadcrumbs.underscore',
|
||||
'text!discussion/templates/fake-breadcrumbs.underscore'
|
||||
],
|
||||
function(Backbone, HtmlUtils, breadcrumbsTemplate) {
|
||||
var DiscussionFakeBreadcrumbs = Backbone.View.extend({
|
||||
|
||||
@@ -12,7 +12,7 @@ define(['jquery', 'logger', 'js/courseware/courseware_factory'], function($, Log
|
||||
$('.external-link').click();
|
||||
expect(Logger.log).toHaveBeenCalledWith('edx.ui.lms.link_clicked', {
|
||||
target_url: 'http://example.com/',
|
||||
current_url: 'http://' + window.location.host + '/context.html'
|
||||
current_url: window.location.toString()
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
paths: {
|
||||
'gettext': 'xmodule_js/common_static/js/test/i18n',
|
||||
'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.ui': 'xmodule_js/common_static/js/vendor/jquery-ui.min',
|
||||
'jquery.eventDrag': 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2',
|
||||
|
||||
Reference in New Issue
Block a user