diff --git a/client/dist/styles/bundle.css b/client/dist/styles/bundle.css index 6c2f5163..3be66d13 100644 --- a/client/dist/styles/bundle.css +++ b/client/dist/styles/bundle.css @@ -1 +1 @@ -#cms-page-history-versions tr.loading{color:#999}#cms-page-history-versions tr.loading td:hover{cursor:none}#cms-page-history-versions td:hover{cursor:pointer}.CMSPageHistoryController{overflow:hidden}.CMSPageHistoryController ins{background-color:#dfd;padding:2px;text-decoration:none}.CMSPageHistoryController del{background-color:#fdd;padding:2px;color:#f44}.CMSPageHistoryController .htmleditorfield.readonly img{max-width:100%;height:auto}.CMSPageHistoryController .cms-content-tools.collapsed{overflow:hidden}#cms-content-listview .cms-tree-expand-trigger,#cms-content-treeview .cms-tree-expand-trigger{display:none}.cms-content-tools #cms-content-treeview .cms-content-toolbar{border-bottom:none;-webkit-box-shadow:none;box-shadow:none;margin-bottom:0}.cms-content-tools #cms-content-treeview .cms-tree-expand-trigger{display:block;float:left;margin:0 0 2px}.cms-content-tools #cms-content-treeview .cms-tree-expand-trigger span.ui-button-text{padding-right:8px}.cms-content-tools #cms-content-treeview .cms-tree .badge{display:none}.cms-content-tools #cms-content-treeview .cms-tree .jstree-clicked>.text>.badge,.cms-content-tools #cms-content-treeview .cms-tree a:hover>.text>.badge{display:inline-block}.cms-content-toolbar .view-controls{margin-top:0}.cms-content-toolbar .view-controls .page-view-link{display:none;margin-right:-5px}.cms-content-toolbar .view-controls.view-controls--listview .font-icon-tree,.cms-content-toolbar .view-controls.view-controls--treeview .font-icon-list{display:inline-block}.field.urlsegment.loading{background:url(data:image/gif;base64,R0lGODlhEAAQAPQAAP///wpakvj6+z9+qYivyg9dlC5yotfk7KvG2R9om3umxGubveXt8py80sjZ5k+IsFyRtgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla+KIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK+o2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC+0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU/NXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK+kCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm/4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg+boUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC+RAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA==) no-repeat 162px 8px}.field.urlsegment .URL-link{padding-top:8px;display:inline-block}.field.urlsegment input.text{width:250px;float:left}.field.urlsegment .cancel,.field.urlsegment .edit,.field.urlsegment .update,.field.urlsegment input.text{margin-right:8px}.field.urlsegment .help{margin-left:0}.field.urlsegment .edit-holder{display:none}.field.urlsegment .edit-holder .form__field-description{clear:both}#Form_EditForm #Title .update{margin-left:7px} \ No newline at end of file +#cms-page-history-versions tr.loading{color:#999}#cms-page-history-versions tr.loading td:hover{cursor:none}#cms-page-history-versions td:hover{cursor:pointer}.CMSPageHistoryController{overflow:hidden}.CMSPageHistoryController ins{background-color:#dfd;padding:2px;text-decoration:none}.CMSPageHistoryController del{background-color:#fdd;padding:2px;color:#f44}.CMSPageHistoryController .htmleditorfield.readonly img{max-width:100%;height:auto}.CMSPageHistoryController .cms-content-tools.collapsed{overflow:hidden}#cms-content-listview .cms-tree-expand-trigger,#cms-content-treeview .cms-tree-expand-trigger{display:none}.cms-content-tools #cms-content-treeview .cms-content-toolbar{border-bottom:none;-webkit-box-shadow:none;box-shadow:none;margin-bottom:0}.cms-content-tools #cms-content-treeview .cms-tree-expand-trigger{display:block;float:left;margin:0 0 2px}.cms-content-tools #cms-content-treeview .cms-tree-expand-trigger span.ui-button-text{padding-right:8px}.cms-content-tools #cms-content-treeview .cms-tree .badge{display:none}.cms-content-tools #cms-content-treeview .cms-tree .jstree-clicked>.text>.badge,.cms-content-tools #cms-content-treeview .cms-tree a:hover>.text>.badge{display:inline-block}.cms-list .cms-list__item-breadcrumbs{margin-left:21px;margin-bottom:0;font-size:.9em;word-break:break-word}.cms-content-toolbar .view-controls{margin-top:0}.cms-content-toolbar .view-controls .page-view-link{display:none;margin-right:-5px}.cms-content-toolbar .view-controls.view-controls--listview .font-icon-tree,.cms-content-toolbar .view-controls.view-controls--treeview .font-icon-list{display:inline-block}.field.urlsegment.loading{background:url(data:image/gif;base64,R0lGODlhEAAQAPQAAP///wpakvj6+z9+qYivyg9dlC5yotfk7KvG2R9om3umxGubveXt8py80sjZ5k+IsFyRtgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla+KIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK+o2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC+0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU/NXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK+kCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm/4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg+boUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC+RAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA==) no-repeat 162px 8px}.field.urlsegment .URL-link{padding-top:8px;display:inline-block}.field.urlsegment input.text{width:250px;float:left}.field.urlsegment .cancel,.field.urlsegment .edit,.field.urlsegment .update,.field.urlsegment input.text{margin-right:8px}.field.urlsegment .help{margin-left:0}.field.urlsegment .edit-holder{display:none}.field.urlsegment .edit-holder .form__field-description{clear:both}#Form_EditForm #Title .update{margin-left:7px} \ No newline at end of file diff --git a/client/src/styles/legacy/_CMSMain.scss b/client/src/styles/legacy/_CMSMain.scss index 00cd186c..c23b8a15 100644 --- a/client/src/styles/legacy/_CMSMain.scss +++ b/client/src/styles/legacy/_CMSMain.scss @@ -101,6 +101,19 @@ } } +/* ------------------------------------------------------------------- + * List view + * ------------------------------------------------------------------- */ +.cms-list { + + .cms-list__item-breadcrumbs { + margin-left: 21px; + margin-bottom: 0; + font-size: 0.9em; + word-break: break-word; + } +} + /* ------------------------------------------------------------------- * Sitetree tool bar * ----------------------------------------------------------------- */ @@ -164,3 +177,4 @@ #Form_EditForm #Title .update { margin-left: 7px; } + diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index 91aa63d4..07a248e8 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -838,7 +838,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $dateGroup->setTitle(_t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited')); // view mode - $viewMode = HiddenField::create('view', false, $this->ViewState()); + $viewMode = HiddenField::create('view', false, $this->ViewState('listview')); // Create the Field list $fields = new FieldList( @@ -1307,9 +1307,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } /** + * @param string $default * @return string */ - public function ViewState() + public function ViewState($default = 'treeview') { $mode = $this->getRequest()->requestVar('view') ?: $this->getRequest()->param('Action'); @@ -1318,7 +1319,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr case 'treeview': return $mode; default: - return 'treeview'; + return $default; } } @@ -1464,7 +1465,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } }, 'getTreeTitle' => function ($value, &$item) use ($controller) { - return sprintf( + $title = sprintf( '%s', Controller::join_links( CMSPageEditController::singleton()->Link('show'), @@ -1472,6 +1473,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr ), $item->TreeTitle // returns HTML, does its own escaping ); + $breadcrumbs = $item->Breadcrumbs(20, true, false, true, '/'); + // Remove item's tile + $breadcrumbs = preg_replace('/[^\/]+$/', '', trim($breadcrumbs)); + // Trim spaces around delimiters + $breadcrumbs = preg_replace('/\s?\/\s?/', '/', trim($breadcrumbs)); + return $title . sprintf('

%s

', $breadcrumbs); } )); diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index c5c0731a..66cd0756 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -813,13 +813,14 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi * @param boolean $showHidden Include pages marked with the attribute ShowInMenus = 0 * @return string The breadcrumb trail. */ - public function Breadcrumbs($maxDepth = 20, $unlinked = false, $stopAtPageType = false, $showHidden = false) + public function Breadcrumbs($maxDepth = 20, $unlinked = false, $stopAtPageType = false, $showHidden = false, $delimiter = '»') { $pages = $this->getBreadcrumbItems($maxDepth, $stopAtPageType, $showHidden); $template = SSViewer::create('BreadcrumbsTemplate'); return $template->process($this->customise(new ArrayData(array( "Pages" => $pages, - "Unlinked" => $unlinked + "Unlinked" => $unlinked, + "Delimiter" => $delimiter, )))); } diff --git a/templates/BreadcrumbsTemplate.ss b/templates/BreadcrumbsTemplate.ss index 60764276..a2ccd5a9 100755 --- a/templates/BreadcrumbsTemplate.ss +++ b/templates/BreadcrumbsTemplate.ss @@ -1,4 +1,4 @@ <%-- Loop is all on one line to prevent whitespace bug in older versions of IE --%> <% if $Pages %> - <% loop $Pages %><% if $Last %>$MenuTitle.XML<% else %><% if not Up.Unlinked %><% end_if %>$MenuTitle.XML<% if not Up.Unlinked %><% end_if %> » <% end_if %><% end_loop %> + <% loop $Pages %><% if $Last %>$MenuTitle.XML<% else %><% if not Up.Unlinked %><% end_if %>$MenuTitle.XML<% if not Up.Unlinked %><% end_if %> $Up.Delimiter.RAW <% end_if %><% end_loop %> <% end_if %> diff --git a/templates/SilverStripe/CMS/Controllers/Includes/CMSPagesController_ContentToolActions.ss b/templates/SilverStripe/CMS/Controllers/Includes/CMSPagesController_ContentToolActions.ss index 5f59ea5a..182358e7 100644 --- a/templates/SilverStripe/CMS/Controllers/Includes/CMSPagesController_ContentToolActions.ss +++ b/templates/SilverStripe/CMS/Controllers/Includes/CMSPagesController_ContentToolActions.ss @@ -1,12 +1,14 @@
- <% _t('SilverStripe\CMS\Controllers\CMSMain.AddNewButton', 'Add new') %> + <% if not $TreeIsFiltered %> + <% _t('SilverStripe\CMS\Controllers\CMSMain.AddNewButton', 'Add new') %> - <% if $View == 'Tree' %> - - <% end_if %> + <% if $View == 'Tree' %> + + <% end_if %> + <% end_if %> <% include SilverStripe\\CMS\\Controllers\\CMSMain_ViewControls PJAXTarget='Content-PageList' %>
diff --git a/tests/behat/features/search-for-a-page.feature b/tests/behat/features/search-for-a-page.feature index b579feff..7fa6afdc 100644 --- a/tests/behat/features/search-for-a-page.feature +++ b/tests/behat/features/search-for-a-page.feature @@ -15,65 +15,65 @@ Feature: Search for a page Scenario: I can search for a page by its title Given I fill in "Search" with "About Us" And I press the "Search" button - Then I should see "About Us" in the tree - But I should not see "Contact Us" in the tree + Then I should see "About Us" in the cms list + But I should not see "Contact Us" in the cms list Scenario: I can search for a page by its type Given a "Virtual Page" "My Virtual Page" When I select "Virtual Page" from "Page type" And I press the "Search" button - Then I should see "My Virtual Page" in the tree - But I should not see "Contact Us" in the tree + Then I should see "My Virtual Page" in the cms list + But I should not see "Contact Us" in the cms list Scenario: I can search for a page by its oldest last edited date Given a "page" "Recent Page" And a "page" "Old Page" was last edited "7 days ago" When I fill in "From" with "the date of 5 days ago" And I press the "Search" button - Then I should see "Recent Page" in the tree - But I should not see "Old Page" in the tree + Then I should see "Recent Page" in the cms list + But I should not see "Old Page" in the cms list Scenario: I can search for a page by its newest last edited date Given a "page" "Recent Page" And a "page" "Old Page" was last edited "7 days ago" When I fill in "To" with "the date of 5 days ago" And I press the "Search" button - Then I should not see "Recent Page" in the tree - But I should see "Old Page" in the tree + Then I should not see "Recent Page" in the cms list + But I should see "Old Page" in the cms list Scenario: I can include deleted pages in my search Given a "page" "Deleted Page" And the "page" "Deleted Page" is unpublished And the "page" "Deleted Page" is deleted When I press the "Search" button - Then I should not see "Deleted Page" in the tree + Then I should not see "Deleted Page" in the cms list When I expand the content filters And I select "All pages, including archived" from "Page status" And I press the "Search" button - Then I should see "Deleted Page" in the tree + Then I should see "Deleted Page" in the cms list Scenario: I can include only deleted pages in my search Given a "page" "Deleted Page" And the "page" "Deleted Page" is unpublished And the "page" "Deleted Page" is deleted When I press the "Search" button - Then I should not see "Deleted Page" in the tree + Then I should not see "Deleted Page" in the cms list When I expand the content filters And I select "Archived pages" from "Page status" And I press the "Search" button - Then I should see "Deleted Page" in the tree - And I should not see "About Us" in the tree + Then I should see "Deleted Page" in the cms list + And I should not see "About Us" in the cms list Scenario: I can include draft pages in my search Given a "page" "Draft Page" And the "page" "Draft Page" is not published When I press the "Search" button - Then I should see "Draft Page" in the tree + Then I should see "Draft Page" in the cms list When I expand the content filters And I select "Draft pages" from "Page status" And I press the "Search" button - Then I should see "Draft Page" in the tree - And I should not see "About Us" in the tree + Then I should see "Draft Page" in the cms list + And I should not see "About Us" in the cms list Scenario: I can include changed pages in my search When I click on "About Us" in the tree @@ -87,20 +87,20 @@ Feature: Search for a page And I expand the content filters When I select "Modified pages" from "Page status" And I press the "Search" button - Then I should see "About Us" in the tree - And I should not see "Home" in the tree + Then I should see "About Us" in the cms list + And I should not see "Home" in the cms list Scenario: I can include live pages in my search Given a "page" "Live Page" And the "page" "Live Page" is published And the "page" "Live Page" is deleted When I press the "Search" button - Then I should not see "Live Page" in the tree + Then I should not see "Live Page" in the cms list When I expand the content filters And I select "Live but removed from draft" from "Page status" And I press the "Search" button - Then I should see "Live Page" in the tree - And I should not see "About Us" in the tree + Then I should see "Live Page" in the cms list + And I should not see "About Us" in the cms list Scenario: I can include only live pages in my search Given a "page" "Live Page" @@ -113,6 +113,6 @@ Feature: Search for a page When I select "Published pages" from "Page status" And I press the "Search" button - Then I should not see "Draft Page" in the tree - And I should not see "Deleted Page" in the tree - But I should see "Live Page" in the tree + Then I should not see "Draft Page" in the cms list + And I should not see "Deleted Page" in the cms list + But I should see "Live Page" in the cms list