Commit dd5917c6 by Usman Khalid

Merge pull request #11035 from edx/usman/bookmarks-layout-issues

Layout fixes required due to styling changes.
parents 0b9da334 839b9484
...@@ -213,7 +213,7 @@ class BookmarksTest(BookmarksTestMixin): ...@@ -213,7 +213,7 @@ class BookmarksTest(BookmarksTestMixin):
""" """
self.bookmarks_page.click_bookmarks_button() self.bookmarks_page.click_bookmarks_button()
self.assertTrue(self.bookmarks_page.results_present()) self.assertTrue(self.bookmarks_page.results_present())
self.assertEqual(self.bookmarks_page.results_header_text(), 'MY BOOKMARKS') self.assertEqual(self.bookmarks_page.results_header_text(), 'My Bookmarks')
def _verify_breadcrumbs(self, num_units, modified_name=None): def _verify_breadcrumbs(self, num_units, modified_name=None):
""" """
...@@ -285,7 +285,7 @@ class BookmarksTest(BookmarksTestMixin): ...@@ -285,7 +285,7 @@ class BookmarksTest(BookmarksTestMixin):
self._test_setup() self._test_setup()
self.assertTrue(self.bookmarks_page.bookmarks_button_visible()) self.assertTrue(self.bookmarks_page.bookmarks_button_visible())
self.bookmarks_page.click_bookmarks_button() self.bookmarks_page.click_bookmarks_button()
self.assertEqual(self.bookmarks_page.results_header_text(), 'MY BOOKMARKS') self.assertEqual(self.bookmarks_page.results_header_text(), 'My Bookmarks')
self.assertEqual(self.bookmarks_page.empty_header_text(), 'You have not bookmarked any courseware pages yet.') self.assertEqual(self.bookmarks_page.empty_header_text(), 'You have not bookmarked any courseware pages yet.')
empty_list_text = ("Use bookmarks to help you easily return to courseware pages. To bookmark a page, " empty_list_text = ("Use bookmarks to help you easily return to courseware pages. To bookmark a page, "
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
el: '.courseware-results', el: '.courseware-results',
coursewareContentEl: '#course-content', coursewareContentEl: '#course-content',
coursewareResultsWrapperEl: '.courseware-results-wrapper',
errorIcon: '<i class="fa fa-fw fa-exclamation-triangle message-error" aria-hidden="true"></i>', errorIcon: '<i class="fa fa-fw fa-exclamation-triangle message-error" aria-hidden="true"></i>',
loadingIcon: '<i class="fa fa-fw fa-spinner fa-pulse message-in-progress" aria-hidden="true"></i>', loadingIcon: '<i class="fa fa-fw fa-spinner fa-pulse message-in-progress" aria-hidden="true"></i>',
...@@ -97,8 +98,9 @@ ...@@ -97,8 +98,9 @@
}, },
hideBookmarks: function () { hideBookmarks: function () {
this.$el.hide(); this.$el.hide();
$(this.coursewareContentEl).show(); $(this.coursewareResultsWrapperEl).hide();
$(this.coursewareContentEl).css('display', 'table-cell');
}, },
showBookmarksContainer: function () { showBookmarksContainer: function () {
...@@ -106,6 +108,7 @@ ...@@ -106,6 +108,7 @@
// Empty el if it's not empty to get the clean state. // Empty el if it's not empty to get the clean state.
this.$el.html(''); this.$el.html('');
this.$el.show(); this.$el.show();
$(this.coursewareResultsWrapperEl).css('display', 'table-cell');
}, },
showLoadingMessage: function () { showLoadingMessage: function () {
......
...@@ -37,8 +37,7 @@ define([ ...@@ -37,8 +37,7 @@ define([
})); }));
this.renderItems(); this.renderItems();
this.$el.find(this.spinner).hide(); this.$el.find(this.spinner).hide();
this.$contentElement.hide(); this.showResults();
this.$el.show();
return this; return this;
}, },
...@@ -71,17 +70,20 @@ define([ ...@@ -71,17 +70,20 @@ define([
this.$contentElement.show(); this.$contentElement.show();
}, },
showResults: function() {
this.$el.show();
this.$contentElement.hide();
},
showLoadingMessage: function () { showLoadingMessage: function () {
this.doCleanup(); this.doCleanup();
this.$el.html(this.loadingTemplate()); this.$el.html(this.loadingTemplate());
this.$el.show(); this.showResults();
this.$contentElement.hide();
}, },
showErrorMessage: function () { showErrorMessage: function () {
this.$el.html(this.errorTemplate()); this.$el.html(this.errorTemplate());
this.$el.show(); this.showResults();
this.$contentElement.hide();
}, },
doCleanup: function () { doCleanup: function () {
......
...@@ -10,13 +10,25 @@ define([ ...@@ -10,13 +10,25 @@ define([
el: '.courseware-results', el: '.courseware-results',
contentElement: '#course-content', contentElement: '#course-content',
coursewareResultsWrapperElement: '.courseware-results-wrapper',
resultsTemplateId: '#course_search_results-tpl', resultsTemplateId: '#course_search_results-tpl',
loadingTemplateId: '#search_loading-tpl', loadingTemplateId: '#search_loading-tpl',
errorTemplateId: '#search_error-tpl', errorTemplateId: '#search_error-tpl',
events: { events: {
'click .search-load-next': 'loadNext', 'click .search-load-next': 'loadNext',
}, },
SearchItemView: CourseSearchItemView SearchItemView: CourseSearchItemView,
clear: function () {
SearchResultsView.prototype.clear.call(this);
$(this.coursewareResultsWrapperElement).hide();
this.$contentElement.css('display', 'table-cell');
},
showResults: function () {
SearchResultsView.prototype.showResults.call(this);
$(this.coursewareResultsWrapperElement).css('display', 'table-cell');
}
}); });
......
...@@ -414,7 +414,7 @@ define([ ...@@ -414,7 +414,7 @@ define([
function returnsToContent () { function returnsToContent () {
this.resultsView.clear(); this.resultsView.clear();
expect(this.resultsView.$contentElement).toBeVisible(); expect(this.resultsView.$contentElement).toHaveCss({'display': this.contentElementDisplayValue});
expect(this.resultsView.$el).toBeHidden(); expect(this.resultsView.$el).toBeHidden();
expect(this.resultsView.$el).toBeEmpty(); expect(this.resultsView.$el).toBeEmpty();
} }
...@@ -518,6 +518,7 @@ define([ ...@@ -518,6 +518,7 @@ define([
describe('CourseSearchResultsView', function () { describe('CourseSearchResultsView', function () {
beforeEach(function() { beforeEach(function() {
beforeEachHelper.call(this, CourseSearchResultsView); beforeEachHelper.call(this, CourseSearchResultsView);
this.contentElementDisplayValue = 'table-cell';
}); });
it('shows loading message', showsLoadingMessage); it('shows loading message', showsLoadingMessage);
it('shows error message', showsErrorMessage); it('shows error message', showsErrorMessage);
...@@ -532,6 +533,7 @@ define([ ...@@ -532,6 +533,7 @@ define([
describe('DashSearchResultsView', function () { describe('DashSearchResultsView', function () {
beforeEach(function() { beforeEach(function() {
beforeEachHelper.call(this, DashSearchResultsView); beforeEachHelper.call(this, DashSearchResultsView);
this.contentElementDisplayValue = 'block';
}); });
it('shows loading message', showsLoadingMessage); it('shows loading message', showsLoadingMessage);
it('shows error message', showsErrorMessage); it('shows error message', showsErrorMessage);
...@@ -613,13 +615,13 @@ define([ ...@@ -613,13 +615,13 @@ define([
$('.cancel-button').trigger('click'); $('.cancel-button').trigger('click');
AjaxHelpers.skipResetRequest(requests); AjaxHelpers.skipResetRequest(requests);
// there should be no results // there should be no results
expect(this.$contentElement).toBeVisible(); expect(this.$contentElement).toHaveCss({'display': this.contentElementDisplayValue});
expect(this.$searchResults).toBeHidden(); expect(this.$searchResults).toBeHidden();
} }
function clearsResults () { function clearsResults () {
$('.cancel-button').trigger('click'); $('.cancel-button').trigger('click');
expect(this.$contentElement).toBeVisible(); expect(this.$contentElement).toHaveCss({'display': this.contentElementDisplayValue});
expect(this.$searchResults).toBeHidden(); expect(this.$searchResults).toBeHidden();
} }
...@@ -682,6 +684,7 @@ define([ ...@@ -682,6 +684,7 @@ define([
CourseSearchFactory(courseId); CourseSearchFactory(courseId);
spyOn(Backbone.history, 'navigate'); spyOn(Backbone.history, 'navigate');
this.$contentElement = $('#course-content'); this.$contentElement = $('#course-content');
this.contentElementDisplayValue = 'table-cell';
this.$searchResults = $('.courseware-results'); this.$searchResults = $('.courseware-results');
}); });
...@@ -709,6 +712,7 @@ define([ ...@@ -709,6 +712,7 @@ define([
spyOn(Backbone.history, 'navigate'); spyOn(Backbone.history, 'navigate');
this.$contentElement = $('#my-courses'); this.$contentElement = $('#my-courses');
this.contentElementDisplayValue = 'block';
this.$searchResults = $('#dashboard-search-results'); this.$searchResults = $('#dashboard-search-results');
}); });
......
...@@ -100,6 +100,10 @@ html.video-fullscreen { ...@@ -100,6 +100,10 @@ html.video-fullscreen {
.course-wrapper { .course-wrapper {
position: relative; position: relative;
.courseware-results-wrapper {
display: none;
}
.course-content, .course-content,
.courseware-results-wrapper { .courseware-results-wrapper {
@extend .content; @extend .content;
......
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