refactor: patches to fix data, profile dashboard, lms mentor mapping page fixes

This commit is contained in:
pateljannat
2021-05-21 21:40:31 +05:30
parent 637c795321
commit 713dcf178a
23 changed files with 314 additions and 386 deletions

View File

@@ -4,130 +4,101 @@
<meta name="description" content="{{ 'Community' }}" />
<meta name="keywords" content="An app that supports Communities." />
<style>
section {
padding: 2rem;
color: #000000;
}
section {
padding: 2rem;
color: #000000;
}
svg {
width: 200px;
height: 200px;
}
svg {
width: 200px;
height: 200px;
}
.dashboard__profile {
width: 150px;
height: 155px;
border-radius: 50%;
object-fit: contain;
}
.dashboard__parent {
display: flex;
}
.dashboard__profileSmall {
width: 59px;
height: 57px;
border-radius: 50%;
object-fit: contain;
}
.dashboard__name {
font-weight: normal;
font-style: normal;
font-size: 36px;
line-height: 42px;
}
.dashboard__abbr {
font-size: 50px;
width: 155px;
height: 155px;
border-radius: 50%;
}
.dashboard__details {
padding-top: 2rem;
}
.dashboard__abbrSmall {
font-size: 20px;
width: 59px;
height: 57px;
border-radius: 50%;
}
.dashboard__course {
border: 1px solid black;
padding: 1rem;
margin: 0.5rem;
width: 48%;
}
.dashboard__courseHeader {
display: flex;
justify-content: space-between;
height: 50px;
margin-bottom: 3px;
}
.dashboard__badge {
background: #D6D6FF;
border-radius: 20px;
color: #1712FE;
padding: 0.5rem;
height: fit-content;
}
.dashboard__description {
height: 100px;
}
@media (max-width: 900px) {
.dashboard__parent {
display: flex;
flex-direction: column;
}
.dashboard__name {
font-weight: normal;
font-style: normal;
font-size: 36px;
line-height: 42px;
}
.dashboard__details {
padding-top: 2rem;
}
.dashboard__course {
border: 1px solid black;
padding: 1rem;
margin: 0.5rem;
width: 48%;
}
.dashboard__courseHeader {
display: flex;
justify-content: space-between;
height: 50px;
margin-bottom: 3px;
}
.dashboard__badge {
background: #D6D6FF;
border-radius: 20px;
color: #1712FE;
padding: 0.5rem;
height: fit-content;
}
.dashboard__description {
height: 100px;
}
@media (max-width: 900px) {
.dashboard__parent {
flex-direction: column;
}
}
}
</style>
{% endblock %}
{% block page_content %}
<div class="dashboard__parent">
<div class="dashboard__photo">
{{ widgets.Avatar(member=member, avatar_class="avatar-medium") }} <a href="/{{member.username}}">{{ member.full_name }}</a>
</div>
<div class="dashboard__details">
<div class="dashboard__name">
{{member.full_name}}
</div>
<div>
<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="#home" role="tab"
aria-controls="home" aria-selected="true">Sketches</a>
</li>
</ul>
</div>
<div>
<div class="tab-content">
<div class="tab-pane fade py-4 show active" role="tabpanel" id="home">
<div class="row">
{% if sketches %}
{% for sketch in sketches %}
<div class="col-md-4 col-sm-6">
{{ widgets.SketchTeaser(sketch=sketch) }}
</div>
{% endfor %}
{% endif %}
</div>
{% if not sketches %}
<p class="text-center">{{member.full_name}} has not created any skecth yet.</p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="dashboard__parent">
<div class="dashboard__photo mr-5">
{{ widgets.Avatar(member=member, avatar_class="avatar-xl") }}
</div>
<div class="dashboard__details">
<div class="dashboard__name">
<a class="anchor_style" href="/{{member.username}}">{{ member.full_name }}</a>
</div>
<div>
<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="#home" role="tab" aria-controls="home"
aria-selected="true">Sketches</a>
</li>
</ul>
</div>
<div>
<div class="tab-content">
<div class="tab-pane fade py-4 show active" role="tabpanel" id="home">
<div class="row">
{% if sketches %}
{% for sketch in sketches %}
<div class="col-md-4 col-sm-6">
{{ widgets.SketchTeaser(sketch=sketch) }}
</div>
{% endfor %}
{% endif %}
</div>
{% if not sketches %}
<p class="text-center">{{member.full_name}} has not created any skecth yet.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
<!-- this is a sample default web page template -->

View File

@@ -3,15 +3,9 @@ from community.lms.models import Sketch
def get_context(context):
context.no_cache = 1
context.username = frappe.form_dict["username"]
context.member = get_member(context.username)
if not context.member:
try:
context.member = frappe.get_doc("User", {"username": frappe.form_dict["username"]})
except:
context.template = "www/404.html"
else:
context.sketches = Sketch.get_recent_sketches(owner=context.member.email)
def get_member(username):
try:
return frappe.get_doc("Community Member", {"username":username})
except frappe.DoesNotExistError:
return