Commit 579a170c authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Fix element attributes when creating custom layout (Bug #1486817)"

parents 261f1fde dc632ff8
......@@ -96,8 +96,8 @@
// clone and tweak
var clone = $('.advancedlayoutselect input[type=radio]:first').parent().clone();
var id = 'viewlayout_advancedlayoutselect' + unique_timestamp();
$('input', clone).attr('id', id);
$('input', clone).val(layoutid);
$('label', clone).attr('for', id).text(data.data.text);
$('input', clone).attr('id', id).val(layoutid);
$('svg', clone).replaceWith(data.data.layoutpreview);
//insert into appropriate row
......
......@@ -1209,7 +1209,12 @@ class View {
$structure['text'] = $alttext;
$layoutpreview = new LayoutPreviewImage($structure);
$preview = $layoutpreview->create_preview();
$data = array('layoutid' => $newlayoutid, 'newlayout' => 1, 'layoutpreview' => $preview);
$data = array(
'layoutid' => $newlayoutid,
'newlayout' => 1,
'layoutpreview' => $preview,
'text' => $structure['text']
);
return $data;
}
......
......@@ -73,10 +73,13 @@ foreach ($layoutrows as $key => $layout) {
$layoutoptions[$key]['rows'] = count($layout);
$structure = array();
$rowtext = array();
for ($r = 1; $r <= count($layout); $r++) {
$structure['layout']['row' . $r] = $layoutcolumns[$layout[$r]]->widths;
$widths = $layoutcolumns[$layout[$r]]->widths;
$structure['layout']['row' . $r] = $widths;
$rowtext[] = str_replace(',', '-', $widths);
}
$structure['text'] = implode(' / ', $structure['layout']);
$structure['text'] = implode(' / ', $rowtext);
$l = new LayoutPreviewImage($structure);
$layoutoptions[$key]['layout'] = $l->create_preview();
$layoutoptions[$key]['columns'] = $structure['text'];
......
......@@ -30,3 +30,19 @@ Scenario: Clicking ID's (Bug 1428456)
# Checking if we can delete a block
When I delete the block "Ulysses"
Then I should not see "Buck Mulligan"
# Checking if we can change page layout
When I follow "Edit layout"
And I follow "Create custom layout"
And I press "Add a row"
And I wait "1" seconds
And I select "25 - 50 - 25" from "selectcollayoutrow_2"
And I press "Add a row"
And I wait "1" seconds
And I select "5" from "selectnumcolsrow_3"
And I select "20 - 20 - 20 - 20 - 20" from "selectcollayoutrow_3"
And I press "Add a row"
And I press "Create new layout"
Then I should see "4 rows"
And I press "Save"
Then I should see "Page layout changed"
\ No newline at end of file
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