Merge pull request #870 from ajshort/pull-1

BUG: Fix add new button not passing the correct parent ID.
This commit is contained in:
Simon Welsh 2013-10-09 19:26:51 -07:00
commit 095c78426b
3 changed files with 12 additions and 4 deletions

View File

@ -202,10 +202,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $link;
}
public function LinkPageAdd($extraArguments = null) {
public function LinkPageAdd($extra = null, $placeholders = null) {
$link = singleton("CMSPageAddController")->Link();
$this->extend('updateLinkPageAdd', $link);
if($extraArguments) $link = Controller::join_links ($link, $extraArguments);
if($extra) {
$link = Controller::join_links ($link, $extra);
}
if($placeholders) {
$link .= (strpos($link, '?') === false ? "?$placeholders" : "&$placeholders");
}
return $link;
}

View File

@ -19,7 +19,7 @@ $ExtraTreeTools
</div>
<% end_if %>
<div class="cms-tree" data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" data-url-updatetreenodes="$Link(updatetreenodes)" data-url-addpage="{$LinkPageAdd('AddForm/?action_doAdd=1')}&amp;ParentID=%s&amp;PageType=%s" data-url-editpage="$LinkPageEdit('%s')" data-url-duplicate="{$Link('duplicate/%s')}" data-url-duplicatewithchildren="{$Link('duplicatewithchildren/%s')}" data-url-listview="{$Link('?view=list')}" data-hints="$SiteTreeHints.XML" data-extra-params="SecurityID=$SecurityID">
<div class="cms-tree" data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" data-url-updatetreenodes="$Link(updatetreenodes)" data-url-addpage="{$LinkPageAdd('AddForm/?action_doAdd=1', 'ParentID=%s&amp;PageType=%s')}" data-url-editpage="$LinkPageEdit('%s')" data-url-duplicate="{$Link('duplicate/%s')}" data-url-duplicatewithchildren="{$Link('duplicatewithchildren/%s')}" data-url-listview="{$Link('?view=list')}" data-hints="$SiteTreeHints.XML" data-extra-params="SecurityID=$SecurityID">
$SiteTreeAsUL
</div>
</div>

View File

@ -1,5 +1,5 @@
<div class="cms-actions-row">
<a class="cms-page-add-button ss-ui-button ss-ui-action-constructive" data-icon="add" href="$LinkPageAdd" data-url-addpage="{$LinkPageAdd('?ParentID=%s')}"><% _t('CMSMain.AddNewButton', 'Add new') %></a>
<a class="cms-page-add-button ss-ui-button ss-ui-action-constructive" data-icon="add" href="$LinkPageAdd" data-url-addpage="{$LinkPageAdd('', 'ParentID=%s')}"><% _t('CMSMain.AddNewButton', 'Add new') %></a>
<button href="$LinkPagesWithSearch" class="cms-tree-expand-trigger cms-panel-link ss-button" data-icon="pencil">
<% _t('CMSMain.EditTree', 'Edit Tree') %>
</button>