mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Tabs and JS plugin navigation (e.g. Preferences page) remember now the last active tab
This commit is contained in:
@@ -27,35 +27,6 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
$e_sub_cat = 'prefs';
|
$e_sub_cat = 'prefs';
|
||||||
e107::lan('core','mailout','admin');
|
e107::lan('core','mailout','admin');
|
||||||
|
|
||||||
//FIXME temporary fix - need universal solution.
|
|
||||||
e107::js('inline',"
|
|
||||||
$(document).ready(function()
|
|
||||||
{
|
|
||||||
var hash = document.location.hash;
|
|
||||||
if(hash)
|
|
||||||
{
|
|
||||||
$('.plugin-navigation a').each(function(index) {
|
|
||||||
var ot = $(this).attr('href');
|
|
||||||
$(ot).hide();
|
|
||||||
$(this).closest('li').removeClass('active');
|
|
||||||
$(this).switchClass( 'link-active', 'link', 0 );
|
|
||||||
});
|
|
||||||
var button = '#eplug-nav-' + hash.replace('#', '') + '-prev-nav';
|
|
||||||
$(hash).show();
|
|
||||||
$(button).switchClass('link', 'link-active', 30 );
|
|
||||||
$(button).closest('li').addClass('active');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#core-prefs-main').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
","jquery");
|
|
||||||
|
|
||||||
|
|
||||||
e107::js('inline',"
|
e107::js('inline',"
|
||||||
function disp(type)
|
function disp(type)
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,19 @@
|
|||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
|
// Change hash when a tab changes
|
||||||
|
$('.nav-tabs a').on('shown', function (event) {
|
||||||
|
var hash = event.target.href.toString().split('#')[1], form = $(event.target).parents('form')[0];
|
||||||
|
window.location.hash = '/' + hash;
|
||||||
|
if(form) {
|
||||||
|
$(form).attr('action', $(form).attr('action').split('#')[0] + '#/' + hash);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// tabs hash
|
||||||
|
if(/^#\/\w+/.test(window.location.hash)) {
|
||||||
|
var hash = window.location.hash.substr(2);
|
||||||
|
if(hash.match('^tab')) $('.nav-tabs a[href=#' + hash + ']').tab('show');
|
||||||
|
}
|
||||||
|
|
||||||
$('.e-typeahead').each(function() {
|
$('.e-typeahead').each(function() {
|
||||||
|
|
||||||
@@ -259,24 +273,31 @@ $(document).ready(function()
|
|||||||
// Admin Prefs Navigation
|
// Admin Prefs Navigation
|
||||||
|
|
||||||
$(".plugin-navigation a").click(function () {
|
$(".plugin-navigation a").click(function () {
|
||||||
|
|
||||||
// alert(document.location.hash);
|
|
||||||
|
|
||||||
$(".plugin-navigation a").each(function(index) {
|
$(".plugin-navigation a").each(function(index) {
|
||||||
var ot = $(this).attr("href");
|
var ot = $(this).attr("href");
|
||||||
$(ot).hide();
|
$(ot).hide().removeClass('e-hideme');
|
||||||
$(this).closest("li").removeClass("active");
|
$(this).closest("li").removeClass("active");
|
||||||
$(this).switchClass( "link-active", "link", 0 );
|
$(this).switchClass( "link-active", "link", 0 );
|
||||||
});
|
});
|
||||||
var id = $(this).attr("href");
|
var id = $(this).attr("href"), hash = id.substr(1), form = $('.admin-menu')[0]; // FIXME - a better way to detect the page form
|
||||||
$(this).switchClass( "link", "link-active", 30 );
|
$(this).switchClass( "link", "link-active", 30 );
|
||||||
$(this).closest("li").addClass("active");
|
$(this).closest("li").addClass("active");
|
||||||
$(id).show({
|
$(id).removeClass('e-hideme').show({
|
||||||
effect: "slide"
|
effect: "slide"
|
||||||
});
|
});
|
||||||
return false; //FIXME See admin/prefs navigation.
|
// 'remember' the active navigation pane
|
||||||
|
window.location.hash = 'nav-' + hash;
|
||||||
|
if(form) {
|
||||||
|
$(form).attr('action', $(form).attr('action').split('#')[0] + '#nav-' + hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; //FIXME See admin/prefs navigation.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// plugin navigation hash
|
||||||
|
if(/^#nav-+/.test(window.location.hash)) {
|
||||||
|
$("a[href='" + window.location.hash.replace('nav-', '') + "']").click();
|
||||||
|
}
|
||||||
|
|
||||||
// backend
|
// backend
|
||||||
$(".e-password").pwdMeter({
|
$(".e-password").pwdMeter({
|
||||||
@@ -558,9 +579,6 @@ $(document).ready(function()
|
|||||||
|
|
||||||
// Text-area AutoGrow
|
// Text-area AutoGrow
|
||||||
// $("textarea.e-autoheight").elastic();
|
// $("textarea.e-autoheight").elastic();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user