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:
Ingo Schommer 2016-09-10 18:54:37 +12:00
parent 701c700d4c
commit 25f4741142
8 changed files with 9 additions and 138 deletions

View File

@ -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();
}
});
});
});

View File

@ -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'));
});
}
}
});
});
});

View File

@ -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

View File

@ -3,6 +3,8 @@
*/
import $ from 'jQuery';
require('./LeftAndMain.js');
$.entwine('ss', function($){
$('.cms-content-tools #Form_SearchForm').entwine({
onsubmit: function(e) {

View File

@ -3,6 +3,7 @@
*/
import $ from 'jQuery';
require('./LeftAndMain.js');
require('../../../../client/src/legacy/PermissionCheckboxSetField.js');
var refreshAfterImport = function(e) {

View File

@ -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) {

View File

@ -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.
*

View File

@ -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: {