Fix reposition class

This commit is contained in:
Laurent Destailleur 2018-04-19 21:33:26 +02:00
parent 16e27a445b
commit 99feaf5275
2 changed files with 6 additions and 6 deletions

View File

@ -143,17 +143,17 @@ print '
/* Set handler to add page_y param on output (click on href links or submit button) */
jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop();
if (this.ref)
var page_y = $(document).scrollTop();
if (this.href)
{
this.href=this.href+\'&page_y=\'+page_y;
console.log("We click on tag with .reposition class. this.ref is now "+this.href);
this.href=this.href+\'&page_y=\'+page_y;
console.log("We click on tag with .reposition class. this.ref is now "+this.href);
}
else
{
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update form field page_y with value "+page_y);
jQuery("input[type=hidden][name=page_y]").val(page_y);
}
});
});
});'."\n";

View File

@ -113,7 +113,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
{
$fieldid='id';
if ($object->table_element == 'societe') $fieldid='socid';
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
}
print '</tr></table>';
$html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : '';