Commit 26c4c31f authored by Liam's avatar Liam Committed by Robert Lyon

Bug #1482479: Combo boxes in custom layout creator should have better labels

behatnotneeded

Change-Id: I3b259bdca08eb70601e828450019c3ac8a7adbe9
parent bddbc2b1
......@@ -9,6 +9,8 @@
var newrow = $('#customrow_' + numrows).clone();
var currentncols = $('#customrow_' + numrows).find('#selectnumcolsrow_' + numrows).val();
var currentcollayout = $('#customrow_' + numrows).find('#selectcollayoutrow_' + numrows).val();
var labelValue = "<span class='sr-only'>" + get_string("Row", "view") + " " + (numrows + 1) + ": </span>" + get_string_ajax("numberofcolumns", "view");
var labelValue2 = "<span class='sr-only'>" + get_string("Row", "view") + " " + (numrows + 1) + ": </span>" + get_string_ajax('columnlayout', 'view');
newrow.find('.customrowtitle').html('<strong>' + get_string('rownr', 'view', numrows + 1) + '</strong>');
newrow.attr('id', 'customrow_' + (numrows + 1));
......@@ -16,18 +18,18 @@
newid = 'selectnumcolsrow_' + (numrows + 1);
newrow.find('#selectnumcolsrow_' + numrows).val(currentncols);
newrow.find('#selectnumcolsrow_' + numrows).attr('id', newid);
newrow.find('label[for="selectnumcolsrow_' + numrows + '"]').attr('for', newid);
newrow.find('label[for="selectnumcolsrow_' + numrows + '"]').attr('for', newid).html(labelValue);
newid = 'selectcollayoutrow_' + (numrows + 1);
newrow.find('#selectcollayoutrow_' + numrows).val(currentcollayout);
newrow.find('#selectcollayoutrow_' + numrows).attr('id', 'selectcollayoutrow_' + (numrows + 1));
newrow.find('label[for="selectcollayoutrow_' + numrows + '"]').attr('for', newid);
newrow.find('label[for="selectcollayoutrow_' + numrows + '"]').attr('for', newid).html(labelValue2);
if ((oldremovebutton = $(newrow).find('button')).length != 0) {
oldremovebutton.attr('class', 'pull-left btn btn-sm btn-default removecustomrow_' + (numrows + 1));
}
else {
// wanring: classes are modified above for any subsequent button instances
// warning: classes are modified above for any subsequent button instances
newrow.append('<button name="removerow" class="pull-left btn btn-sm btn-default removecustomrow_' + (numrows + 1) + '" onclick="CustomLayoutManager.customlayout_remove_row(\'' + pieformname + '\', this)"><span class="icon icon-lg icon-trash text-danger"></span><span class="hidden-xs pls"> ' + get_string('removethisrow', 'view') + '</span></button>');
}
$('#customrow_' + numrows).after(newrow);
......
......@@ -72,7 +72,7 @@ function pieform_element_layout(Pieform $form, $element) {
. '<div id="customrow_1" class="customrow form-group five-across multi-label clearfix" style="border-bottom: 0px !important;">'
. '<div class="customrowtitle pull-left field"><strong>' . get_string('Row', 'view') . ' 1</strong></div>'
. '<div class="pull-left field field-selectnumcols">'
. '<label for="selectnumcolsrow_1">' . get_string('numberofcolumns', 'view') . '</label>'
. '<label for="selectnumcolsrow_1"><span class="sr-only">' . get_string('Row', 'view') . ' 1: </span>' . get_string('numberofcolumns', 'view') . '</label>'
. '<select name="selectnumcols" id="selectnumcolsrow_1" class="selectnumcols input-sm" onchange="CustomLayoutManager.customlayout_change_numcolumns(\'' . $form->get_property('name') . '\', this)">';
foreach ($element['clnumcolumnsoptions'] as $value => $data) {
$output .= '<option value="' . $value . '" ' . (($element['clnumcolumnsdefault'] == $value)? 'selected="selected"' : '') . '>' . $data . '</option>';
......@@ -80,7 +80,7 @@ function pieform_element_layout(Pieform $form, $element) {
$output .= '</select></div>'
. '<div class="pull-left field">'
. '<label for="selectcollayoutrow_1">' . get_string('columnlayout', 'view') . '</label>'
. '<label for="selectcollayoutrow_1"><span class="sr-only">' . get_string('Row', 'view') . ' 1: </span>' . get_string('columnlayout', 'view') . '</label>'
. '<select name="selectcollayout" id="selectcollayoutrow_1" class="selectcollayout input-sm" onchange="CustomLayoutManager.customlayout_change_column_layout(\'' . $form->get_property('name') . '\')">';
foreach ($element['columnlayoutoptions'] as $value => $data) {
$numcols = count(explode('-', $data));
......
Markdown is supported
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