Allow program listing page to display programs from any category

This work removes most references to XSeries from the LMS in an attempt to be more general. ECOM-5018.
This commit is contained in:
Renzo Lucioni
2016-07-25 15:38:50 -04:00
parent 92f3c7ee60
commit 8196e1a024
35 changed files with 159 additions and 269 deletions

View File

@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133.28 119.8">
<path class="cls-1" d="M27.11,43.21A129,129,0,0,0,40,46.42,59.6,59.6,0,0,0,32.75,66l3.94,0.71A55.79,55.79,0,0,1,44.14,47.2,184,184,0,0,0,74.8,49.87V66.36h4V49.85a185.1,185.1,0,0,0,29.8-2.93,55.69,55.69,0,0,1,7.5,19.59l3.94-.71a59.37,59.37,0,0,0-7.28-19.68q6-1.24,12.27-3a61.23,61.23,0,0,1,11.55,23.39l3.88-1a66.47,66.47,0,0,0-128.74.08l3.88,1A61.24,61.24,0,0,1,27.11,43.21Zm19.46,0.35C56.08,30.42,69.23,23.49,74.8,21V45.89A180.18,180.18,0,0,1,46.57,43.56Zm32.23,2.3V21.35c5.93,2.72,18.28,9.49,27.35,22A181.27,181.27,0,0,1,78.8,45.86Zm43.36-6.07q-5.93,1.59-11.67,2.71a73.59,73.59,0,0,0-24.61-22A62.34,62.34,0,0,1,122.15,39.79ZM67.24,20.36c-7.22,4.05-17.4,11.23-25,22.44-5.51-1.05-9.7-2.15-12.28-2.9A62.33,62.33,0,0,1,67.24,20.36Z" transform="translate(-9.84 -15.73)"/>
<rect class="cls-1" x="9.85" y="131.42" width="133.27" height="4" transform="translate(-10.04 -15.62) rotate(-0.08)"/>
<rect class="cls-1" x="9.85" y="75.42" width="133.27" height="4" transform="translate(-9.96 -15.62) rotate(-0.08)"/>
<polygon class="cls-1" points="59.7 104.96 59.7 70.71 29.96 100.47 0.21 70.71 0.21 104.96 4.21 104.96 4.21 80.37 29.96 106.13 55.7 80.37 55.7 104.96 59.7 104.96"/>
<polygon class="cls-1" points="131.2 104.96 131.2 70.71 101.46 100.47 71.71 70.71 71.71 104.96 75.71 104.96 75.71 80.37 101.46 106.13 127.2 80.37 127.2 104.96 131.2 104.96"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.06 36.98">
<polygon class="cls-1" points="4.96 16.47 3.06 15.45 1.15 16.44 1.53 14.32 0 12.81 2.13 12.52 3.1 10.59 4.04 12.53 6.16 12.86 4.61 14.34 4.96 16.47"/>
<polygon class="cls-1" points="11.89 36.98 6.99 36.98 6.99 19.89 11.89 16.34 11.89 36.98"/>
<polygon class="cls-1" points="10.34 6.69 10.69 8.81 8.79 7.79 6.88 8.78 7.26 6.66 5.73 5.15 7.86 4.86 8.83 2.94 9.77 4.87 11.89 5.2 10.34 6.69"/>
<rect class="cls-1" x="15.59" y="12.95" width="4.89" height="24.02"/>
<polygon class="cls-1" points="19.56 3.75 19.91 5.87 18.01 4.86 16.1 5.84 16.48 3.73 14.95 2.21 17.08 1.92 18.05 0 18.99 1.94 21.11 2.26 19.56 3.75"/>
<polygon class="cls-1" points="29.06 36.98 24.17 36.98 24.18 15.99 29.06 19.6 29.06 36.98"/>
<polygon class="cls-1" points="27.23 7.79 25.31 8.78 25.7 6.66 24.17 5.15 26.3 4.86 27.26 2.94 28.2 4.87 30.33 5.2 28.77 6.69 29.12 8.81 27.23 7.79"/>
<polygon class="cls-1" points="32.95 15.45 31.04 16.44 31.42 14.32 29.89 12.81 32.02 12.52 32.99 10.59 33.93 12.53 36.06 12.86 34.51 14.35 34.85 16.47 32.95 15.45"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -12,7 +12,7 @@
if (data){
this.set({
name: data.name,
type: data.display_category + ' Program',
category: data.category,
subtitle: data.subtitle,
organizations: data.organizations,
detailUrl: data.detail_url,

View File

@@ -28,10 +28,12 @@
}
}).render();
new SidebarView({
el: '.sidebar',
context: options
}).render();
if ( options.programsData.length ) {
new SidebarView({
el: '.sidebar',
context: options
}).render();
}
};
});
}).call(this, define || RequireJS.define);

View File

@@ -28,8 +28,8 @@
var childList;
if (!this.collection.length) {
if (this.context.xseriesUrl) {
//Only show the xseries advertising panel if the link is passed in
if (this.context.marketingUrl) {
//Only show the advertising panel if the link is passed in
HtmlUtils.setHtml(this.$el, HtmlUtils.template(emptyProgramsListTpl)(this.context));
}
} else {

View File

@@ -23,8 +23,8 @@
this.context = data.context;
this.$parentEl = $(this.parentEl);
if (this.context.xseriesUrl){
// Only render if there is an XSeries link
if (this.context.marketingUrl){
// Only render if there is a link
this.render();
} else {
/**

View File

@@ -19,7 +19,7 @@ define([
"credential_url": "https://credentials.stage.edx.org/credentials/dummy-uuid-2/"
}
],
xseriesImage: "/images/testing.png"
sampleCertImageSrc: "/images/programs/sample-cert.png"
}
};
@@ -45,8 +45,8 @@ define([
expect($(el).html().trim()).toEqual(data.context.certificatesData[index].display_name);
expect($(el).attr('href')).toEqual(data.context.certificatesData[index].credential_url);
});
expect(view.$el.find('.hd-6').html().trim()).toEqual('XSeries Program Certificates:');
expect(view.$el.find('img').attr('src')).toEqual('/images/testing.png');
expect(view.$el.find('.hd-6').html().trim()).toEqual('Program Certificates');
expect(view.$el.find('img').attr('src')).toEqual(data.context.sampleCertImageSrc);
});
it('should display no certificate box if certificates list is empty', function() {

View File

@@ -13,8 +13,7 @@ define([
var view = null,
programModel,
program = {
category: 'xseries',
display_category: 'XSeries',
category: 'FooBar',
status: 'active',
subtitle: 'program 1',
name: 'test program 1',
@@ -53,7 +52,7 @@ define([
cardRenders = function($card) {
expect($card).toBeDefined();
expect($card.find('.title').html().trim()).toEqual(program.name);
expect($card.find('.category span').html().trim()).toEqual('XSeries Program');
expect($card.find('.category span').html().trim()).toEqual(program.category);
expect($card.find('.organization').html().trim()).toEqual(program.organizations[0].key);
expect($card.find('.card-link').attr('href')).toEqual(program.detail_url);
};

View File

@@ -10,14 +10,14 @@ define([
describe('Sidebar View', function () {
var view = null,
context = {
xseriesUrl: 'http://www.edx.org/xseries',
marketingUrl: 'https://www.example.org/programs',
certificatesData: [
{
"display_name": "Testing",
"credential_url": "https://credentials.stage.edx.org/credentials/dummy-uuid-1/"
"credential_url": "https://credentials.example.com/credentials/uuid/"
}
],
xseriesImage: '/image/test.png'
sampleCertImageSrc: "/images/programs/sample-cert.png"
};
beforeEach(function() {
@@ -38,18 +38,18 @@ define([
expect(view).toBeDefined();
});
it('should load the xseries advertising based on passed in xseries URL', function() {
it('should load the exploration panel given a marketing URL', function() {
var $sidebar = view.$el;
expect($sidebar.find('.program-advertise .advertise-message').html().trim())
.toEqual('Browse recently launched courses and see what\'s new in your favorite subjects');
expect($sidebar.find('.program-advertise .ad-link a').attr('href')).toEqual(context.xseriesUrl);
expect($sidebar.find('.program-advertise .ad-link a').attr('href')).toEqual(context.marketingUrl);
});
it('should load the certificates based on passed in certificates list', function() {
expect(view.$('.certificate-link').length).toBe(1);
});
it('should not load the xseries advertising if no xseriesUrl passed in', function(){
it('should not load the advertising panel if no marketing URL is provided', function(){
var $ad;
view.remove();
view = new SidebarView({

View File

@@ -58,7 +58,6 @@
@import "views/financial-assistance";
@import 'views/bookmarks';
@import 'course/auto-cert';
@import 'elements/xseries-certificates';
@import 'views/api-access';
// app - discussion

View File

@@ -6,7 +6,7 @@
overflow: hidden;
}
.program-card{
.program-card {
@include span(12);
border: 1px solid $border-color-l3;
border-bottom: none;
@@ -21,7 +21,7 @@
}
}
.card-link{
.card-link {
@include left(0);
@include right(0);
position: absolute;
@@ -33,11 +33,11 @@
&:active,
&:hover,
&:focus{
&:focus {
opacity: 1;
}
.banner-image-container{
.banner-image-container {
position: relative;
overflow: hidden;
height: 166px;
@@ -46,7 +46,7 @@
@include susy-media($bp-screen-md) { height: 116px; }
@include susy-media($bp-screen-lg) { height: 145px; }
.banner-image{
.banner-image {
@include left(50%);
position: absolute;
top: 0;
@@ -57,7 +57,7 @@
}
}
.text-section{
.text-section {
padding: 40px $baseline $baseline;
position: relative;
margin-top: 156px;
@@ -67,7 +67,7 @@
@include susy-media($bp-screen-lg) { margin-top: 135px; }
}
.meta-info{
.meta-info {
font-size: font-size(x-small);
color: palette(grayscale, dark);
position: absolute;
@@ -75,31 +75,39 @@
width: calc(100% - 40px);
}
.organization{
.organization {
@include span(6);
white-space: nowrap;
overflow: hidden;
}
.category{
.category {
@include span(6);
@include text-align(right);
.category-text{
@include float(right);
.category-text {
@include float(right);
}
.xseries-icon{
.category-icon {
@include float(right);
@include margin-right($baseline*0.25);
background: url('#{$static-path}/images/icon-sm-xseries-black.png') no-repeat;
background-color: transparent;
background-size: 100%;
width: ($baseline*0.7);
height: ($baseline*0.7);
}
.xseries-icon{
background: url('#{$static-path}/images/programs/xseries-icon.svg') no-repeat;
}
.micromasters-icon{
margin-top: $baseline * 0.05;
background: url('#{$static-path}/images/programs/micromasters-icon.svg') no-repeat;
}
}
.hd-3 {
color: palette(grayscale, x-dark);
min-height: ($baseline*3);

View File

@@ -1,17 +0,0 @@
@mixin xseries-certificate-container {
border: 1px solid $gray-l3;
box-sizing: border-box;
padding: $baseline;
background: $gray-l6;
margin-top: $baseline;
.title{
@extend %t-title6;
@extend %t-weight3;
margin-bottom:$baseline;
color: $gray;
}
.certificate-link{
padding-top: $baseline;
display: block;
}
}

View File

@@ -77,32 +77,4 @@
color: $black;
margin-bottom: $baseline;
}
.find-xseries-programs {
background: $black;
border-color: $black;
color: $white;
.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);
}
&:active,
&:hover,
&:focus {
background: $white;
color: $black;
.action-xseries-icon {
background: url('#{$static-path}/images/icon-sm-xseries-black.png') no-repeat;
}
}
}
}