mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Removed ModelAdmin/SecurityAdmin Webpack entry points
There's not a lot of benefit in packaging these separately in terms of initial CMS load size, so let's simplify the setup. They'll eventually become lazy loaded chunks in a React-based setup
This commit is contained in:
parent
701c700d4c
commit
25f4741142
46
admin/client/dist/js/ModelAdmin.js
vendored
46
admin/client/dist/js/ModelAdmin.js
vendored
@ -1,46 +0,0 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define('ss.ModelAdmin', ['jQuery'], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(require('jQuery'));
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(global.jQuery);
|
||||
global.ssModelAdmin = mod.exports;
|
||||
}
|
||||
})(this, function (_jQuery) {
|
||||
'use strict';
|
||||
|
||||
var _jQuery2 = _interopRequireDefault(_jQuery);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
_jQuery2.default.entwine('ss', function ($) {
|
||||
$('.cms-content-tools #Form_SearchForm').entwine({
|
||||
onsubmit: function onsubmit(e) {
|
||||
this.trigger('beforeSubmit');
|
||||
}
|
||||
});
|
||||
|
||||
$('.importSpec').entwine({
|
||||
onmatch: function onmatch() {
|
||||
this.find('div.details').hide();
|
||||
this.find('a.detailsLink').click(function () {
|
||||
$('#' + $(this).attr('href').replace(/.*#/, '')).slideToggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
this._super();
|
||||
},
|
||||
onunmatch: function onunmatch() {
|
||||
this._super();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
78
admin/client/dist/js/SecurityAdmin.js
vendored
78
admin/client/dist/js/SecurityAdmin.js
vendored
@ -1,78 +0,0 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define('ss.SecurityAdmin', ['jQuery'], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(require('jQuery'));
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(global.jQuery);
|
||||
global.ssSecurityAdmin = mod.exports;
|
||||
}
|
||||
})(this, function (_jQuery) {
|
||||
'use strict';
|
||||
|
||||
var _jQuery2 = _interopRequireDefault(_jQuery);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
var refreshAfterImport = function refreshAfterImport(e) {
|
||||
var existingFormMessage = (0, _jQuery2.default)((0, _jQuery2.default)(this).contents()).find('.message');
|
||||
if (existingFormMessage && existingFormMessage.html()) {
|
||||
var memberTableField = (0, _jQuery2.default)(window.parent.document).find('#Form_EditForm_Members').get(0);
|
||||
if (memberTableField) memberTableField.refresh();
|
||||
|
||||
var tree = (0, _jQuery2.default)(window.parent.document).find('.cms-tree').get(0);
|
||||
if (tree) tree.reload();
|
||||
}
|
||||
};
|
||||
|
||||
(0, _jQuery2.default)('#MemberImportFormIframe, #GroupImportFormIframe').entwine({
|
||||
onadd: function onadd() {
|
||||
this._super();
|
||||
|
||||
(0, _jQuery2.default)(this).bind('load', refreshAfterImport);
|
||||
}
|
||||
});
|
||||
|
||||
_jQuery2.default.entwine('ss', function ($) {
|
||||
$('.permissioncheckboxset .checkbox[value=ADMIN]').entwine({
|
||||
onmatch: function onmatch() {
|
||||
this.toggleCheckboxes();
|
||||
|
||||
this._super();
|
||||
},
|
||||
onunmatch: function onunmatch() {
|
||||
this._super();
|
||||
},
|
||||
|
||||
onclick: function onclick(e) {
|
||||
this.toggleCheckboxes();
|
||||
},
|
||||
|
||||
toggleCheckboxes: function toggleCheckboxes() {
|
||||
var self = this,
|
||||
checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this);
|
||||
|
||||
if (this.is(':checked')) {
|
||||
checkboxes.each(function () {
|
||||
$(this).data('SecurityAdmin.oldChecked', $(this).is(':checked'));
|
||||
$(this).data('SecurityAdmin.oldDisabled', $(this).is(':disabled'));
|
||||
$(this).prop('disabled', true);
|
||||
$(this).prop('checked', true);
|
||||
});
|
||||
} else {
|
||||
checkboxes.each(function () {
|
||||
$(this).prop('checked', $(this).data('SecurityAdmin.oldChecked'));
|
||||
$(this).prop('disabled', $(this).data('SecurityAdmin.oldDisabled'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -13,6 +13,7 @@ require('../legacy/LeftAndMain.FieldDescriptionToggle.js');
|
||||
require('../legacy/LeftAndMain.TreeDropdownField.js');
|
||||
require('../legacy/AddToCampaignForm.js');
|
||||
require('../legacy/SecurityAdmin.js');
|
||||
require('../legacy/ModelAdmin.js');
|
||||
|
||||
// Fields used by core legacy UIs, or available to users
|
||||
// To do: determine better way of using webpack to pull in optional javascript
|
||||
|
@ -3,6 +3,8 @@
|
||||
*/
|
||||
import $ from 'jQuery';
|
||||
|
||||
require('./LeftAndMain.js');
|
||||
|
||||
$.entwine('ss', function($){
|
||||
$('.cms-content-tools #Form_SearchForm').entwine({
|
||||
onsubmit: function(e) {
|
||||
@ -14,7 +16,7 @@ $.entwine('ss', function($){
|
||||
|
||||
/**
|
||||
* Class: .importSpec
|
||||
*
|
||||
*
|
||||
* Toggle import specifications
|
||||
*/
|
||||
$('.importSpec').entwine({
|
||||
@ -24,7 +26,7 @@ $.entwine('ss', function($){
|
||||
$('#' + $(this).attr('href').replace(/.*#/,'')).slideToggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
this._super();
|
||||
},
|
||||
onunmatch: function() {
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
import $ from 'jQuery';
|
||||
|
||||
require('./LeftAndMain.js');
|
||||
require('../../../../client/src/legacy/PermissionCheckboxSetField.js');
|
||||
|
||||
var refreshAfterImport = function(e) {
|
||||
@ -12,7 +13,7 @@ var refreshAfterImport = function(e) {
|
||||
// Refresh member listing
|
||||
var memberTableField = $(window.parent.document).find('#Form_EditForm_Members').get(0);
|
||||
if(memberTableField) memberTableField.refresh();
|
||||
|
||||
|
||||
// Refresh tree
|
||||
var tree = $(window.parent.document).find('.cms-tree').get(0);
|
||||
if(tree) tree.reload();
|
||||
@ -34,7 +35,7 @@ $('#MemberImportFormIframe, #GroupImportFormIframe').entwine({
|
||||
$.entwine('ss', function($){
|
||||
/**
|
||||
* Class: #Permissions .checkbox[value=ADMIN]
|
||||
*
|
||||
*
|
||||
* Automatically check and disable all checkboxes if ADMIN permissions are selected.
|
||||
* As they're disabled, any changes won't be submitted (which is intended behaviour),
|
||||
* checking all boxes is purely presentational.
|
||||
@ -60,7 +61,7 @@ $.entwine('ss', function($){
|
||||
toggleCheckboxes: function() {
|
||||
var self = this,
|
||||
checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this);
|
||||
|
||||
|
||||
if(this.is(':checked')) {
|
||||
checkboxes.each(function() {
|
||||
$(this).data('SecurityAdmin.oldChecked', $(this).is(':checked'));
|
||||
|
@ -137,8 +137,6 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
if(!array_key_exists($this->modelClass, $models)) {
|
||||
user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
|
||||
}
|
||||
|
||||
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/ModelAdmin.js');
|
||||
}
|
||||
|
||||
public function Link($action = null) {
|
||||
|
@ -55,11 +55,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
'roles'
|
||||
);
|
||||
|
||||
protected function init() {
|
||||
parent::init();
|
||||
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/SecurityAdmin.js');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut action for setting the correct active tab.
|
||||
*
|
||||
|
@ -47,8 +47,6 @@ const config = [
|
||||
'LeftAndMain.Ping': `${PATHS.ADMIN_JS_SRC}/legacy/LeftAndMain.Ping.js`,
|
||||
leaktools: `${PATHS.ADMIN_JS_SRC}/legacy/leaktools.js`,
|
||||
MemberImportForm: `${PATHS.ADMIN_JS_SRC}/legacy/MemberImportForm.js`,
|
||||
ModelAdmin: `${PATHS.ADMIN_JS_SRC}/legacy/ModelAdmin.js`,
|
||||
SecurityAdmin: `${PATHS.ADMIN_JS_SRC}/legacy/SecurityAdmin.js`,
|
||||
CMSSecurity: `${PATHS.ADMIN_JS_SRC}/legacy/CMSSecurity.js`,
|
||||
},
|
||||
resolve: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user