From 8fcf574029786fc3d4e84dc50af05262bbab5eb9 Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Fri, 11 Dec 2015 13:02:28 -0500 Subject: [PATCH] Corrected Dashboard Display - Simplified logic determiningg credit messaging on dashboard - Fixed bug preventing users from initiating credit request ECOM-2893 --- lms/static/sass/multicourse/_dashboard.scss | 6 +- .../dashboard/_dashboard_credit_info.html | 130 ++++++++++-------- 2 files changed, 72 insertions(+), 64 deletions(-) diff --git a/lms/static/sass/multicourse/_dashboard.scss b/lms/static/sass/multicourse/_dashboard.scss index 71a5bfe022..1901dcae37 100644 --- a/lms/static/sass/multicourse/_dashboard.scss +++ b/lms/static/sass/multicourse/_dashboard.scss @@ -782,14 +782,10 @@ } .credit-action { - .credit-msg { - @include float(left); - width: flex-grid(10, 12); - } - .credit-btn { @extend %btn-pl-yellow-base; @include float(right); + margin-right: 5px; background-image: none ; text-shadow: none; box-shadow: none; diff --git a/lms/templates/dashboard/_dashboard_credit_info.html b/lms/templates/dashboard/_dashboard_credit_info.html index 884b455a43..07d31c5b23 100644 --- a/lms/templates/dashboard/_dashboard_credit_info.html +++ b/lms/templates/dashboard/_dashboard_credit_info.html @@ -1,75 +1,87 @@ <%page args="credit_status" /> <%! - import datetime - import pytz from django.utils.translation import ugettext as _ - from util.date_utils import get_default_time_display %> <%namespace name='static' file='../static_content.html'/> -% if credit_status["provider_name"]: - <% provider_link='{}'.format(credit_status["provider_status_url"], credit_status["provider_name"]) %> -% endif + % if credit_status["eligible"]: + <% + provider_link = '{name}'.format( + href=credit_status["provider_status_url"], + name=credit_status["provider_name"]) + + error = credit_status['error'] + + + status = 'eligible' + + # Translators: provider_name is the name of a credit provider or university (e.g. State University) + credit_msg = _("You have completed this course and are eligible to purchase course credit. Select Get Credit to get started.") + credit_msg_class = "credit-eligibility-msg" + credit_btn_class = "purchase-credit-btn" + credit_btn_label = _("Get Credit") + credit_btn_href = '{root}/credit/checkout/{course_id}/'.format( + root=settings.ECOMMERCE_PUBLIC_URL_ROOT, + course_id=credit_status['course_key']) + + if credit_status["purchased"]: + request_status = credit_status["request_status"] + if request_status is None: + # Learner must initiate the credit request + + # Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a credit provider, such as 'State University' or 'Happy Fun Company'. + credit_msg = _("Thank you for your payment. To receive course credit, you must now request credit " + "at the {link_to_provider_site} website. Select Request Credit to get started.").format( + link_to_provider_site=provider_link, + ) + credit_msg_class = "credit-request-pending-msg" + credit_btn_label = _("Request Credit") + credit_btn_class = 'pending-credit-btn' + elif request_status == 'pending': + # Request received but not reviewed + ## Translators: provider_name is the name of a credit provider or university (e.g. State University) + credit_msg = _("{provider_name} has received your course credit request. We will update you when credit processing is complete.").format(provider_name=credit_status["provider_name"]) + credit_msg_class = "credit-request-pending-msg" + credit_btn_label = _("View Details") + credit_btn_class = 'pending-credit-btn' + elif request_status == 'approved': + # Credit granted! + # Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a credit provider, such as 'State University' or 'Happy Fun Company'. provider_name is the name of credit provider. + credit_msg = _("Congratulations! {provider_name} has approved your request for course credit. To see your course credit, visit the {link_to_provider_site} website.").format( + provider_name=credit_status["provider_name"], + link_to_provider_site=provider_link, + ) + credit_msg_class = "credit-request-approved-msg" + credit_btn_href = credit_status['provider_status_url'] + credit_btn_label = _("View Credit") + elif request_status == 'rejected': + # REJECTED (by the credit provider)! + ## Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a credit provider, such as 'State University' or 'Happy Fun Company'. provider_name is the name of credit provider. + credit_msg = _("{provider_name} did not approve your request for course credit. For more information, contact {link_to_provider_site} directly.").format( + provider_name=credit_status["provider_name"], + link_to_provider_site=provider_link, + ) + credit_msg_class = "credit-request-rejected-msg" + credit_btn_label = None + %> +
+ -
- % if not credit_status["purchased"] and not credit_status["error"] : -

- ## Translators: provider_name is the name of a credit provider or university (e.g. State University) - ${_("You have completed this course and are eligible to purchase course credit. Select Get Credit to get started.")} -

- - % elif credit_status["request_status"] in [None, "pending"] and not credit_status["error"]: - % if credit_status["request_status"] == "pending": -

- ## Translators: provider_name is the name of a credit provider or university (e.g. State University) - ${_("{provider_name} has received your course credit request. We will update you when credit processing is complete.").format( - provider_name=credit_status["provider_name"], - ) - } -

- % elif credit_status["request_status"] is None: -

- ## Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a - ## credit provider, such as 'State University' or 'Happy Fun Company'. - ${_("Thank you for your payment. To receive course credit, you must now request credit at the {link_to_provider_site} website. Select Request Credit to get started.").format( - link_to_provider_site=provider_link, - ) - } -

+
+ % if credit_btn_label: + + ${credit_btn_label} + % endif - ${_("View Details")} - % elif credit_status["request_status"] == "approved" and not credit_status["error"] : -

- ## Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a - ## credit provider, such as 'State University' or 'Happy Fun Company'. provider_name is the name of credit provider. - ${_("Congratulations! {provider_name} has approved your request for course credit. To see your course credit, visit the {link_to_provider_site} website.").format( - provider_name=credit_status["provider_name"], - link_to_provider_site=provider_link, - ) - } -

- ${_("View Credit")} - % elif credit_status["request_status"] == "rejected" and not credit_status["error"] : -

- ## Translators: link_to_provider_site is a link to an external webpage. The text of the link will be the name of a - ## credit provider, such as 'State University' or 'Happy Fun Company'. provider_name is the name of credit provider. - ${_("{provider_name} did not approve your request for course credit. For more information, contact {link_to_provider_site} directly.").format( - provider_name=credit_status["provider_name"], - link_to_provider_site=provider_link, - ) - } -

- % endif +
${credit_msg}
% endif