fix: undo status change on livecode
This commit is contained in:
@@ -30,19 +30,10 @@
|
|||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button class="run">Run</button>
|
<button class="run">Run</button>
|
||||||
<button class="reset">Reset</button>
|
<button class="reset">Reset</button>
|
||||||
<a class="pull-right dropdown-item border rounded" style="width: 10rem;" href="#" id="navbarDropdown"
|
|
||||||
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
{{ }}
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
||||||
<span class="dropdown-item">Correct</span>
|
|
||||||
<span class="dropdown-item">Incorrect</span>
|
|
||||||
</div>
|
|
||||||
{% if is_exercise %}
|
{% if is_exercise %}
|
||||||
<button class="submit pull-right btn-primary">Submit</button>
|
<button class="submit pull-right btn-primary">Submit</button>
|
||||||
{% if last_submitted %}
|
{% if last_submitted %}
|
||||||
<span class="pull-right" style="padding-right: 10px;"><span class="human-time"
|
<span class="pull-right" style="padding-right: 10px;"><span class="human-time" data-timestamp="{{last_submitted}}"></span></span>
|
||||||
data-timestamp="{{last_submitted}}"></span></span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -72,15 +63,14 @@
|
|||||||
{% macro LiveCodeEditorJS(name, code) %}
|
{% macro LiveCodeEditorJS(name, code) %}
|
||||||
|
|
||||||
<script type="text/javascript" src="/assets/frappe/node_modules/moment/min/moment-with-locales.min.js"></script>
|
<script type="text/javascript" src="/assets/frappe/node_modules/moment/min/moment-with-locales.min.js"></script>
|
||||||
<script type="text/javascript"
|
<script type="text/javascript" src="/assets/frappe/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js"></script>
|
||||||
src="/assets/frappe/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js"></script>
|
|
||||||
<script type="text/javascript" src="/assets/frappe/js/frappe/utils/datetime.js"></script>
|
<script type="text/javascript" src="/assets/frappe/js/frappe/utils/datetime.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// comment_when is failing because of this
|
// comment_when is failing because of this
|
||||||
if (!frappe.sys_defaults) {
|
if (!frappe.sys_defaults) {
|
||||||
frappe.sys_defaults = {}
|
frappe.sys_defaults = {}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
|
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
|
||||||
@@ -90,7 +80,7 @@
|
|||||||
var livecodeEditors = [];
|
var livecodeEditors = [];
|
||||||
var livecodeEditorsMap = {};
|
var livecodeEditorsMap = {};
|
||||||
|
|
||||||
$(function () {
|
$(function() {
|
||||||
$(".livecode-editor").each((i, e) => {
|
$(".livecode-editor").each((i, e) => {
|
||||||
var name = e.id.replace("editor-", "");
|
var name = e.id.replace("editor-", "");
|
||||||
var editor = new LiveCodeEditor(e, {
|
var editor = new LiveCodeEditor(e, {
|
||||||
@@ -100,12 +90,12 @@
|
|||||||
livecodeEditors.push(editor);
|
livecodeEditors.push(editor);
|
||||||
livecodeEditorsMap[e.id] = editor;
|
livecodeEditorsMap[e.id] = editor;
|
||||||
|
|
||||||
$(e).find(".reset").on('click', function () {
|
$(e).find(".reset").on('click', function() {
|
||||||
let code = $(e).find(".reset-code").html();
|
let code = $(e).find(".reset-code").html();
|
||||||
editor.codemirror.doc.setValue(code);
|
editor.codemirror.doc.setValue(code);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(e).find(".submit").on('click', function () {
|
$(e).find(".submit").on('click', function() {
|
||||||
let code = editor.codemirror.doc.getValue();
|
let code = editor.codemirror.doc.getValue();
|
||||||
console.log("submit", name, code);
|
console.log("submit", name, code);
|
||||||
frappe.call("community.lms.api.submit_solution", {
|
frappe.call("community.lms.api.submit_solution", {
|
||||||
@@ -125,7 +115,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updateSubmitTimes() {
|
function updateSubmitTimes() {
|
||||||
$(".human-time").each(function (i, e) {
|
$(".human-time").each(function(i, e) {
|
||||||
var d = $(e).data().timestamp;
|
var d = $(e).data().timestamp;
|
||||||
$(e).html(__("Submitted {0}", [comment_when(d)]));
|
$(e).html(__("Submitted {0}", [comment_when(d)]));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user