Merge pull request #421 from pateljannat/tabs-url
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
frappe.ready(() => {
|
||||
generate_graph("New Signups");
|
||||
generate_graph("Course Enrollments");
|
||||
|
||||
$(".nav-link").click((e) => {
|
||||
change_hash(e);
|
||||
});
|
||||
|
||||
if (window.location.hash) {
|
||||
open_tab();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -40,3 +48,13 @@ 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();
|
||||
};
|
||||
|
||||
@@ -6,6 +6,14 @@ frappe.ready(() => {
|
||||
save_role(e);
|
||||
});
|
||||
|
||||
$(".nav-link").click((e) => {
|
||||
change_hash(e);
|
||||
});
|
||||
|
||||
if (window.location.hash) {
|
||||
open_tab();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +25,7 @@ const make_profile_active_in_navbar = () => {
|
||||
link_array.length && $(link_array[0]).addClass("active");
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const save_role = (e) => {
|
||||
@@ -39,4 +47,14 @@ const save_role = (e) => {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const change_hash = (e) => {
|
||||
window.location.hash = $(e.currentTarget).attr("href");
|
||||
};
|
||||
|
||||
|
||||
const open_tab = () => {
|
||||
$(`a[href="${window.location.hash}"]`).click();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user