mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00: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(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)
|
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)
|
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"),
|
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"),this._super(t)}}),t(".cms-content-toolbar").entwine({onmatch:function i(){var e=this
|
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")
|
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
|
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)
|
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
|
// Toggle 'active' flag
|
||||||
this.siblings().removeClass('active');
|
this.siblings().removeClass('active');
|
||||||
this.addClass('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
|
// Does pjax load
|
||||||
return this._super(e);
|
return this._super(e);
|
||||||
}
|
}
|
||||||
|
@ -435,12 +435,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
$dateGroup->setTitle(_t('CMSSearch.PAGEFILTERDATEHEADING', 'Last edited'));
|
$dateGroup->setTitle(_t('CMSSearch.PAGEFILTERDATEHEADING', 'Last edited'));
|
||||||
|
|
||||||
|
// view mode
|
||||||
|
$viewMode = HiddenField::create('view', false, $this->ViewState());
|
||||||
|
|
||||||
// Create the Field list
|
// Create the Field list
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
$content,
|
$content,
|
||||||
$pageFilter,
|
$pageFilter,
|
||||||
$pageClasses,
|
$pageClasses,
|
||||||
$dateGroup
|
$dateGroup,
|
||||||
|
$viewMode
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create the Search and Reset action
|
// Create the Search and Reset action
|
||||||
@ -817,12 +821,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function ViewState() {
|
public function ViewState() {
|
||||||
$view = $this->getRequest()->getVar('view');
|
$mode = $this->getRequest()->requestVar('view')
|
||||||
if ($view) {
|
?: $this->getRequest()->param('Action');
|
||||||
$mode = "{$view}view";
|
|
||||||
} else {
|
|
||||||
$mode = $this->getRequest()->param('Action');
|
|
||||||
}
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case 'listview':
|
case 'listview':
|
||||||
case 'treeview':
|
case 'treeview':
|
||||||
@ -914,7 +914,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
if($parentID){
|
if($parentID){
|
||||||
$linkSpec = $this->Link();
|
$linkSpec = $this->Link();
|
||||||
$linkSpec = $linkSpec . (strstr($linkSpec, '?') ? '&' : '?') . 'ParentID=%d&view=list';
|
$linkSpec = $linkSpec . (strstr($linkSpec, '?') ? '&' : '?') . 'ParentID=%d&view=listview';
|
||||||
$gridFieldConfig->addComponent(
|
$gridFieldConfig->addComponent(
|
||||||
GridFieldLevelup::create($parentID)
|
GridFieldLevelup::create($parentID)
|
||||||
->setLinkSpec($linkSpec)
|
->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>',
|
'<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::join_links(
|
||||||
$controller->Link(),
|
$controller->Link(),
|
||||||
sprintf("?ParentID=%d&view=list", (int)$item->ID)
|
sprintf("?ParentID=%d&view=listview", (int)$item->ID)
|
||||||
),
|
),
|
||||||
$num
|
$num
|
||||||
);
|
);
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
<%-- Change to data-pjax-target="Content-PageList" to enable in-edit listview --%>
|
<%-- 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 %>"
|
<a class="cms-panel-link icon-button font-icon-tree page-view-link <% if $ViewState == 'treeview' %>active<% end_if %>"
|
||||||
href="$LinkTreeView.ATT"
|
href="$LinkTreeView.ATT"
|
||||||
|
data-view="treeview"
|
||||||
data-pjax-target="$PJAXTarget.ATT"
|
data-pjax-target="$PJAXTarget.ATT"
|
||||||
title="<% _t('CMSPagesController.TreeView', 'Tree View') %>"
|
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 %>"
|
></a><a class="cms-panel-link icon-button font-icon-list page-view-link <% if $ViewState == 'listview' %>active<% end_if %>"
|
||||||
href="$LinkListView.ATT"
|
href="$LinkListView.ATT"
|
||||||
|
data-view="listview"
|
||||||
data-pjax-target="$PJAXTarget.ATT"
|
data-pjax-target="$PJAXTarget.ATT"
|
||||||
title="<% _t('CMSPagesController.ListView', 'List View') %>"
|
title="<% _t('CMSPagesController.ListView', 'List View') %>"
|
||||||
></a>
|
></a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user