Commit 5921a29e authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #5279 Fixed the way icons column width is handled in OrderedArrayAttribute

parent e58a3f6d
......@@ -93,7 +93,7 @@ border-left: 1px solid #C0C2C3;
table.listingTable > tbody > tr td > input[type=image],
table.listingTable > tbody > tr td > img {
padding: 1px;
padding: 2px;
}
table.listingTable > tbody > tr td > a:link {
......
......@@ -93,7 +93,7 @@ border-left: 1px solid #AAA;
table.listingTable > tbody > tr td > input[type=image],
table.listingTable > tbody > tr td > img {
padding: 1px;
padding: 2px;
}
......
......@@ -127,7 +127,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute
protected function genRowIcons($key, $value)
{
$id = $this->getHtmlId();
list ($img, $width) = parent::genRowIcons($key, $value);
list ($img, $nbicons) = parent::genRowIcons($key, $value);
$img = $this->renderInputField(
'image', $id.'_restore_'.$key,
array(
......@@ -136,10 +136,10 @@ class SnapshotsAttribute extends OrderedArrayAttribute
'alt' => _('Restore'),
'class' => 'center'
)
).' '.$img;
$width += 15;
).$img;
$nbicons++;
return array ($img, $width);
return array ($img, $nbicons);
}
protected function handlePostValueActions($id, $postValue)
......
......@@ -434,9 +434,9 @@ class OrderedArrayAttribute extends SetAttribute
continue;
}
list ($img, $width) = $this->genRowIcons($key, $value);
list ($img, $nbicons) = $this->genRowIcons($key, $value);
$fields[] = array("html" => $img, "attach" => 'style="border:0px;width:'.$width.'px;"');
$fields[] = array("html" => $img, "attach" => 'style="border:0px;width:'.($nbicons * 20).'px;"');
$div->AddEntry($fields);
}
$smarty->assign("div_$id", $div->DrawList());
......@@ -448,10 +448,10 @@ class OrderedArrayAttribute extends SetAttribute
$id = $this->getHtmlId();
$img = '';
$width = 25;
$nbicons = 1;
if ($this->order) {
$width += 20;
$nbicons += 2;
if ($key != 0) {
$img .= $this->renderInputField(
'image', $id.'_up_'.$key,
......@@ -461,9 +461,9 @@ class OrderedArrayAttribute extends SetAttribute
'alt' => _('Sort up'),
'class' => 'center'
)
).' ';
);
} else {
$img .= '<img src="images/empty.png" alt="" style="width:10px;"/>';
$img .= '<img src="images/empty.png" alt="" style="width:16px;"/>';
}
if (($key + 1) < count($this->value)) {
$img .= $this->renderInputField(
......@@ -474,13 +474,13 @@ class OrderedArrayAttribute extends SetAttribute
'alt' => _('Sort down'),
'class' => 'center'
)
).'&nbsp;';
);
} else {
$img .= '<img src="images/empty.png" alt="" style="width:10px;"/>';
$img .= '<img src="images/empty.png" alt="" style="width:16px;"/>';
}
}
if ($this->edit_enabled) {
$width += 15;
$nbicons++;
$img .= $this->renderInputField(
'image', $id.'_edit_'.$key,
array(
......@@ -489,7 +489,7 @@ class OrderedArrayAttribute extends SetAttribute
'alt' => _('Edit'),
'class' => 'center'
)
).'&nbsp;';
);
}
$img .= $this->renderInputField(
'image', $id.'_del_'.$key,
......@@ -499,9 +499,9 @@ class OrderedArrayAttribute extends SetAttribute
'alt' => _('Delete'),
'class' => 'center'
)
).'&nbsp;';
);
return array ($img, $width);
return array ($img, $nbicons);
}
protected function getAttributeArrayValue($key, $value)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment