mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUG Fix search not respecting view mode
This commit is contained in:
parent
8c87ea6b79
commit
e5550dd680
6
client/dist/js/bundle.js
vendored
6
client/dist/js/bundle.js
vendored
@ -92,8 +92,10 @@ n.data("button")&&n.button("option","showingAlternate",!1),this._super(t)}}),t("
|
||||
})},function(t,e){t.exports=i18n},function(t,e,n){"use strict"
|
||||
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
|
||||
o["default"].entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function e(t){var e=this.closest(".cms-content").find(t.target)
|
||||
0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms .cms-panel-link.page-view-link").entwine({onclick:function n(t){return this.siblings().removeClass("active"),
|
||||
this.addClass("active"),this._super(t)}}),t(".cms-content-toolbar").entwine({onmatch:function i(){var e=this
|
||||
0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms .cms-panel-link.page-view-link").entwine({onclick:function n(e){this.siblings().removeClass("active"),
|
||||
this.addClass("active")
|
||||
var n=t(".cms-content-filters input[type='hidden'][name='view']")
|
||||
return n.val(t(this).data("view")),this._super(e)}}),t(".cms-content-toolbar").entwine({onmatch:function i(){var e=this
|
||||
this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),i=n.data("toolid"),a=n.hasClass("active")
|
||||
void 0!==i&&(n.data("active",!1).removeClass("active"),t("#"+i).hide(),e.bindActionButtonEvents(n))})},onunmatch:function a(){var e=this
|
||||
this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this)
|
||||
|
@ -31,6 +31,11 @@ $.entwine('ss', function ($) {
|
||||
// Toggle 'active' flag
|
||||
this.siblings().removeClass('active');
|
||||
this.addClass('active');
|
||||
|
||||
// Toggle 'view' parameter in search form to keep same view type
|
||||
var viewField = $(".cms-content-filters input[type='hidden'][name='view']");
|
||||
viewField.val($(this).data('view'));
|
||||
|
||||
// Does pjax load
|
||||
return this._super(e);
|
||||
}
|
||||
|
@ -435,12 +435,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
);
|
||||
$dateGroup->setTitle(_t('CMSSearch.PAGEFILTERDATEHEADING', 'Last edited'));
|
||||
|
||||
// view mode
|
||||
$viewMode = HiddenField::create('view', false, $this->ViewState());
|
||||
|
||||
// Create the Field list
|
||||
$fields = new FieldList(
|
||||
$content,
|
||||
$pageFilter,
|
||||
$pageClasses,
|
||||
$dateGroup
|
||||
$dateGroup,
|
||||
$viewMode
|
||||
);
|
||||
|
||||
// Create the Search and Reset action
|
||||
@ -817,12 +821,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
* @return string
|
||||
*/
|
||||
public function ViewState() {
|
||||
$view = $this->getRequest()->getVar('view');
|
||||
if ($view) {
|
||||
$mode = "{$view}view";
|
||||
} else {
|
||||
$mode = $this->getRequest()->param('Action');
|
||||
}
|
||||
$mode = $this->getRequest()->requestVar('view')
|
||||
?: $this->getRequest()->param('Action');
|
||||
switch($mode) {
|
||||
case 'listview':
|
||||
case 'treeview':
|
||||
@ -914,7 +914,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
);
|
||||
if($parentID){
|
||||
$linkSpec = $this->Link();
|
||||
$linkSpec = $linkSpec . (strstr($linkSpec, '?') ? '&' : '?') . 'ParentID=%d&view=list';
|
||||
$linkSpec = $linkSpec . (strstr($linkSpec, '?') ? '&' : '?') . 'ParentID=%d&view=listview';
|
||||
$gridFieldConfig->addComponent(
|
||||
GridFieldLevelup::create($parentID)
|
||||
->setLinkSpec($linkSpec)
|
||||
@ -957,7 +957,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
'<a class="btn btn-secondary btn--no-text btn--icon-large font-icon-right-dir cms-panel-link list-children-link" data-pjax-target="ListViewForm,Breadcrumbs" href="%s"><span class="sr-only">%s child pages</span></a>',
|
||||
Controller::join_links(
|
||||
$controller->Link(),
|
||||
sprintf("?ParentID=%d&view=list", (int)$item->ID)
|
||||
sprintf("?ParentID=%d&view=listview", (int)$item->ID)
|
||||
),
|
||||
$num
|
||||
);
|
||||
|
@ -3,13 +3,15 @@
|
||||
<div class="icon-button-group">
|
||||
<%-- Change to data-pjax-target="Content-PageList" to enable in-edit listview --%>
|
||||
<a class="cms-panel-link icon-button font-icon-tree page-view-link <% if $ViewState == 'treeview' %>active<% end_if %>"
|
||||
href="$LinkTreeView.ATT"
|
||||
data-pjax-target="$PJAXTarget.ATT"
|
||||
title="<% _t('CMSPagesController.TreeView', 'Tree View') %>"
|
||||
href="$LinkTreeView.ATT"
|
||||
data-view="treeview"
|
||||
data-pjax-target="$PJAXTarget.ATT"
|
||||
title="<% _t('CMSPagesController.TreeView', 'Tree View') %>"
|
||||
></a><a class="cms-panel-link icon-button font-icon-list page-view-link <% if $ViewState == 'listview' %>active<% end_if %>"
|
||||
href="$LinkListView.ATT"
|
||||
data-pjax-target="$PJAXTarget.ATT"
|
||||
title="<% _t('CMSPagesController.ListView', 'List View') %>"
|
||||
href="$LinkListView.ATT"
|
||||
data-view="listview"
|
||||
data-pjax-target="$PJAXTarget.ATT"
|
||||
title="<% _t('CMSPagesController.ListView', 'List View') %>"
|
||||
></a>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user