fix: exponse class info only to moderators
This commit is contained in:
@@ -285,9 +285,8 @@
|
||||
|
||||
{%- block script %}
|
||||
{{ super() }}
|
||||
|
||||
{% if is_moderator %}
|
||||
<script>
|
||||
{% if is_moderator %}
|
||||
frappe.boot.user = {
|
||||
"can_create": [],
|
||||
"can_select": ["User"],
|
||||
@@ -299,9 +298,9 @@
|
||||
return name.toLowerCase().replace(/ /g, "-");
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
let class_info = {{ class_info | json }};
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{{ include_script('controls.bundle.js') }}
|
||||
{% endblock %}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{% block page_content %}
|
||||
<div class="common-page-style lms-page-style">
|
||||
<div class="container">
|
||||
{% if has_course_moderator_role() %}
|
||||
{% if is_moderator %}
|
||||
<button class="btn btn-secondary btn-sm pull-right" id="create-class">
|
||||
{{ _("Create Class") }}
|
||||
</button>
|
||||
@@ -30,9 +30,11 @@
|
||||
{%- block script %}
|
||||
{{ super() }}
|
||||
{{ include_script('controls.bundle.js') }}
|
||||
{% if is_moderator %}
|
||||
<script>
|
||||
let class_info = null;
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% macro ClassCards(classes) %}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import frappe
|
||||
from frappe.utils import getdate
|
||||
from lms.lms.utils import has_course_moderator_role
|
||||
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
|
||||
context.is_moderator = has_course_moderator_role()
|
||||
context.classes = frappe.get_all(
|
||||
"LMS Class",
|
||||
{"end_date": [">=", getdate()]},
|
||||
|
||||
Reference in New Issue
Block a user