ECOM-3201

Updated dashboard UI for empty list of courses and programs
This commit is contained in:
tasawernawaz
2016-04-14 15:38:26 +00:00
parent 4a015f5f43
commit ba6ba40e2e
8 changed files with 144 additions and 52 deletions

View File

@@ -12,6 +12,7 @@
new CollectionListView({
el: '.program-cards-container',
childView: ProgramCardView,
context: options,
collection: new ProgramCollection(options.programsData)
}).render();

View File

@@ -1,22 +1,40 @@
;(function (define) {
'use strict';
define(['backbone'],
function(
Backbone
) {
define(['backbone',
'jquery',
'underscore',
'gettext',
'text!../../../templates/learner_dashboard/empty_programs_list.underscore'
],
function (Backbone,
$,
_,
gettext,
emptyProgramsListTpl) {
return Backbone.View.extend({
initialize: function(data) {
this.childView = data.childView;
this.context = data.context;
},
render: function() {
var childList = [];
this.collection.each(function(program){
var child = new this.childView({model:program});
childList.push(child.el);
}, this);
this.$el.html(childList);
var childList, tpl;
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);
}, this);
this.$el.html(childList);
}
}
});
}