mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-19 06:53:53 +01:00
LSform: fix preserving current tab on actions links click
This commit is contained in:
parent
49656cd6f6
commit
bfd60b28c6
1 changed files with 13 additions and 12 deletions
|
@ -3,7 +3,6 @@ var LSform = new Class({
|
||||||
this._modules=[];
|
this._modules=[];
|
||||||
this._fields=[];
|
this._fields=[];
|
||||||
this._elements=[];
|
this._elements=[];
|
||||||
this._tabBtns=[];
|
|
||||||
this.listeners = {
|
this.listeners = {
|
||||||
init: new Array(),
|
init: new Array(),
|
||||||
submit: new Array()
|
submit: new Array()
|
||||||
|
@ -86,26 +85,28 @@ var LSform = new Class({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
li.getFirst('a').addEvent('click',this.onTabBtnClick.bindWithEvent(this,li));
|
li.getFirst('a').addEvent('click',this.onTabBtnClick.bindWithEvent(this,li));
|
||||||
},this);
|
},this);
|
||||||
|
|
||||||
$$('li.LSform_layout a').each(function(a) {
|
|
||||||
this._tabBtns[a.href]=a;
|
|
||||||
},this);
|
|
||||||
|
|
||||||
if (LIs.length != 0) {
|
if (LIs.length != 0) {
|
||||||
if ($type(this._tabBtns[window.location])) {
|
var defaut_on_first = true;
|
||||||
this._currentTab = 'default_value';
|
this._currentTab = 'default_value';
|
||||||
this._tabBtns[window.location].fireEvent('click');
|
if (window.location.hash) {
|
||||||
byDefault=0;
|
var li = $('LSform_layout_btn_'+window.location.hash.substr(1));
|
||||||
|
if (li) {
|
||||||
|
defaut_on_first = false;
|
||||||
|
li.getFirst('a').fireEvent('click');
|
||||||
|
// Scroll on top of the page
|
||||||
|
window.scroll(0, 0);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
this._currentTab = 'default_value';
|
if (defaut_on_first) {
|
||||||
document.getElement('li.LSform_layout').getFirst('a').fireEvent('click');
|
document.getElement('li.LSform_layout').getFirst('a').fireEvent('click');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkUrl = new RegExp('^(modify|create|view).php');
|
var checkUrl = new RegExp('^object/[^/]+/(create|[^/]+(%3D|=)[^/]+(/modify)?)$');
|
||||||
document.getElements('a.LSview-actions').each(function(a) {
|
document.getElements('a.LSview-actions').each(function(a) {
|
||||||
if (checkUrl.exec(a.get('href'))) {
|
if (checkUrl.exec(a.get('href'))) {
|
||||||
a.addEvent('click',this.onActionBtnClick.bindWithEvent(this,a));
|
a.addEvent('click',this.onActionBtnClick.bindWithEvent(this,a));
|
||||||
|
|
Loading…
Reference in a new issue