ECOM-1524: Display credit availability on the dashboard
This commit is contained in:
@@ -1339,6 +1339,12 @@ certificates_web_view_js = [
|
||||
'js/src/logger.js',
|
||||
]
|
||||
|
||||
credit_web_view_js = [
|
||||
'js/vendor/jquery.min.js',
|
||||
'js/vendor/jquery.cookie.js',
|
||||
'js/src/logger.js',
|
||||
]
|
||||
|
||||
PIPELINE_CSS = {
|
||||
'style-vendor': {
|
||||
'source_filenames': [
|
||||
@@ -1578,6 +1584,10 @@ PIPELINE_JS = {
|
||||
'utility': {
|
||||
'source_filenames': ['js/src/utility.js'],
|
||||
'output_filename': 'js/utility.js'
|
||||
},
|
||||
'credit_wv': {
|
||||
'source_filenames': credit_web_view_js,
|
||||
'output_filename': 'js/credit/web_view.js'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -531,6 +531,10 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.purchase_credit {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.message {
|
||||
@extend %ui-depth1;
|
||||
border-radius: 3px;
|
||||
|
||||
@@ -83,7 +83,8 @@ from django.core.urlresolvers import reverse
|
||||
<% is_course_blocked = (course.id in block_courses) %>
|
||||
<% course_verification_status = verification_status_by_course.get(course.id, {}) %>
|
||||
<% course_requirements = courses_requirements_not_met.get(course.id) %>
|
||||
<%include file='dashboard/_dashboard_course_listing.html' args="course=course, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status, show_email_settings=show_email_settings, course_mode_info=course_mode_info, show_refund_option = show_refund_option, is_paid_course = is_paid_course, is_course_blocked = is_course_blocked, verification_status=course_verification_status, course_requirements=course_requirements, dashboard_index=dashboard_index, share_settings=share_settings" />
|
||||
<% credit_message = credit_messages.get(unicode(course.id)) %>
|
||||
<%include file='dashboard/_dashboard_course_listing.html' args="course=course, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status, show_email_settings=show_email_settings, course_mode_info=course_mode_info, show_refund_option = show_refund_option, is_paid_course = is_paid_course, is_course_blocked = is_course_blocked, verification_status=course_verification_status, course_requirements=course_requirements, dashboard_index=dashboard_index, share_settings=share_settings, credit_message=credit_message, user=user" />
|
||||
% endfor
|
||||
|
||||
% if settings.FEATURES.get('CUSTOM_COURSES_EDX', False):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%page args="course, enrollment, show_courseware_link, cert_status, show_email_settings, course_mode_info, show_refund_option, is_paid_course, is_course_blocked, verification_status, course_requirements, dashboard_index, share_settings" />
|
||||
<%page args="course, enrollment, show_courseware_link, cert_status, show_email_settings, course_mode_info, show_refund_option, is_paid_course, is_course_blocked, verification_status, course_requirements, dashboard_index, share_settings, credit_message" />
|
||||
|
||||
<%!
|
||||
import urllib
|
||||
@@ -273,7 +273,11 @@ from student.helpers import (
|
||||
<ul class="messages-list">
|
||||
% if course.may_certify() and cert_status:
|
||||
<%include file='_dashboard_certificate_information.html' args='cert_status=cert_status,course=course, enrollment=enrollment'/>
|
||||
% endif
|
||||
% endif
|
||||
|
||||
% if credit_message:
|
||||
<%include file='_dashboard_credit_information.html' args='credit_message=credit_message'/>
|
||||
% endif
|
||||
|
||||
% if verification_status.get('status') in [VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, VERIFY_STATUS_APPROVED, VERIFY_STATUS_NEED_TO_REVERIFY] and not is_course_blocked:
|
||||
<div class="message message-status wrapper-message-primary is-shown">
|
||||
|
||||
70
lms/templates/dashboard/_dashboard_credit_information.html
Normal file
70
lms/templates/dashboard/_dashboard_credit_information.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<%page args="credit_message" />
|
||||
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from course_modes.models import CourseMode
|
||||
from util.date_utils import get_default_time_display
|
||||
%>
|
||||
<%namespace name='static' file='../static_content.html'/>
|
||||
|
||||
<%block name="js_extra" args="credit_message">
|
||||
<%static:js group='credit_wv'/>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRFToken': $.cookie('csrftoken')
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
$(".purchase-credit-btn").click(function() {
|
||||
var data = {
|
||||
user_id: "${credit_message['user_id']}",
|
||||
course_id: "${credit_message['course_id']}"
|
||||
};
|
||||
Logger.log('edx.credit.shared', data);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%block>
|
||||
|
||||
<div class="message message-status is-shown">
|
||||
<p>
|
||||
% if credit_message["status"] == "requirements_meet":
|
||||
<span>
|
||||
% if credit_message["urgent"]:
|
||||
${_("{username}, your eligibility for credit expires on {expiry}. Don't miss out!").format(
|
||||
username=credit_message["user_full_name"],
|
||||
expiry=get_default_time_display(credit_message["expiry"])
|
||||
)
|
||||
}
|
||||
% else:
|
||||
${_("{congrats} {username}, You have meet requirements for credit.").format(
|
||||
congrats="<b>Congratulations</b>",
|
||||
username=credit_message["user_full_name"]
|
||||
)
|
||||
}
|
||||
% endif
|
||||
</span>
|
||||
<span class="purchase_credit"> <a class="btn purchase-credit-btn" href="" target="_blank">${_("Purchase Credit")}</a> </span>
|
||||
|
||||
% elif credit_message["status"] == "pending":
|
||||
${_("Thank you, your payment is complete, your credit is processing. Please see {provider_link} for more information.").format(
|
||||
provider_link='<a href="#" target="_blank">{}</a>'.format(credit_message["provider"]["display_name"])
|
||||
)
|
||||
}
|
||||
% elif credit_message["status"] == "approved":
|
||||
${_("Thank you, your credit is approved. Please see {provider_link} for more information.").format(
|
||||
provider_link='<a href="#" target="_blank">{}</a>'.format(credit_message["provider"]["display_name"])
|
||||
)
|
||||
}
|
||||
% elif credit_message["status"] == "rejected":
|
||||
${_("Your credit has been denied. Please contact {provider_link} for more information.").format(
|
||||
provider_link='<a href="#" target="_blank">{}</a>'.format(credit_message["provider"]["display_name"])
|
||||
)
|
||||
}
|
||||
% endif
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user