fix: pre commit in profile

This commit is contained in:
Jannat Patel
2022-11-04 11:49:25 +05:30
3 changed files with 43 additions and 4 deletions

View File

@@ -33,12 +33,19 @@
{{ _("All Courses") }}
</div>
{% if show_creators_section %}
<div class="pull-right">
<a class="btn btn-secondary btn-sm" href="/users"> {{ _("Visit Dashboard") }} </a>
<a class="btn btn-secondary btn-sm ml-2" href="/courses/new-course"> {{ _("Create a Course") }} </a>
{% if frappe.session.user %}
<a class="btn btn-secondary btn-sm" href="/users">
{{ _("Visit Dashboard") }}
</a>
{% endif %}
{% if show_creators_section %}
<a class="btn btn-secondary btn-sm ml-2" href="/courses/new-course">
{{ _("Create a Course") }}
</a>
{% endif %}
</div>
{% endif %}
<ul class="nav lms-nav" id="courses-tab">
<li class="nav-item">

View File

@@ -1,6 +1,14 @@
frappe.ready(() => {
generate_graph("New Signups");
generate_graph("Course Enrollments");
$(".nav-link").click((e) => {
change_hash(e);
});
if (window.location.hash) {
open_tab();
}
});
const generate_graph = (chart_name) => {
@@ -40,3 +48,11 @@ const render_chart = (data, chart_name) => {
},
});
};
const change_hash = (e) => {
window.location.hash = $(e.currentTarget).attr("href");
};
const open_tab = () => {
$(`a[href="${window.location.hash}"]`).click();
};

View File

@@ -4,6 +4,14 @@ frappe.ready(() => {
$(".role").change((e) => {
save_role(e);
});
$(".nav-link").click((e) => {
change_hash(e);
});
if (window.location.hash) {
open_tab();
}
});
const make_profile_active_in_navbar = () => {
@@ -38,3 +46,11 @@ const save_role = (e) => {
},
});
};
const change_hash = (e) => {
window.location.hash = $(e.currentTarget).attr("href");
};
const open_tab = () => {
$(`a[href="${window.location.hash}"]`).click();
};