refactor: my-account page

This commit is contained in:
Summayya 2021-12-23 23:04:52 +05:30
parent d1e229de2c
commit de39191624
2 changed files with 82 additions and 18 deletions

View file

@ -1,31 +1,94 @@
{% from "frappe/templates/includes/avatar_macro.html" import avatar %}
{% extends "templates/web.html" %}
{% block title %}{{ _("My Account") }}{% endblock %}
{% block header %}<h1>{{ _("My Account") }}</h1>{% endblock %}
{% block title %}
{{ _("My Account") }}
{% endblock %}
{% block header %}
<h3 class="my-account-header">{{_("My Account") }}</h3>
{% endblock %}
{% block page_content %}
<div class="row your-account-info d-none d-sm-block">
<div class="col-sm-4">
<ul class="list-unstyled">
<li><a href="/update-password">{{ _("Reset Password") }}</a></li>
<li><a href="/update-profile?name={{ user }}">{{ _("Edit Profile") }}</a></li>
<li><a href="/third_party_apps">{{ _("Manage Third Party Apps") }}</a></li>
{% if frappe.db.get_single_value("Website Settings", "show_account_deletion_link") %}
<li><a href="/request-for-account-deletion?new=1">{{ _("Request for Account Deletion") }}</a></li>
{% endif %}
</ul>
<div class="row account-info d-flex flex-column">
<div class="col d-flex justify-content-between align-items-center">
<div>
<span class="my-account-avatar">
{{avatar(current_user.name)}}
</span>
<span class="my-account-name ml-4">
{{current_user.full_name }}
</span>
</div>
<div>
<span class="my-account-item-link">
<a href="/update-profile?name={{ user }}">
<svg class="edit-profile-icon icon icon-md">
<use xlink:href="#icon-edit">
</use>
</svg>
<span class="item-link-text pl-2">
{{_("Edit Profile") }}
</span>
</a>
</span>
</div>
</div>
<div class="col d-flex justify-content-between align-items-center">
<span>
<div class="my-account-item">{{_("Reset Password") }}</div>
<div class="my-account-item-desc">{{_("Reset the password for your account") }}</div>
</span>
<span class="my-account-item-link">
<a href="/update-password">
<svg class="right-icon icon icon-md">
<use xlink:href="#icon-right">
</use>
</svg>
<span class="item-link-text">{{_("Reset Password") }}</span>
</a>
</span>
</div>
<div class="col d-flex justify-content-between align-items-center">
<span>
<div class="my-account-item">{{_("Manage third party apps") }}</div>
<div class="my-account-item-desc">{{_("To manage your authorized third party apps") }}</div>
</span>
<span class="my-account-item-link">
<a href="/third_party_apps">
<svg class="right-icon icon icon-md">
<use xlink:href="#icon-right">
</use>
</svg>
<span class="item-link-text">{{_("Manage your apps") }}</span>
</a>
</span>
</div>
{% if frappe.db.get_single_value("Website Settings", "show_account_deletion_link") %}
<div class="col d-flex justify-content-between align-items-center">
<span>
<div class="my-account-item">{{_("Request Account Deletion") }}</div>
<div class="my-account-item-desc">{{_("Send a request to delete your account") }}</div>
</span>
<span class="my-account-item-link">
<a href="/request-for-account-deletion?new=1">
<svg class="right-icon icon icon-md">
<use xlink:href="#icon-right">
</use>
</svg>
<span class="item-link-text">{{_("Delete Account") }}</span>
</a>
</span>
</div>
{% endif %}
</div>
<div class="row d-block d-sm-none">
<div class="col-12">
<div class="col-12 side-list">
<ul class="list-group">
{% for item in sidebar_items -%}
<a class="list-group-item" href="{{ item.route }}"
{% if item.target %}target="{{ item.target }}"{% endif %}>
{{ _(item.title or item.label) }}
</a>
{%- endfor %}
{%- endfor %}
</ul>
</div>
</div>
{% endblock %}
{% endblock %}

View file

@ -10,5 +10,6 @@ no_cache = 1
def get_context(context):
if frappe.session.user=='Guest':
frappe.throw(_("You need to be logged in to access this page"), frappe.PermissionError)
context.current_user = frappe.get_doc("User", frappe.session.user)
context.show_sidebar=True