Commit ff0da0f7 by Matthew Piatetsky

Fix progress issues

ECOM-6602
parent 22ab0c8d
......@@ -122,19 +122,25 @@
},
getCertificatePriceString: function(run) {
var verifiedSeat, currency;
var upgradeableSeat, upgradeableSeats, currency;
if ('seats' in run && run.seats.length) {
// eslint-disable-next-line consistent-return
verifiedSeat = _.filter(run.seats, function(seat) {
if (['verified', 'professional', 'credit'].indexOf(seat.type) >= 0) {
upgradeableSeats = _.filter(run.seats, function(seat) {
var upgradeableSeatTypes = ['verified', 'professional', 'no-id-professional', 'credit'];
if (upgradeableSeatTypes.indexOf(seat.type) >= 0) {
return seat;
}
})[0];
currency = verifiedSeat.currency;
if (currency === 'USD') {
return '$' + verifiedSeat.price;
} else {
return verifiedSeat.price + ' ' + currency;
});
if (upgradeableSeats.length > 0) {
upgradeableSeat = upgradeableSeats[0];
if (upgradeableSeat) {
currency = upgradeableSeat.currency;
if (currency === 'USD') {
return '$' + upgradeableSeat.price;
} else {
return upgradeableSeat.price + ' ' + currency;
}
}
}
}
return null;
......
......@@ -53,7 +53,8 @@
postRender: function() {
var $upgradeMessage = this.$('.upgrade-message'),
$certStatus = this.$('.certificate-status'),
$expiredNotification = this.$('.expired-notification');
$expiredNotification = this.$('.expired-notification'),
expired = this.model.get('expired');
this.enrollView = new CourseEnrollView({
$parentEl: this.$('.course-actions'),
......@@ -62,14 +63,14 @@
enrollModel: this.enrollModel
});
if (this.model.get('upgrade_url')) {
if (this.model.get('upgrade_url') && !(expired === true)) {
this.upgradeMessage = new UpgradeMessageView({
$el: $upgradeMessage,
model: this.model
});
$certStatus.remove();
} else if (this.model.get('certificate_url')) {
} else if (this.model.get('certificate_url') && !(expired === true)) {
this.certificateStatus = new CertificateStatusView({
$el: $certStatus,
model: this.model
......@@ -82,7 +83,7 @@
$certStatus.remove();
}
if (this.model.get('expired')) {
if (expired) {
this.expiredNotification = new ExpiredNotificationView({
$el: $expiredNotification,
model: this.model
......
......@@ -50,7 +50,7 @@
handleEnroll: function() {
// Enrollment click event handled here
var courseRunKey = $('.run-select').val();
var courseRunKey = $('.run-select').val() || this.model.get('course_run_key');
this.model.updateCourseRun(courseRunKey);
if (!this.model.get('is_enrolled')) {
// Create the enrollment.
......
......@@ -115,6 +115,10 @@
margin-top: 10px;
height: auto;
svg {
width: inherit;
}
/* IE11 CSS styles */
@media(min-width: $bp-screen-md) and (-ms-high-contrast: none), (-ms-high-contrast: active) {
height: 50px;
......@@ -147,6 +151,7 @@
.meta-info {
margin: 0;
display: block;
@media(min-width: $bp-screen-md) {
width: 70%;
}
......@@ -426,7 +431,7 @@
height: 37px;
width: 128px;
border-radius: 0;
padding: 0;
padding: 7px 0 0 0;
text-align: center;
font-size: 0.9375em;
......
......@@ -4,7 +4,7 @@
<span class="price"> <%- price %></span>
</div>
<div class="action col-12 md-col-4">
<button href="<%- upgrade_url %>" type="button" class="btn-brand btn cta-primary upgrade-button">
<a href="<%- upgrade_url %>" class="btn-brand btn cta-primary upgrade-button">
<%- gettext('Buy Certificate') %>
</button>
<a>
</div>
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