Added LMS Settings.
The `livecode_url` is now part of LMS settings and not hardcoded in the code.
This commit is contained in:
0
community/lms/doctype/lms_settings/__init__.py
Normal file
0
community/lms/doctype/lms_settings/__init__.py
Normal file
8
community/lms/doctype/lms_settings/lms_settings.js
Normal file
8
community/lms/doctype/lms_settings/lms_settings.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('LMS Settings', {
|
||||||
|
// refresh: function(frm) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
});
|
||||||
41
community/lms/doctype/lms_settings/lms_settings.json
Normal file
41
community/lms/doctype/lms_settings/lms_settings.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"creation": "2021-03-09 14:30:15.807410",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"livecode_url"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"default": "https://livecode.dev.fossunited.org",
|
||||||
|
"fieldname": "livecode_url",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "LiveCode URL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"index_web_pages_for_search": 1,
|
||||||
|
"issingle": 1,
|
||||||
|
"links": [],
|
||||||
|
"modified": "2021-03-09 14:30:15.807410",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "LMS",
|
||||||
|
"name": "LMS Settings",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"role": "System Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"track_changes": 1
|
||||||
|
}
|
||||||
10
community/lms/doctype/lms_settings/lms_settings.py
Normal file
10
community/lms/doctype/lms_settings/lms_settings.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
# import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
class LMSSettings(Document):
|
||||||
|
pass
|
||||||
10
community/lms/doctype/lms_settings/test_lms_settings.py
Normal file
10
community/lms/doctype/lms_settings/test_lms_settings.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class TestLMSSettings(unittest.TestCase):
|
||||||
|
pass
|
||||||
@@ -67,13 +67,13 @@
|
|||||||
|
|
||||||
{%- block script %}
|
{%- block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript" src="http://livecode.dev.fossunited.org/static/livecode.js"></script>
|
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$(".canvas-editor").each((i, e) => {
|
$(".canvas-editor").each((i, e) => {
|
||||||
var editor = new LiveCodeEditor(e, {
|
var editor = new LiveCodeEditor(e, {
|
||||||
runtime: "python-canvas",
|
runtime: "python-canvas",
|
||||||
base_url: "http://livecode.dev.fossunited.org"
|
base_url: "{{ livecode_url }}"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ def get_context(context):
|
|||||||
|
|
||||||
topic_name = get_queryparam("topic", '/courses?course=' + course_name)
|
topic_name = get_queryparam("topic", '/courses?course=' + course_name)
|
||||||
context.topic = get_topic(course_name, topic_name)
|
context.topic = get_topic(course_name, topic_name)
|
||||||
|
context.livecode_url = get_livecode_url()
|
||||||
|
|
||||||
|
def get_livecode_url():
|
||||||
|
doc = frappe.get_doc("LMS Settings")
|
||||||
|
return doc.livecode_url
|
||||||
|
|
||||||
def get_queryparam(name, redirect_when_not_found):
|
def get_queryparam(name, redirect_when_not_found):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user