mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
Merge branch '4.0' into 4
This commit is contained in:
commit
494dbd1ef2
2
client/dist/styles/bundle.css
vendored
2
client/dist/styles/bundle.css
vendored
@ -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-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 .form__field-label{background-image:url(data:image/gif;base64,R0lGODlhEAAQAPQAAP///wpakvj6+z9+qYivyg9dlC5yotfk7KvG2R9om3umxGubveXt8py80sjZ5k+IsFyRtgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla+KIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK+o2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC+0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU/NXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK+kCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm/4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg+boUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC+RAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA==);background-repeat:no-repeat;background-position:100%;padding-right:20px}.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__field-update-url{position:absolute;top:4px;right:20px;background:#fff;z-index:3}@media (max-width:992px){.form__field-update-url{right:0}}#Form_EditForm #Title .update{margin-left:7px}
|
||||
#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:inline-block;margin-right:-5px}.cms-content-toolbar .view-controls.view-controls--listview .font-icon-list,.cms-content-toolbar .view-controls.view-controls--treeview .font-icon-tree{display:none}.field.urlsegment.loading .form__field-label{background-image:url(data:image/gif;base64,R0lGODlhEAAQAPQAAP///wpakvj6+z9+qYivyg9dlC5yotfk7KvG2R9om3umxGubveXt8py80sjZ5k+IsFyRtgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla+KIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK+o2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC+0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU/NXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK+kCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm/4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg+boUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC+RAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA==);background-repeat:no-repeat;background-position:100%;padding-right:20px}.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__field-update-url{position:absolute;top:4px;right:20px;background:#fff;z-index:3}@media (max-width:992px){.form__field-update-url{right:0}}#Form_EditForm #Title .update{margin-left:7px}
|
@ -122,18 +122,15 @@
|
||||
.view-controls {
|
||||
margin-top: 0;
|
||||
|
||||
.page-view-link {
|
||||
display: none;
|
||||
margin-right: -5px;
|
||||
}
|
||||
.page-view-link {
|
||||
display: inline-block;
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
||||
&.view-controls--treeview .font-icon-list {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
&.view-controls--listview .font-icon-tree {
|
||||
display: inline-block;
|
||||
}
|
||||
&.view-controls--treeview .font-icon-tree,
|
||||
&.view-controls--listview .font-icon-list {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ use SilverStripe\Control\HTTPResponse_Exception;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Environment;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Core\Manifest\ModuleResource;
|
||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
||||
use SilverStripe\Forms\DateField;
|
||||
use SilverStripe\Forms\DropdownField;
|
||||
@ -1056,20 +1057,17 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
}
|
||||
|
||||
// skip this type if it is restricted
|
||||
if ($instance->config()->get('need_permission') && !$this->can(singleton($class)->config()->get('need_permission'))) {
|
||||
$needPermissions = $instance->config()->get('need_permission');
|
||||
if ($needPermissions && !$this->can($needPermissions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$singularName = $instance->i18n_singular_name();
|
||||
$description = $instance->i18n_classDescription();
|
||||
|
||||
$result->push(new ArrayData(array(
|
||||
'ClassName' => $class,
|
||||
'AddAction' => $singularName,
|
||||
'Description' => $description,
|
||||
// TODO Sprite support
|
||||
'IconURL' => ModuleResourceLoader::resourceURL($instance->config()->get('icon')),
|
||||
'Title' => $singularName,
|
||||
'AddAction' => $instance->i18n_singular_name(),
|
||||
'Description' => $instance->i18n_classDescription(),
|
||||
'IconURL' => $instance->getPageIconURL(),
|
||||
'Title' => $instance->i18n_singular_name(),
|
||||
)));
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
namespace SilverStripe\CMS\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\View\Requirements;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\View\Requirements;
|
||||
|
||||
/**
|
||||
* Extension to include custom page icons
|
||||
@ -32,28 +32,16 @@ class LeftAndMainPageIconsExtension extends Extension
|
||||
|
||||
$classes = ClassInfo::subclassesFor(SiteTree::class);
|
||||
foreach ($classes as $class) {
|
||||
$obj = singleton($class);
|
||||
$iconSpec = $obj->config()->get('icon');
|
||||
|
||||
if (!$iconSpec) {
|
||||
$icon = Config::inst()->get($class, 'icon');
|
||||
if (!$icon) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Legacy support: We no longer need separate icon definitions for folders etc.
|
||||
$iconFile = (is_array($iconSpec)) ? $iconSpec[0] : $iconSpec;
|
||||
|
||||
// Legacy support: Add file extension if none exists
|
||||
if (!pathinfo($iconFile, PATHINFO_EXTENSION)) {
|
||||
$iconFile .= '-file.gif';
|
||||
}
|
||||
|
||||
$class = Convert::raw2htmlid($class);
|
||||
$selector = ".page-icon.class-$class, li.class-$class > a .jstree-pageicon";
|
||||
if (Director::fileExists($iconFile)) {
|
||||
$css .= "$selector { background: transparent url('$iconFile') 0 0 no-repeat; }\n";
|
||||
} else {
|
||||
// Support for more sophisticated rules, e.g. sprited icons
|
||||
$css .= "$selector { $iconFile }\n";
|
||||
$cssClass = Convert::raw2htmlid($class);
|
||||
$selector = ".page-icon.class-$cssClass, li.class-$cssClass > a .jstree-pageicon";
|
||||
$iconURL = SiteTree::singleton($class)->getPageIconURL();
|
||||
if ($iconURL) {
|
||||
$css .= "$selector { background: transparent url('$iconURL') 0 0 no-repeat; }\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Core\Manifest\ModuleResource;
|
||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
||||
use SilverStripe\Core\Resettable;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
@ -248,7 +250,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
* Icon to use in the CMS page tree. This should be the full filename, relative to the webroot.
|
||||
* Also supports custom CSS rule contents (applied to the correct selector for the tree UI implementation).
|
||||
*
|
||||
* @see CMSMain::generateTreeStylingCSS()
|
||||
* @see LeftAndMainPageIconsExtension::generatePageIconsCss()
|
||||
* @config
|
||||
* @var string
|
||||
*/
|
||||
@ -1486,7 +1488,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
parent::onBeforeDelete();
|
||||
|
||||
// If deleting this page, delete all its children.
|
||||
if (SiteTree::config()->enforce_strict_hierarchy && $children = $this->AllChildren()) {
|
||||
if ($this->isInDB() && SiteTree::config()->enforce_strict_hierarchy && $children = $this->AllChildren()) {
|
||||
foreach ($children as $child) {
|
||||
/** @var SiteTree $child */
|
||||
$child->delete();
|
||||
@ -2857,6 +2859,33 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
return parent::plural_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate link to this page's icon
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPageIconURL()
|
||||
{
|
||||
$icon = $this->config()->get('icon');
|
||||
if (!$icon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Icon is relative resource
|
||||
$iconResource = ModuleResourceLoader::singleton()->resolveResource($icon);
|
||||
if ($iconResource instanceof ModuleResource) {
|
||||
return $iconResource->getURL();
|
||||
}
|
||||
|
||||
// Full path to file
|
||||
if (Director::fileExists($icon)) {
|
||||
return ModuleResourceLoader::resourceURL($icon);
|
||||
}
|
||||
|
||||
// Skip invalid files
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description for this page type
|
||||
*
|
||||
|
@ -1,40 +1,36 @@
|
||||
<div id="pages-controller-cms-content" class="has-panel cms-content flexbox-area-grow fill-width fill-height $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content" data-ignore-tab-state="true">
|
||||
<div class="fill-width fill-height flexbox-area-grow">
|
||||
$Tools
|
||||
$Tools
|
||||
|
||||
<div class="fill-height flexbox-area-grow">
|
||||
<div class="cms-content-header north">
|
||||
<div class="cms-content-header-nav fill-width vertical-align-items">
|
||||
<div class="cms-content-header-nav__left vertical-align-items flexbox-area-grow">
|
||||
<a href="$BreadcrumbsBackLink" class="btn btn-secondary btn--no-text font-icon-left-open-big hidden-lg-up toolbar__back-button"></a>
|
||||
<% include SilverStripe\\Admin\\CMSBreadcrumbs %>
|
||||
</div>
|
||||
|
||||
<div class="cms-content-header-tabs cms-tabset">
|
||||
<ul class="cms-tabset-nav-primary nav nav-tabs">
|
||||
<li class="nav-item content-treeview<% if $TabIdentifier == 'edit' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageEdit" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageEdit">
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabContent 'Content' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $TabIdentifier == 'settings' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageSettings" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageSettings">
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabSettings 'Settings' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $TabIdentifier == 'history' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageHistory" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageHistory">
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabHistory 'History' %>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fill-height flexbox-area-grow">
|
||||
<div class="cms-content-header north">
|
||||
<div class="cms-content-header-info flexbox-area-grow vertical-align-items fill-width">
|
||||
<a href="$BreadcrumbsBackLink" class="btn btn-secondary btn--no-text font-icon-left-open-big hidden-lg-up toolbar__back-button"></a>
|
||||
<% include SilverStripe\\Admin\\CMSBreadcrumbs %>
|
||||
</div>
|
||||
|
||||
<div class="flexbox-area-grow fill-height">
|
||||
$EditForm
|
||||
<div class="cms-content-header-tabs cms-tabset">
|
||||
<ul class="cms-tabset-nav-primary nav nav-tabs">
|
||||
<li class="nav-item content-treeview<% if $TabIdentifier == 'edit' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageEdit" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageEdit">
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabContent 'Content' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $TabIdentifier == 'settings' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageSettings" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageSettings">
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabSettings 'Settings' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $TabIdentifier == 'history' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageHistory" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageHistory">
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabHistory 'History' %>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flexbox-area-grow fill-height">
|
||||
$EditForm
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<div class="cms-content-tools fill-height cms-panel cms-panel-layout" data-expandOnClick="true" data-layout-type="border" id="cms-content-tools-CMSMain">
|
||||
<div class="cms-content-header north">
|
||||
<div class="cms-content-header-info vertical-align-items">
|
||||
<div class="section-heading">
|
||||
<div class="cms-content-header north vertical-align-items">
|
||||
<div class="cms-content-header-info vertical-align-items fill-width">
|
||||
<div class="section-heading flexbox-area-grow">
|
||||
<span class="section-label"><a href="$LinkPages">{$MenuCurrentItem.Title}</a></span>
|
||||
</div>
|
||||
<% include SilverStripe\\CMS\\Controllers\\CMSMain_Filter %>
|
||||
<% include SilverStripe\\CMS\\Controllers\\CMSMain_Filter %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel--scrollable flexbox-area-grow fill-height cms-panel-content">
|
||||
|
@ -1,11 +1,13 @@
|
||||
<div class="view-controls view-controls--{$ViewState}">
|
||||
<%-- Change to data-pjax-target="Content-PageList" to enable in-edit listview --%>
|
||||
<a class="page-view-link btn btn-secondary btn--icon-sm btn--no-text font-icon-tree"
|
||||
href="$LinkTreeView.ATT"
|
||||
data-view="treeview"
|
||||
data-pjax-target="$PJAXTarget.ATT"
|
||||
title="<%t SilverStripe\CMS\Controllers\CMSPagesController.TreeView 'Tree View' %>"
|
||||
></a>
|
||||
<% if not $TreeIsFiltered %>
|
||||
<%-- Change to data-pjax-target="Content-PageList" to enable in-edit listview --%>
|
||||
<a class="page-view-link btn btn-secondary btn--icon-sm btn--no-text font-icon-tree"
|
||||
href="$LinkTreeView.ATT"
|
||||
data-view="treeview"
|
||||
data-pjax-target="$PJAXTarget.ATT"
|
||||
title="<%t SilverStripe\CMS\Controllers\CMSPagesController.TreeView 'Tree View' %>"
|
||||
></a>
|
||||
<% end_if %>
|
||||
<a class="page-view-link btn btn-secondary btn--icon-sm btn--no-text font-icon-list"
|
||||
href="$LinkListView.ATT"
|
||||
data-view="listview"
|
||||
|
@ -1,9 +1,9 @@
|
||||
<div id="pages-controller-cms-content" class="flexbox-area-grow fill-height cms-content $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
|
||||
|
||||
<div class="cms-content-header north">
|
||||
<div class="cms-content-header north vertical-align-items">
|
||||
<div class="cms-content-header-info fill-width vertical-align-items">
|
||||
<% include SilverStripe\\Admin\\CMSBreadcrumbs %>
|
||||
<% include SilverStripe\\CMS\\Controllers\\CMSMain_Filter %>
|
||||
<% include SilverStripe\\CMS\\Controllers\\CMSMain_Filter %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
30
tests/php/Controllers/LeftAndMainPageIconsExtensionTest.php
Normal file
30
tests/php/Controllers/LeftAndMainPageIconsExtensionTest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Controllers\LeftAndMainPageIconsExtension;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
|
||||
class LeftAndMainPageIconsExtensionTest extends SapphireTest
|
||||
{
|
||||
protected static $extra_dataobjects = [
|
||||
LeftAndMainPageIconsExtensionTest\ModuleIconA::class,
|
||||
LeftAndMainPageIconsExtensionTest\ModuleIconB::class,
|
||||
LeftAndMainPageIconsExtensionTest\ModuleIconC::class,
|
||||
];
|
||||
|
||||
public function testGenerateIconCSS()
|
||||
{
|
||||
$extension = new LeftAndMainPageIconsExtension();
|
||||
$css = $extension->generatePageIconsCss();
|
||||
$this->assertNotContains('some invalid string', $css);
|
||||
$this->assertContains(
|
||||
'tests/php/Controllers/LeftAndMainPageIconsExtensionTest/icon_b.jpg?m=',
|
||||
$css
|
||||
);
|
||||
$this->assertContains(
|
||||
'tests/php/Controllers/LeftAndMainPageIconsExtensionTest/icon_c.jpg?m=',
|
||||
$css
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers\LeftAndMainpageIconsExtensionTest;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ModuleIconA extends SiteTree implements TestOnly
|
||||
{
|
||||
private static $icon = 'some invalid string';
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers\LeftAndMainpageIconsExtensionTest;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ModuleIconB extends SiteTree implements TestOnly
|
||||
{
|
||||
private static $icon = 'silverstripe/cms:tests/php/Controllers/LeftAndMainPageIconsExtensionTest/icon_b.jpg';
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers\LeftAndMainpageIconsExtensionTest;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ModuleIconC extends SiteTree implements TestOnly
|
||||
{
|
||||
private static $extensions = [
|
||||
ModuleIconExtension::class,
|
||||
];
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers\LeftAndMainpageIconsExtensionTest;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ModuleIconExtension extends SiteTreeExtension implements TestOnly
|
||||
{
|
||||
public static function get_extra_config()
|
||||
{
|
||||
// Mock a "fixed" path, but use a non-fixed resource url
|
||||
$path = ModuleResourceLoader::resourcePath(
|
||||
'silverstripe/cms:tests/php/Controllers/LeftAndMainPageIconsExtensionTest/icon_c.jpg'
|
||||
);
|
||||
return [
|
||||
'icon' => $path,
|
||||
];
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -26,6 +26,7 @@ use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\View\Parsers\Diff;
|
||||
use SilverStripe\View\Parsers\ShortcodeParser;
|
||||
use SilverStripe\View\Parsers\URLSegmentFilter;
|
||||
use LogicException;
|
||||
|
||||
class SiteTreeTest extends SapphireTest
|
||||
{
|
||||
@ -368,6 +369,25 @@ class SiteTreeTest extends SapphireTest
|
||||
$this->assertInstanceOf('Page', $requeriedPage);
|
||||
}
|
||||
|
||||
public function testNoCascadingDeleteWithoutID()
|
||||
{
|
||||
Config::inst()->update('SiteTree', 'enforce_strict_hierarchy', true);
|
||||
$count = SiteTree::get()->count();
|
||||
$this->assertNotEmpty($count);
|
||||
$obj = new SiteTree();
|
||||
$this->assertFalse($obj->exists());
|
||||
$fail = true;
|
||||
try {
|
||||
$obj->delete();
|
||||
} catch (LogicException $e) {
|
||||
$fail = false;
|
||||
}
|
||||
if ($fail) {
|
||||
$this->fail('Failed to throw delete exception');
|
||||
}
|
||||
$this->assertCount($count, SiteTree::get());
|
||||
}
|
||||
|
||||
public function testGetByLink()
|
||||
{
|
||||
$home = $this->objFromFixture('Page', 'home');
|
||||
|
Loading…
x
Reference in New Issue
Block a user