brotherton-erpnext/erpnext/www/lms/macros/hero.html
Alvaro 43be163b32
feat: Enabled translation on html files in LMS [Proposal] (#21582)
* :fix:  translation fix for html files in LMS

* fix: typo in translation

* Update content.html

* Update content.html

* Update profile.html

Co-authored-by: Shivam Mishra <scmmishra@users.noreply.github.com>
Co-authored-by: Marica <maricadsouza221197@gmail.com>
2020-06-22 11:06:12 +05:30

55 lines
1.4 KiB
HTML

{% macro hero(title, description, has_access, back) %}
<div class='container pb-5'>
<div class="mb-3">
<a href="{{ back.url }}" class="text-muted">
{{_('Back to')}} {{ _(back.name) }}
</a>
</div>
<h1>{{ title }}</h1>
<p class='lead' style="max-width: 100%;">{{ description or ''}}</p>
<p class="mt-4">
{% if frappe.session.user == 'Guest' %}
<a id="signup" class="btn btn-primary btn-lg" href="/login#signup">{{_('Sign Up')}}</a>
{% elif not has_access %}
<button id="enroll" class="btn btn-primary btn-lg" onclick="enroll()" disabled>{{_('Enroll')}}</button>
{% endif %}
</p>
</div>
{% block script %}
<script type="text/javascript">
frappe.ready(() => {
btn = document.getElementById('enroll');
if (btn) btn.disabled = false;
})
function enroll() {
let params = frappe.utils.get_query_params()
let btn = document.getElementById('enroll');
btn.disbaled = true;
btn.innerText = __('Enrolling...')
let opts = {
method: 'erpnext.education.utils.enroll_in_program',
args: {
program_name: params.program
}
}
frappe.call(opts).then(res => {
let success_dialog = new frappe.ui.Dialog({
title: __('Success'),
secondary_action: function() {
window.location.reload()
}
})
success_dialog.set_message(__('You have successfully enrolled for the program '));
success_dialog.$message.show()
success_dialog.show();
btn.disbaled = false;
})
}
</script>
{% endblock %}
{% endmacro %}