Commit 00d2d6d2 by tasawernawaz

Merge pull request #12153 from…

Merge pull request #12153 from edx/tasawer/story/ecom-3201-handle-empty-list-of-courses-and-programs-updated

Updated dashboard UI for empty list of courses and programs
parents 5bb0e908 ba6ba40e
...@@ -501,11 +501,11 @@ class DashboardTest(ModuleStoreTestCase): ...@@ -501,11 +501,11 @@ class DashboardTest(ModuleStoreTestCase):
self.client.login(username="jack", password="test") self.client.login(username="jack", password="test")
response = self.client.get(reverse("dashboard")) response = self.client.get(reverse("dashboard"))
# "Find courses" is shown in the side panel # "Explore courses" is shown in the side panel
self.assertContains(response, "Find courses") self.assertContains(response, "Explore courses")
# But other links are hidden in the navigation # But other links are hidden in the navigation
self.assertNotContains(response, "How it Works") self.assertNotContains(response, "How it works")
self.assertNotContains(response, "Schools & Partners") self.assertNotContains(response, "Schools & Partners")
def test_course_mode_info_with_honor_enrollment(self): def test_course_mode_info_with_honor_enrollment(self):
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
new CollectionListView({ new CollectionListView({
el: '.program-cards-container', el: '.program-cards-container',
childView: ProgramCardView, childView: ProgramCardView,
context: options,
collection: new ProgramCollection(options.programsData) collection: new ProgramCollection(options.programsData)
}).render(); }).render();
......
;(function (define) { ;(function (define) {
'use strict'; 'use strict';
define(['backbone'], define(['backbone',
function( 'jquery',
Backbone 'underscore',
) { 'gettext',
'text!../../../templates/learner_dashboard/empty_programs_list.underscore'
],
function (Backbone,
$,
_,
gettext,
emptyProgramsListTpl) {
return Backbone.View.extend({ return Backbone.View.extend({
initialize: function(data) { initialize: function(data) {
this.childView = data.childView; this.childView = data.childView;
this.context = data.context;
}, },
render: function() { render: function() {
var childList = []; var childList, tpl;
this.collection.each(function(program){
var child = new this.childView({model:program}); if (!this.collection.length) {
if (this.context.xseriesUrl) {
//Only show the xseries advertising panel if the link is passed in
tpl = _.template(emptyProgramsListTpl);
this.$el.html(tpl(this.context));
}
} else {
childList = [];
this.collection.each(function (program) {
var child = new this.childView({model: program});
childList.push(child.el); childList.push(child.el);
}, this); }, this);
this.$el.html(childList); this.$el.html(childList);
} }
}
}); });
} }
); );
......
...@@ -95,6 +95,7 @@ define([ ...@@ -95,6 +95,7 @@ define([
view = new CollectionListView({ view = new CollectionListView({
el: '.program-cards-container', el: '.program-cards-container',
childView: ProgramCardView, childView: ProgramCardView,
context: {'xseriesUrl': '/programs'},
collection: programCollection collection: programCollection
}); });
view.render(); view.render();
......
...@@ -212,61 +212,59 @@ ...@@ -212,61 +212,59 @@
} }
} }
// +Dashboard - Course Listing // CASE: empty dashboard
// ====================
.dashboard {
.my-courses {
@include float(left);
margin: 0;
width: flex-grid(9);
.wrapper-header-courses {
border-bottom: 4px solid $border-color-l4;
margin-bottom: $baseline;
.header-courses {
@extend %t-title5;
@include padding-right($baseline/2);
}
}
// CASE: empty dashboard
.empty-dashboard-message { .empty-dashboard-message {
border: 3px solid $gray-l4;
background: $gray-l6;
padding: ($baseline*2) 0; padding: ($baseline*2) 0;
text-align: center; text-align: center;
p { p {
@include font-size(24);
color: $lighter-base-font-color; color: $lighter-base-font-color;
font-style: italic;
margin-bottom: $baseline; margin-bottom: $baseline;
text-shadow: 0 1px rgba(255,255,255, 0.6); text-shadow: 0 1px rgba(255,255,255, 0.6);
} }
a { a {
background: rgb(240,240,240); background-color: $blue;
@include background-image($button-bg-image); border: 1px solid $blue;
background-color: $button-bg-color;
border: 1px solid $border-color-2;
border-radius: 4px;
box-shadow: 0 1px 8px 0 $shadow-l1; box-shadow: 0 1px 8px 0 $shadow-l1;
@include box-sizing(border-box); @include box-sizing(border-box);
color: $base-font-color; color: $white;
font-family: $sans-serif; font-family: $sans-serif;
display: inline-block; display: inline-block;
letter-spacing: 1px; letter-spacing: 1px;
@include margin-left($baseline/4); margin-top: ($baseline/4);
padding: 5px 10px; margin-left: ($baseline/4);
text-shadow: 0 1px rgba(255,255,255, 0.6); padding: 15px 20px;
&:hover, &:focus { &:hover, &:focus {
color: $link-color; background: $blue-l2;
text-decoration: none; text-decoration: none;
} }
} }
} }
// ==================== // +Dashboard - Course Listing
// ====================
.dashboard {
.my-courses {
@include float(left);
margin: 0;
width: flex-grid(9);
.wrapper-header-courses {
border-bottom: 4px solid $border-color-l4;
margin-bottom: $baseline;
.header-courses {
@extend %t-title5;
@include padding-right($baseline/2);
}
}
// UI: course list // UI: course list
.listing-courses { .listing-courses {
......
...@@ -86,3 +86,67 @@ $pl-button-color: #0079bc; ...@@ -86,3 +86,67 @@ $pl-button-color: #0079bc;
@include span-columns(3); @include span-columns(3);
} }
} }
// CASE: empty list of programs
.empty-programs-message {
border: 3px solid $gray-l4;
background: $gray-l6;
padding: ($baseline*2) 0;
text-align: center;
p {
@include font-size(24);
color: $lighter-base-font-color;
margin-bottom: $baseline;
text-shadow: 0 1px rgba(255,255,255, 0.6);
}
a {
@include box-sizing(border-box);
background-color: $blue;
border: 1px solid $blue;
box-shadow: 0 1px 8px 0 $shadow-l1;
color: $white;
font-family: $sans-serif;
display: inline-block;
letter-spacing: 1px;
margin-top: ($baseline/4);
margin-left: ($baseline/4);
padding: 15px 20px;
&:hover, &:focus {
background: $blue-l2;
text-decoration: none;
}
}
.find-xseries-programs {
@extend %btn-pl-black-base;
.action-xseries-icon {
@include float(left);
@include margin-right($baseline*0.4);
display: inline;
background: url('#{$static-path}/images/icon-sm-xseries-white.png') no-repeat;
background-color: transparent;
width: ($baseline*1.1);
height: ($baseline*1.1);
}
&:hover,
&:focus {
.action-xseries-icon {
@include float(left);
@include margin-right($baseline*0.4);
display: inline;
background: url('#{$static-path}/images/icon-sm-xseries-black.png') no-repeat;
background-color: transparent;
width: ($baseline*1.1);
height: ($baseline*1.1);
}
}
}
}
...@@ -104,12 +104,13 @@ from openedx.core.djangolib.markup import Text, HTML ...@@ -104,12 +104,13 @@ from openedx.core.djangolib.markup import Text, HTML
</ul> </ul>
% else: % else:
<section class="empty-dashboard-message"> <section class="empty-dashboard-message">
<p>${_("Looks like you haven't enrolled in any courses yet.")}</p> <p>${_("You are not enrolled in any courses yet.")}</p>
% if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<a href="${marketing_link('COURSES')}"> <a href="${marketing_link('COURSES')}">
${_("Find courses now!")} ${_("Explore courses")}
</a> </a>
%endif %endif
</section> </section>
% endif % endif
......
<section class="empty-programs-message">
<p><%- gettext('You are not enrolled in any XSeries Programs yet.') %></p>
<a class="find-xseries-programs" href="<%- xseriesUrl %>">
<i class="action-xseries-icon" aria-hidden="true"></i>
<span><%- gettext('Explore XSeries Programs') %></span>
</a>
</section>
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