Commit fdcbd37f authored by Nigel McNie's avatar Nigel McNie
Browse files

A couple of fixes for the view interface:

 * Columns were not being added at the right place, due to incorrect column numbering. Bad smarty!
 * Given the interface is now largely done, we can remove one javascript hack to fix up the column class for the newly inserted column
 * When a column is added on the right hand side, the previous right button is now converted to be above the columns
parent 6a9bbf8a
......@@ -95,6 +95,13 @@ function ViewManager() {
removeElement(getFirstElementByTagAndClassName('div', 'add-column-left', 'column_2'));
}
// If we're adding a column to the very right, move the add button between the columns
if (id > numColumns) {
var rightColumnDiv = getFirstElementByTagAndClassName('div', 'add-column-right', 'column_' + numColumns);
removeElementClass(rightColumnDiv, 'add-column-right');
addElementClass(rightColumnDiv, 'add-column-center');
}
// Now we insert the new column into the DOM. Inserting the HTML into a
// new element and then into the DOM means we can add the new column
// without changing any of the existing DOM tree (and thus destroying
......@@ -108,14 +115,6 @@ function ViewManager() {
insertSiblingNodesAfter('column_' + (id - 1), tempDiv.firstChild);
}
// VERY TEMPORARY
// Currently with our hard coded data, the adding of a column doesn't
// really happen and so the new column is built thinking there are only
// the same number of columns in total as there were before adding a
// column. This munges the column class for us
removeElementClass('column_' + id, 'columns' + numColumns);
addElementClass('column_' + id, 'columns' + (numColumns + 1));
// Wire up the new column buttons to be AJAX
self.rewriteAddColumnButtons('column_' + id);
self.rewriteRemoveColumnButtons('column_' + id);
......
......@@ -10,11 +10,11 @@
</div>
{if $column == $numcolumns}
<div class="add-column-right">
<input type="submit" class="submit addcolumn" name="action_addcolumn_before_{$column + 1}" value="{str tag='addcolumn' section='view'}">
<input type="submit" class="submit addcolumn" name="action_addcolumn_before_{$column+1}" value="{str tag='addcolumn' section='view'}">
</div>
{else}
<div class="add-column-center">
<input type="submit" class="submit addcolumn" name="action_addcolumn_before_{$column + 1}" value="{str tag='addcolumn' section='view'}">
<input type="submit" class="submit addcolumn" name="action_addcolumn_before_{$column+1}" value="{str tag='addcolumn' section='view'}">
</div>
{/if}
</div>
......
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