Commit ff0da0f7 by Matthew Piatetsky

Fix progress issues

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