Merge pull request #421 from pateljannat/tabs-url
This commit is contained in:
@@ -33,12 +33,19 @@
|
|||||||
{{ _("All Courses") }}
|
{{ _("All Courses") }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if show_creators_section %}
|
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<a class="btn btn-secondary btn-sm" href="/users"> {{ _("Visit Dashboard") }} </a>
|
{% if frappe.session.user %}
|
||||||
<a class="btn btn-secondary btn-sm ml-2" href="/courses/new-course"> {{ _("Create a Course") }} </a>
|
<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>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<ul class="nav lms-nav" id="courses-tab">
|
<ul class="nav lms-nav" id="courses-tab">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
frappe.ready(() => {
|
frappe.ready(() => {
|
||||||
generate_graph("New Signups");
|
generate_graph("New Signups");
|
||||||
generate_graph("Course Enrollments");
|
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);
|
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");
|
link_array.length && $(link_array[0]).addClass("active");
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
const save_role = (e) => {
|
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