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/LeftAndMain.TreeDropdownField.js');
|
||||||
require('../legacy/AddToCampaignForm.js');
|
require('../legacy/AddToCampaignForm.js');
|
||||||
require('../legacy/SecurityAdmin.js');
|
require('../legacy/SecurityAdmin.js');
|
||||||
|
require('../legacy/ModelAdmin.js');
|
||||||
|
|
||||||
// Fields used by core legacy UIs, or available to users
|
// Fields used by core legacy UIs, or available to users
|
||||||
// To do: determine better way of using webpack to pull in optional javascript
|
// To do: determine better way of using webpack to pull in optional javascript
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
import $ from 'jQuery';
|
import $ from 'jQuery';
|
||||||
|
|
||||||
|
require('./LeftAndMain.js');
|
||||||
|
|
||||||
$.entwine('ss', function($){
|
$.entwine('ss', function($){
|
||||||
$('.cms-content-tools #Form_SearchForm').entwine({
|
$('.cms-content-tools #Form_SearchForm').entwine({
|
||||||
onsubmit: function(e) {
|
onsubmit: function(e) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import $ from 'jQuery';
|
import $ from 'jQuery';
|
||||||
|
|
||||||
|
require('./LeftAndMain.js');
|
||||||
require('../../../../client/src/legacy/PermissionCheckboxSetField.js');
|
require('../../../../client/src/legacy/PermissionCheckboxSetField.js');
|
||||||
|
|
||||||
var refreshAfterImport = function(e) {
|
var refreshAfterImport = function(e) {
|
||||||
|
@ -137,8 +137,6 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
if(!array_key_exists($this->modelClass, $models)) {
|
if(!array_key_exists($this->modelClass, $models)) {
|
||||||
user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
|
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) {
|
public function Link($action = null) {
|
||||||
|
@ -55,11 +55,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
'roles'
|
'roles'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected function init() {
|
|
||||||
parent::init();
|
|
||||||
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/SecurityAdmin.js');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut action for setting the correct active tab.
|
* Shortcut action for setting the correct active tab.
|
||||||
*
|
*
|
||||||
|
@ -47,8 +47,6 @@ const config = [
|
|||||||
'LeftAndMain.Ping': `${PATHS.ADMIN_JS_SRC}/legacy/LeftAndMain.Ping.js`,
|
'LeftAndMain.Ping': `${PATHS.ADMIN_JS_SRC}/legacy/LeftAndMain.Ping.js`,
|
||||||
leaktools: `${PATHS.ADMIN_JS_SRC}/legacy/leaktools.js`,
|
leaktools: `${PATHS.ADMIN_JS_SRC}/legacy/leaktools.js`,
|
||||||
MemberImportForm: `${PATHS.ADMIN_JS_SRC}/legacy/MemberImportForm.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`,
|
CMSSecurity: `${PATHS.ADMIN_JS_SRC}/legacy/CMSSecurity.js`,
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user