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