Skip to content

Commit 9475eee

Browse files
committed
API Make CMSMain more generic
Remove hardcoded references to pages and SiteTree Remove assumption that records are versioned Remove or validate assumptions about methods on the model class Improve general architecture of CMSMain
1 parent 240f2b4 commit 9475eee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1347
-1698
lines changed

_config/adminpanels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Name: cmsdefaultadmin
33
---
44
SilverStripe\Admin\AdminRootController:
5-
default_panel: SilverStripe\CMS\Controllers\CMSPagesController
5+
default_panel: SilverStripe\CMS\Controllers\CMSMain

_config/cache.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ After:
44
- '#corecache'
55
---
66
SilverStripe\Core\Injector\Injector:
7-
Psr\SimpleCache\CacheInterface.CMSMain_SiteTreeHints:
7+
Psr\SimpleCache\CacheInterface.CMSMain_TreeHints:
88
factory: SilverStripe\Core\Cache\CacheFactory
99
constructor:
10-
namespace: "CMSMain_SiteTreeHints"
10+
namespace: "CMSMain_TreeHints"
1111
Psr\SimpleCache\CacheInterface.SiteTree_CreatableChildren:
1212
factory: SilverStripe\Core\Cache\CacheFactory
1313
constructor:
1414
namespace: "SiteTree_CreatableChildren"
15-
Psr\SimpleCache\CacheInterface.SiteTree_PageIcons:
15+
Psr\SimpleCache\CacheInterface.CMS_RecordIcons:
1616
factory: SilverStripe\Core\Cache\CacheFactory
1717
constructor:
18-
namespace: "SiteTree_PageIcons"
18+
namespace: "CMS_RecordIcons"

_config/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Name: cmsextensions
33
---
44
SilverStripe\Admin\LeftAndMain:
55
extensions:
6-
- SilverStripe\CMS\Controllers\LeftAndMainPageIconsExtension
6+
- SilverStripe\CMS\Controllers\LeftAndMainRecordIconsExtension
77
- SilverStripe\CMS\Controllers\LeftAndMainBatchActionsExtension
88
---
99
Name: cmsmodals
@@ -16,4 +16,4 @@ Name: cmshierarchy
1616
---
1717
SilverStripe\ORM\Hierarchy\Hierarchy:
1818
node_threshold_total: 50
19-
node_threshold_leaf: 250
19+
node_threshold_leaf: 250

_config/permissions.yml

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ SilverStripe\Core\Injector\Injector:
1717
Services:
1818
- '%$SilverStripe\Security\PermissionChecker.sitetree'
1919
- '%$SilverStripe\CMS\Controllers\CMSMain'
20-
- '%$SilverStripe\CMS\Model\SiteTree'

client/dist/js/bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/legacy/CMSMain.AddForm.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ $.entwine('ss', function($){
123123
* @param {string} defaultChildClass
124124
*/
125125
updateSelectionFilter: function(disallowedChildren, defaultChildClass) {
126-
var currentSelection = this.find('#Form_AddForm_PageType div.radio.selected')[0];
126+
var currentSelection = this.find('#Form_AddForm_RecordType div.radio.selected')[0];
127127
var keepSelection = false;
128128

129129
// Limit selection
130130
var allAllowed = null; // troolian
131-
this.find('#Form_AddForm_PageType div.radio').each(function (i, el) {
131+
this.find('#Form_AddForm_RecordType div.radio').each(function (i, el) {
132132
var className = $(this).find('input').val(),
133133
isAllowed = ($.inArray(className, disallowedChildren) === -1);
134134

135-
// Avoid changing the selected pagetype if still allowed
135+
// Avoid changing the selected record type if still allowed
136136
if (el === currentSelection && isAllowed) {
137137
keepSelection = true;
138138
}
@@ -153,16 +153,16 @@ $.entwine('ss', function($){
153153
var selectedEl = $(currentSelection).parents('li:first');
154154
} else if (defaultChildClass) {
155155
var selectedEl = this
156-
.find('#Form_AddForm_PageType div.radio input[value=' + defaultChildClass + ']')
156+
.find('#Form_AddForm_RecordType div.radio input[value=' + defaultChildClass + ']')
157157
.parents('li:first');
158158
} else {
159-
var selectedEl = this.find('#Form_AddForm_PageType div.radio:not(.disabled):first');
159+
var selectedEl = this.find('#Form_AddForm_RecordType div.radio:not(.disabled):first');
160160
}
161161
selectedEl.setSelected(true);
162162
selectedEl.siblings().setSelected(false);
163163

164-
// Disable the "Create" button if none of the pagetypes are available
165-
if(this.find('#Form_AddForm_PageType div.radio:not(.disabled)').length) {
164+
// Disable the "Create" button if none of the record types are available
165+
if(this.find('#Form_AddForm_RecordType div.radio:not(.disabled)').length) {
166166
this.find('button[name=action_doAdd]').removeAttr('disabled');
167167
} else {
168168
this.find('button[name=action_doAdd]').attr('disabled', 'disabled');
@@ -172,7 +172,7 @@ $.entwine('ss', function($){
172172
}
173173
});
174174

175-
$(".cms-add-form #Form_AddForm_PageType div.radio").entwine({
175+
$(".cms-add-form #Form_AddForm_RecordType div.radio").entwine({
176176
onclick: function(e) {
177177
this.setSelected(true);
178178
},

client/src/legacy/CMSMain.Tree.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ $.entwine('ss.tree', function($) {
9191
$.each(allowedChildren, function(index, child) {
9292
hasAllowedChildren = true;
9393
menuAllowedChildren["allowedchildren-" + child.ClassName] = {
94-
'label': '<span class="jstree-pageicon ' + child.IconClass + '"></span>' + child.Title,
94+
'label': '<span class="jstree-recordicon ' + child.IconClass + '"></span>' + child.Title,
9595
'_class': 'class-' + child.ClassName.replace(/[^a-zA-Z0-9\-_:.]+/g, '_'),
9696
'action': function(obj) {
9797
$('.cms-container').entwine('.ss').loadPanel(

0 commit comments

Comments
 (0)