Merge branch 'main' of https://github.com/frappe/community into main

This commit is contained in:
pateljannat
2021-03-12 12:22:19 +05:30
15 changed files with 546 additions and 94 deletions

View File

@@ -1,4 +1,5 @@
{% extends "templates/base.html" %}
{% from "www/macros/livecode.html" import LiveCodeEditor with context %}
{% block title %}{{topic.title}} ({{course.title}}){% endblock %}
{% block head_include %}
<meta name="description" content="Topic {{topic.title}} of the course {{course.title}}" />
@@ -7,6 +8,7 @@
</style>
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/assets/css/lms.css">
<script src="{{ livecode_url }}/static/codemirror/lib/codemirror.js"></script>
<script src="{{ livecode_url }}/static/codemirror/mode/python/python.js"></script>
@@ -42,7 +44,7 @@
{% if s.type == "text" %}
{{ render_section_text(s) }}
{% elif s.type == "code" %}
{{ render_section_code(s) }}
{{ LiveCodeEditor(s.name, s.code) }}
{% else %}
<div>Unknown section type: {{s.type}}</div>
{% endif %}
@@ -52,28 +54,6 @@
{{ s.contents | markdown }}
{% endmacro %}
{% macro render_section_code(s) %}
<div class="canvas-editor row no-gutters" id="editor-{{s.name}}">
<div class="col-sm">
<div class="heading">
<button class="run">Run</button>
<h2>Editor</h2>
</div>
<textarea class="code">{{s.code}}</textarea>
</div>
<div class="col-sm">
<div class="heading">
<h2>Output</h2>
</div>
<div class="canvas-wrapper">
<canvas class="canvas" width="300" height="300">Dashed box</canvas>
<pre class="output"></pre>
</div>
</pre>
</div>
</div>
{% endmacro %}
{%- block script %}
{{ super() }}
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
@@ -89,73 +69,3 @@
})
</script>
{%- endblock %}
{%- block style %}
{{ super() }}
<style type="text/css">
.canvas-wrapper {
position: relative;
padding: 10px;
}
.canvas-editor canvas {
position: relative;
z-index: 0;
border: 1px solid #ddd;
height: 300px;
width: 300px;
}
.canvas-wrapper .output {
position: absolute;
z-index: 1;
width: 100%;
left: 0px;
top: 0px;
background-color: rgba(255, 255, 255, 0);
margin: 15px;
}
.canvas-editor .code {
width: 100%;
padding: 5px;
min-height: 330px;
resize: none;
}
.canvas-editor .output {
padding: 5px;
}
.heading {
background: #eee;
padding: 10px;
clear: both;
color: #212529;
border: 1px solid #ddd;
}
.canvas-editor h2 {
font-size: 1.2em;
text-transform: uppercase;
margin: 0px;
font-weight: normal;
}
.canvas-editor .run {
float: right;
}
.canvas-editor .col-sm {
border: 1px solid #ddd;
}
/* .canvas-editor canvas {
float: left;
border: 1px solid #ddd;
padding: 5px;
margin: 10px;
} */
</style>
{%- endblock %}