refactor: course and sidebar cleanup

This commit is contained in:
pateljannat
2021-05-24 10:28:02 +05:30
parent 419a7e666f
commit 631275e9a8
15 changed files with 207 additions and 144 deletions

View File

@@ -1,5 +1,4 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/common_macro.html" import InstructorsSection, MentorsSection %}
{% block title %}About{% endblock %}
@@ -11,25 +10,26 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch) }}
<div class="container">
{{ CourseBasicDetail(course)}}
{{ InstructorsSection(course.get_instructor()) }}
{{ BatchDetails(batch)}}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
{{ CourseBasicDetail(course)}}
{{ InstructorsSection(course.get_instructor()) }}
{{ BatchDetails(batch)}}
</div>
</div>
{% endblock %}
{% macro CourseBasicDetail(course) %}
<h2>{{course.title}}</h2>
<div class="course-description">
{{course.short_introduction}}
{{course.short_introduction}}
</div>
{% if course.video_link %}
<div class="preview-video">
<iframe width="560" height="315" src="{{course.video_link}}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
<iframe width="560" height="315" src="{{course.video_link}}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
{% endif %}
<h2>About the Course</h2>
@@ -41,18 +41,19 @@
<div class="batch">
<div class="batch-details">
<div>Session every {{batch.sessions_on}}</div>
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
{{frappe.utils.format_time(batch.end_time, "short")}}</div>
<div>Starting {{frappe.utils.format_date(batch.start_date, "medium")}}</div>
<div class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
<div>Session every {{batch.sessions_on}}</div>
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
{{frappe.utils.format_time(batch.end_time, "short")}}
</div>
<div>Starting {{frappe.utils.format_date(batch.start_date, "medium")}}</div>
<div class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
{% for m in batch.get_mentors() %}
{% for m in batch.get_mentors() %}
<div>
{{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }}
<span class="instructor-title">{{m.full_name}}</span>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% endmacro %}

View File

@@ -1,5 +1,4 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/common_macro.html" import BatchHearder %}
{% block title %}Discuss{% endblock %}
@@ -11,17 +10,19 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="">
<div class="batch-header">
{{ BatchHearder(course.title, member_count) }}
</div>
<div class="messages">
<div class="message-section">
{{ Messages(messages) }}
<div class="">
<div class="batch-header">
{{ BatchHearder(course.title, member_count) }}
</div>
<div class="messages">
<div class="message-section">
{{ Messages(messages) }}
</div>
{{ TextArea() }}
</div>
{{ TextArea() }}
</div>
</div>
{% endblock %}

View File

@@ -1,13 +1,12 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %}
{% block title %}{{ lesson.title }}{% endblock %}
{% block head_include %}
<meta name="description" content="{{lesson.title}} - {{course.title}}" />
<meta name="keywords" content="{{lesson.title}} - {{course.title}}" />
<style>
</style>
<meta name="description" content="{{lesson.title}} - {{course.title}}" />
<meta name="keywords" content="{{lesson.title}} - {{course.title}}" />
<style>
</style>
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
@@ -23,69 +22,70 @@
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
<div class="lesson-page">
{{ pagination(prev_url, next_url) }}
<div class="container">
<div class="lesson-page">
{{ pagination(prev_url, next_url) }}
<h2>{{ lesson.title }}</h2>
<h2>{{ lesson.title }}</h2>
{% for s in lesson.get_sections() %}
<div class="section section-{{ s.type }}">
{{ render_section(s) }}
{% for s in lesson.get_sections() %}
<div class="section section-{{ s.type }}">
{{ render_section(s) }}
</div>
{% endfor %}
{{ pagination(prev_url, next_url) }}
</div>
{% endfor %}
{{ pagination(prev_url, next_url) }}
</div>
</div>
{% endblock %}
{% macro render_section(s) %}
{% if s.type == "text" %}
{{ render_section_text(s) }}
{% elif s.type == "example" or s.type == "code" %}
{{ LiveCodeEditor(s.name,
{% if s.type == "text" %}
{{ render_section_text(s) }}
{% elif s.type == "example" or s.type == "code" %}
{{ LiveCodeEditor(s.name,
code=s.get_latest_code_for_user(),
reset_code=s.contents,
is_exercise=False)
}}
{% elif s.type == "exercise" %}
{{ widgets.Exercise(exercise=s.get_exercise())}}
{% else %}
<div>Unknown section type: {{s.type}}</div>
{% endif %}
{% elif s.type == "exercise" %}
{{ widgets.Exercise(exercise=s.get_exercise())}}
{% else %}
<div>Unknown section type: {{s.type}}</div>
{% endif %}
{% endmacro %}
{% macro render_section_text(s) %}
<div class="row">
<div class="col-md-9">
{{ frappe.utils.md_to_html(s.contents) }}
</div>
<div class="row">
<div class="col-md-9">
{{ frappe.utils.md_to_html(s.contents) }}
</div>
</div>
{% endmacro %}
{% macro pagination(prev_url, next_url) %}
<div class="lesson-pagination">
{% if prev_url %}
<a href="{{prev_url}}" class="btn">&larr; Prev</a>
{% endif %}
{% if next_url %}
<a href="{{next_url}}" class="btn pull-right">Next &rarr;</a>
{% endif %}
<div style="clear: both;"></div>
</div>
<div class="lesson-pagination">
{% if prev_url %}
<a href="{{prev_url}}" class="btn">&larr; Prev</a>
{% endif %}
{% if next_url %}
<a href="{{next_url}}" class="btn pull-right">Next &rarr;</a>
{% endif %}
<div style="clear: both;"></div>
</div>
{% endmacro %}
{%- block script %}
{{ super() }}
{{ LiveCodeEditorJS() }}
{{ super() }}
{{ LiveCodeEditorJS() }}
<!-- <script type="text/javascript">
<!-- <script type="text/javascript">
$(function() {
var editorLookup = {};

View File

@@ -1,5 +1,4 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/common_macro.html" import BatchHearder %}
{% block title %}Members{% endblock %}
@@ -10,11 +9,13 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
{{ BatchHearder(course.title, member_count)}}
{{ MembersList(members)}}
<div class="container">
{{ BatchHearder(course.title, member_count)}}
{{ MembersList(members)}}
</div>
</div>
{% endblock %}

View File

@@ -1,13 +1,12 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %}
{% block title %}{{ course.title }} - Batch Dashboard{% endblock %}
{% block title %}{{ course.title }} - Batch Dashboard{% endblock %}
{% block head_include %}
<meta name="description" content="{{course.title}} - Batch Dashboard" />
<meta name="keywords" content="{{course.title}} - Batch Dashboard" />
<style>
</style>
<meta name="description" content="{{course.title}} - Batch Dashboard" />
<meta name="keywords" content="{{course.title}} - Batch Dashboard" />
<style>
</style>
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
@@ -23,30 +22,32 @@
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
<div class="mentor-dashboard">
<h1>Batch Progress</h1>
{% for exercise in report.exercises %}
<div class="container">
<div class="mentor-dashboard">
<h1>Batch Progress</h1>
{% for exercise in report.exercises %}
<div class="exercise-submissions">
<h2>{{exercise.title}}</h2>
{% for s in report.get_submissions_of_exercise(exercise.name) %}
<div class="submission">
<h4><a href="/{{s.owner.username}}">{{s.owner.full_name}}</a></h4>
<div class="livecode-editor-small">
{{ LiveCodeEditor(name=s.name, code=s.solution, reset_code=s.solution) }}
</div>
<div class="submission">
<h4><a href="/{{s.owner.username}}">{{s.owner.full_name}}</a></h4>
<div class="livecode-editor-small">
{{ LiveCodeEditor(name=s.name, code=s.solution, reset_code=s.solution) }}
</div>
</div>
{% endfor %}
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
{% endblock %}
{%- block script %}
{{ super() }}
{{ LiveCodeEditorJS() }}
{{ super() }}
{{ LiveCodeEditorJS() }}
{% endblock %}

View File

@@ -1,6 +1,6 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% block title %}Schedule{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
@@ -8,7 +8,12 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch) }}
<div class="container">
<div>
{{ widgetsBatchTabs(course=course, batch=batch) }}
<div class="container">
<h3>
Schedule
</h3>
</div>
</div>
{% endblock %}