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

@@ -28,7 +28,8 @@
{
"fieldname": "description",
"fieldtype": "Markdown Editor",
"label": "Description"
"label": "Description",
"reqd": 1
},
{
"default": "0",
@@ -57,7 +58,8 @@
{
"fieldname": "short_introduction",
"fieldtype": "Small Text",
"label": "Short Introduction"
"label": "Short Introduction",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
@@ -84,7 +86,7 @@
"link_fieldname": "course"
}
],
"modified": "2021-05-06 13:37:03.318829",
"modified": "2021-05-23 18:14:32.602647",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",

View File

@@ -0,0 +1,28 @@
<ul class="nav nav-tabs mt-4" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/learn"
role="tab" aria-controls="home" aria-selected="true">Learn</a>
</li>
<li class="nav-item">
<a class="nav-link" id="schedule-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/schedule"
role="tab" aria-controls="schedule" aria-selected="false">Schedule</a>
</li>
<li class="nav-item">
<a class="nav-link" id="members-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/members"
role="tab" aria-controls="members" aria-selected="false">Members</a>
</li>
<li class="nav-item">
<a class="nav-link" id="discussion-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/discuss"
role="tab" aria-controls="discussion" aria-selected="false">Discussion</a>
</li>
<li class="nav-item">
<a class="nav-link" id="about-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/about" role="tab"
aria-controls="about" aria-selected="false">About</a>
</li>
{% if batch.is_member(frappe.session.user, member_type="Mentor") %}
<li class="nav-item">
<a class="nav-link" id="progress-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/progress"
role="tab" aria-controls="progress" aria-selected="false">Progress</a>
</li>
{% endif %}
</ul>

View File

@@ -1,6 +1,6 @@
<div class="chapter-teaser">
<div class="teaser-body">
<h3 class="chapter-title"><span class="chapter-number">{{index}}</span> {{ chapter.title }}</h3>
<h3 class="chapter-title"><span class="mr-1">{{index}}.</span> {{ chapter.title }}</h3>
<div class="chapter-description">
{{ chapter.description or "" }}
</div>

View File

@@ -97,14 +97,6 @@ body {
border-top: 1px solid #ddc;
}
.batch .cta button {
background: var(--cta-color);
color: white;
border: none;
border-radius: 5px;
padding: 5px 10px;
}
.batch .right {
float: right;
}
@@ -227,6 +219,14 @@ img.profile-photo {
}
.anchor_style {
color: inherit;
}
a:hover {
text-decoration: none;
color: inherit;
}
section {
padding: 5rem 0 5rem 0;
}

View File

@@ -179,11 +179,8 @@ section.lightgray {
.chapter-number {
background: var(--text-color);
color: white;
border-radius: 50%;
height: 24px;
min-width: 24px;
align-items: center;
padding: 5px 8px 2px 8px;
margin-right: 5px;
}

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,12 +10,13 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch) }}
<div class="container">
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
{{ CourseBasicDetail(course)}}
{{ InstructorsSection(course.get_instructor()) }}
{{ BatchDetails(batch)}}
</div>
</div>
{% endblock %}
@@ -43,7 +43,8 @@
<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>
{{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>

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,9 +10,10 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="">
<div class="">
<div class="batch-header">
{{ BatchHearder(course.title, member_count) }}
</div>
@@ -23,6 +23,7 @@
</div>
{{ TextArea() }}
</div>
</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,9 +22,10 @@
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
<div class="container">
<div class="lesson-page">
{{ pagination(prev_url, next_url) }}
@@ -38,38 +38,38 @@
{% endfor %}
{{ pagination(prev_url, next_url) }}
</div>
</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="row">
<div class="col-md-9">
{{ frappe.utils.md_to_html(s.contents) }}
</div>
</div>
</div>
{% endmacro %}
{% macro pagination(prev_url, next_url) %}
<div class="lesson-pagination">
<div class="lesson-pagination">
{% if prev_url %}
<a href="{{prev_url}}" class="btn">&larr; Prev</a>
{% endif %}
@@ -77,15 +77,15 @@
<a href="{{next_url}}" class="btn pull-right">Next &rarr;</a>
{% endif %}
<div style="clear: both;"></div>
</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">
<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 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,9 +22,10 @@
{% block content %}
{{ Sidebar(course, batch) }}
<div>
{{ widgets.BatchTabs(course=course, batch=batch) }}
<div class="container">
<div class="container">
<div class="mentor-dashboard">
<h1>Batch Progress</h1>
{% for exercise in report.exercises %}
@@ -42,11 +42,12 @@
</div>
{% 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 %}

View File

@@ -9,7 +9,9 @@
{% block content %}
<div class="container">
<div class="course-header">
<div class="course-type">course</div>
<div class="mb-5">
<a class="font-weight-bold anchor_style" href="/courses">Courses</a> / <span class="text-muted">{{ course.title }}</span>
</div>
<h1 id="course-title" data-course="{{course.name}}">{{course.title}}</h1>
<div class="course-short-intro">{{ course.short_introduction }}</div>
</div>
@@ -88,7 +90,7 @@
{% if can_manage %}
<a href="/courses/{{course.name}}/{{batch.name}}/about" class="btn btn-secondary">Manage</a>
{% else %}
<button class="join-batch" data-batch="{{ batch.name | urlencode }}"
<button class="join-batch btn btn-primary" data-batch="{{ batch.name | urlencode }}"
data-course="{{ course.name | urlencode }}">Join this Batch</button>
{% endif %}
</div>

View File

@@ -1,10 +1,11 @@
{% extends "templates/base.html" %}
{% from "www/hackathons/macros/card.html" import null_card %}
{% block title %}{{ 'Courses' }}{% endblock %}
{% block head_include %}
<meta name="description" content="{{ 'Courses' }}" />
<meta name="keywords" content="Courses" />
<style>
</style>
<meta name="description" content="{{ 'Courses' }}" />
<meta name="keywords" content="Courses" />
<style>
</style>
{% endblock %}
{% block content %}
@@ -17,6 +18,11 @@
{% for course in courses %}
{{ course_card(course) }}
{% endfor %}
{% if courses %}
{% for n in range( (3 - (courses|length)) %3) %}
{{ null_card() }}
{% endfor %}
{% endif %}
</div>
</div>
</section>
@@ -24,13 +30,16 @@
{% macro course_card(course) %}
<div class="card mb-5 w-100">
<div class="card-body">
<h5 class="card-title"><a href="/courses/{{course.name}}">{{course.title}}</a></h5>
<div class="col-sm-4 mb-4 text-left">
<a class="anchor_style" href="/courses/{{course.name}}">
<div class="card h-100">
<div class='card-body'>
<h5 class='card-title'>{{ course.title }}</h5>
{% if course.description %}
<p class="card-text">{{ frappe.utils.md_to_html(course.description[:250]) }}</p>
{{ frappe.utils.md_to_html(course.description[:250]) }}
{% endif %}
<a href="/courses/{{course.name}}" class="card-link">See more &rarr;</a>
</div>
</div>
</a>
</div>
{% endmacro %}

View File

@@ -1,14 +1,30 @@
{% macro Sidebar(course, batch, is_mentor=False) %}
<div class="sidebar-batch">
<a href=""><i class="fa fa-bars fa-lg"></i></a>
<br>
<a href="/courses/{{course.name}}/{{batch.name}}/learn"><i class="fa fa-book fa-lg"></i></a>
<a href="/courses/{{course.name}}/{{batch.name}}/schedule"><i class="fa fa-calendar fa-lg"></i></a>
<a href="/courses/{{course.name}}/{{batch.name}}/members"><i class="fa fa-users fa-lg"></i></a>
<a href="/courses/{{course.name}}/{{batch.name}}/discuss"><i class="fa fa-comments fa-lg"></i></a>
<a href="/courses/{{course.name}}/{{batch.name}}/about"><i class="fa fa-info-circle fa-lg"></i></a>
{% macro BatchTabs(course, batch, is_mentor=False) %}
<ul class="nav nav-tabs mt-4" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/learn"
role="tab" aria-controls="home" aria-selected="true">Learn</a>
</li>
<li class="nav-item">
<a class="nav-link" id="schedule-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/schedule"
role="tab" aria-controls="schedule" aria-selected="false">Schedule</a>
</li>
<li class="nav-item">
<a class="nav-link" id="members-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/members"
role="tab" aria-controls="members" aria-selected="false">Members</a>
</li>
<li class="nav-item">
<a class="nav-link" id="discussion-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/discuss"
role="tab" aria-controls="discussion" aria-selected="false">Discussion</a>
</li>
<li class="nav-item">
<a class="nav-link" id="about-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/about" role="tab"
aria-controls="about" aria-selected="false">About</a>
</li>
{% if batch.is_member(frappe.session.user, member_type="Mentor") %}
<a href="/courses/{{course.name}}/{{batch.name}}/progress"><i class="fa fa-flag-checkered fa-lg"></i></a>
<li class="nav-item">
<a class="nav-link" id="progress-tab" data-toggle="tab" href="/courses/{{course.name}}/{{batch.name}}/progress"
role="tab" aria-controls="progress" aria-selected="false">Progress</a>
</li>
{% endif %}
</div>
</ul>
{% endmacro %}