Skip to content

Commit

Permalink
fix width of deploy package retchecks (fusioninventory#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh authored and trasher committed Jul 12, 2017
1 parent 2dad5a9 commit beab01c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 33 deletions.
3 changes: 0 additions & 3 deletions css/deploy.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ table.package_item input[type=text] {
table.package_item .table_retchecks {
border-spacing: 0;
}
table.package_item .table_retchecks td {
padding: 0;
}
table.package_item .table_retchecks input {
width: 65px;
}
Expand Down
19 changes: 8 additions & 11 deletions inc/deployaction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ static function displayAjaxValues($config, $request_data, $mode) {
echo "<tr>";
echo "<td>";
Dropdown::showFromArray('retchecks_type[]', self::getReturnActionNames(), array(
'value' => $retcheck['type']
'value' => $retcheck['type'],
'width' => '200px'
));
echo "</td>";
echo "<td>";
Expand All @@ -480,17 +481,13 @@ static function displayAjaxValues($config, $request_data, $mode) {
echo "</table>";
}
}
echo "<table class='table_retchecks template' style='display:none'>";
echo "<tr>";
echo "<td>";
Dropdown::showFromArray('retchecks_type[]', self::getReturnActionNames());
echo "</td>";
echo "<td><input type='text' name='retchecks_value[]' /></td>";
echo "<td><a class='edit' onclick='removeLine(this)'><img src='".
$CFG_GLPI["root_doc"]."/pics/delete.png' /></a></td>";
echo "</tr>";
echo "<div class='table_retchecks template' style='display:none'>";
Dropdown::showFromArray('retchecks_type[]', self::getReturnActionNames(), ['width' => '200px']);
echo "<input type='text' name='retchecks_value[]' />";
echo "<a class='edit' onclick='removeLine(this)'><img src='".
$CFG_GLPI["root_doc"]."/pics/delete.png' /></a>";
echo "</div>";

echo "</table>";
echo "</span>";
echo "</td>";
echo "</tr>";
Expand Down
34 changes: 16 additions & 18 deletions lib/plusbutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ function plusbutton(dom_id, template) {

// append a clone of the selected template class under the selected dom_id
if (template != null) {
// get old width before destroy
var old_width = $(template)
.find('.select2-container')
.css('width');

/**
* Since GLPI 0.85, select tag are wrapped with the jQuery plugin select2 and the cloned
* select doesn't respond if they are cloned with the select2 DOM mutations.
Expand All @@ -20,31 +25,24 @@ function plusbutton(dom_id, template) {
* http://stackoverflow.com/questions/17175534/clonned-select2-is-not-responding
* http://jsfiddle.net/ZzgTG/
*/
//var root=document.getElementById(dom_id);
//if (root.style.display == 'block') {
// var clone=root.getElementsByTagName(clone_tag)[0].cloneNode(true);
// root.appendChild(clone);
// clone.style.display = 'block';
//}
$(template)
.find('select')
.select2('destroy');

$('#' + dom_id)
.append(
$(template)
.clone()
.removeClass('template').css('display', 'block')
)
$('#' + dom_id).children('.table_retchecks').not('.template').find('select').select2()
$(template)
$(template)
.clone()
.removeClass('template')
.css('display', 'block')
);

// re-enable all select
$('#' + dom_id)
.find('select')
.select2();
.select2({
'width': old_width
});
}
//show block associated to plus button
//$(dom_id).css('display','block');

//remove all border to previous selected item (remove classes)
//$('table.package_item_list tr.selected ').removeClass('selected');
}

2 changes: 1 addition & 1 deletion lib/plusbutton.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit beab01c

Please sign in to comment.