mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 14:33:49 +01:00
- LSform :
-> LSform_layout : Utilisation des id plutot que title pour repérer les div et les li
This commit is contained in:
parent
6448f263be
commit
9ed7425d0c
3 changed files with 50 additions and 34 deletions
|
@ -54,6 +54,24 @@ var LSform = new Class({
|
|||
document.getElement('li.LSform_layout').getFirst('a').fireEvent('click');
|
||||
}
|
||||
},
|
||||
|
||||
getLayoutBtn: function(div) {
|
||||
var getName = new RegExp('LSform_layout_div_(.*)');
|
||||
var name = getName.exec(div.id);
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
return $('LSform_layout_btn_'+name[1]);
|
||||
},
|
||||
|
||||
getLayout: function(btn) {
|
||||
var getName = new RegExp('LSform_layout_btn_(.*)');
|
||||
var name = getName.exec(btn.id);
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
return $('LSform_layout_div_'+name[1]);
|
||||
},
|
||||
|
||||
onTabBtnClick: function(event,li) {
|
||||
if ($type(event)) {
|
||||
|
@ -62,37 +80,35 @@ var LSform = new Class({
|
|||
event.target.blur();
|
||||
}
|
||||
|
||||
if (this._currentTab!='default_value') {
|
||||
var oldLi = $$('li.LSform_layout[title='+this._currentTab+']');
|
||||
if ($type(oldLi)) {
|
||||
oldLi.removeClass('LSform_layout_current');
|
||||
if (this._currentTab!=li) {
|
||||
if (this._currentTab!='default_value') {
|
||||
this._currentTab.removeClass('LSform_layout_current');
|
||||
var oldDiv = this.getLayout(this._currentTab);
|
||||
if ($type(oldDiv)) {
|
||||
oldDiv.removeClass('LSform_layout_current');
|
||||
}
|
||||
}
|
||||
var oldDiv = $$('div.LSform_layout[title='+this._currentTab+']');
|
||||
if ($type(oldDiv)) {
|
||||
oldDiv.removeClass('LSform_layout_current');
|
||||
}
|
||||
}
|
||||
|
||||
this._currentTab = li.title;
|
||||
li.addClass('LSform_layout_current');
|
||||
var div = $$('div.LSform_layout[title='+this._currentTab+']');
|
||||
if ($type(div)) {
|
||||
div = div[0];
|
||||
div.addClass('LSform_layout_current');
|
||||
|
||||
// Focus
|
||||
var ul = div.getElement('ul.LSform');
|
||||
if ($type(ul)) {
|
||||
var el = ul.getElement('input');
|
||||
if (!$type(el)) {
|
||||
el = ul.getElement('textarea');
|
||||
}
|
||||
if (!$type(el)) {
|
||||
el = ul.getElement('select');
|
||||
}
|
||||
if ($type(el)) {
|
||||
if(el.type!='hidden') {
|
||||
el.focus();
|
||||
this._currentTab = li;
|
||||
li.addClass('LSform_layout_current');
|
||||
var div = this.getLayout(li);
|
||||
if ($type(div)) {
|
||||
div.addClass('LSform_layout_current');
|
||||
|
||||
// Focus
|
||||
var ul = div.getElement('ul.LSform');
|
||||
if ($type(ul)) {
|
||||
var el = ul.getElement('input');
|
||||
if (!$type(el)) {
|
||||
el = ul.getElement('textarea');
|
||||
}
|
||||
if (!$type(el)) {
|
||||
el = ul.getElement('select');
|
||||
}
|
||||
if ($type(el)) {
|
||||
if(el.type!='hidden') {
|
||||
el.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +217,7 @@ var LSform = new Class({
|
|||
|
||||
var layout = ul.getParent('div.LSform_layout_active');
|
||||
if ($type(layout)) {
|
||||
var li = document.getElement('li.LSform_layout[title='+layout.title+']');
|
||||
var li = getLayoutBtn(layout);
|
||||
if($type(li)) {
|
||||
li.addClass('LSform_layout_errors');
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- Tabs - Start Title -->
|
||||
<ul class='LSform_layout'>
|
||||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<li class='LSform_layout' title='{$tab_key}'><a href="#{$tab_key}">{$tab.label}</a></li>
|
||||
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{$tab.label}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<!-- Tabs - End Title -->
|
||||
|
@ -13,7 +13,7 @@
|
|||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<a name='{$tab_key}'></a>
|
||||
<h2 class='LSform_layout'>{$tab.label}</h2>
|
||||
<div class='LSform LSform_layout' title='{$tab_key}'>
|
||||
<div class='LSform LSform_layout' id='LSform_layout_div_{$tab_key}'>
|
||||
{if $LSformElement_image!='' && $tab.img==1}
|
||||
<div class='LSformElement_image{if $LSformElement_image_errors} LSformElement_image_errors{/if}'>
|
||||
{if $LSformElement_image_actions!='' && !$LSformElement_image_errors}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- Tabs - Start Title -->
|
||||
<ul class='LSform_layout'>
|
||||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<li class='LSform_layout' title='{$tab_key}'><a href="#{$tab_key}">{$tab.label}</a></li>
|
||||
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{$tab.label}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<!-- Tabs - End Title -->
|
||||
|
@ -13,7 +13,7 @@
|
|||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<a name='{$tab_key}'></a>
|
||||
<h2 class='LSform_layout'>{$tab.label}</h2>
|
||||
<div class='LSform LSform_layout' title='{$tab_key}'>
|
||||
<div class='LSform LSform_layout' id='LSform_layout_div_{$tab_key}'>
|
||||
|
||||
{if $LSformElement_image!='' && $tab.img==1}
|
||||
<div class='LSformElement_image'>
|
||||
|
|
Loading…
Reference in a new issue