fix: replaced some dialogs with alerts

This commit is contained in:
Jannat Patel
2022-06-06 11:15:06 +05:30
parent 55a770f129
commit 1f3806a7bd
12 changed files with 89 additions and 74 deletions

View File

@@ -22,9 +22,6 @@
</div>
<div class="lesson-pagination-parent">
{{ LessonContent(lesson) }}
{% if membership %}
{{ pagination(prev_url, next_url) }}
{% endif %}
{{ Discussions() }}
</div>
</div>
@@ -45,7 +42,7 @@
{% macro LessonContent(lesson) %}
{% set instructors = get_instructors(course.name) %}
{% set is_instructor = is_instructor(course.name) %}
<div class="lesson-content">
<div class="common-card-style lesson-content">
<div class="lesson-title">
<div class="course-home-headings title mb-0
{% if membership %} is-member {% endif %}
@@ -100,6 +97,8 @@
{% endif %}
</div>
{{ pagination(prev_url, next_url) }}
</div>
{% endmacro %}
@@ -145,10 +144,12 @@
{% endmacro %}
{% macro Discussions() %}
{% set topics_count = frappe.db.count("Discussion Topic",
{"reference_doctype": "Course Lesson", "reference_docname": lesson.name}) %}
{% set is_instructor = frappe.session.user == course.instructor %}
{% set condition = is_instructor if is_instructor else membership %}
{% set doctype, docname = "Course Lesson", lesson.name %}
{% set title = "Questions" %}
{% set title = "Questions" if topics_count else "" %}
{% set cta_title = "Ask a Question" %}
{% set button_name = "Start Learning" %}
{% set redirect_to = "/courses/" + course.name %}

View File

@@ -161,22 +161,27 @@ const element_not_in_viewport = (el) => {
};
const submit_for_review = (e) => {
let course = $(e.currentTarget).data("course");
frappe.call({
method: "lms.lms.doctype.lms_course.lms_course.submit_for_review",
args: {
"course": course
},
callback: (data) => {
if (data.message == "No Chp") {
frappe.msgprint(__(`There are no chapters in this course.
Please add chapters and lessons to your course before you submit it for review.`));
} else if (data.message == "OK") {
frappe.msgprint(__("Your course has been submitted for review."))
window.location.reload();
}
}
})
let course = $(e.currentTarget).data("course");
frappe.call({
method: "lms.lms.doctype.lms_course.lms_course.submit_for_review",
args: {
"course": course
},
callback: (data) => {
if (data.message == "No Chp") {
frappe.msgprint(__(`There are no chapters in this course.
Please add chapters and lessons to your course before you submit it for review.`));
} else if (data.message == "OK") {
frappe.show_alert({
message: __("Your course has been submitted for review."),
indicator:'green'
}, 3);
setTimeout(() => {
window.location.reload();
}, 3000);
}
}
});
};
const apply_cetificate = (e) => {
@@ -199,10 +204,13 @@ const submit_slot = (e) => {
},
callback: (data) => {
$("#slot-modal").modal("hide");
frappe.msgprint(__("Your slot has been booked. Prepare well for the evaluations."));
frappe.show_alert({
message: __("Your slot has been booked. Prepare well for the evaluations."),
indicator:'green'
}, 3);
setTimeout(() => {
window.location.reload();
}, 2000);
}, 3000);
}
});
};

View File

@@ -18,15 +18,18 @@ const open_report_dialog = (e) => {
};
const report = (e) => {
frappe.call({
method: "lms.job.doctype.job_opportunity.job_opportunity.report",
args: {
"job": $(e.currentTarget).data("job"),
"reason": $(".report-field").val()
},
callback: (data) => {
$(".report-modal").modal("hide");
frappe.msgprint(__("Thanks for informing us about this post. The admin will look into it and take an appropriate action soon."))
}
})
frappe.call({
method: "lms.job.doctype.job_opportunity.job_opportunity.report",
args: {
"job": $(e.currentTarget).data("job"),
"reason": $(".report-field").val()
},
callback: (data) => {
$(".report-modal").modal("hide");
frappe.show_alert({
message: __("Thanks for informing us about this post. The admin will look into it and take an appropriate action soon."),
indicator:'green'
}, 5);
}
});
}