mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Alter RecordActionHandler's default to be more extensible
Previously we've had the $Action-less request mimic the default behaviour of GridFieldDetailFrom, that is to call that class' "edit" action. However in future a developer may wish to alter that behaviour, and formerly it was infeasible to do so without great trickery. So this commit introduces a configuration setting to allow the default action to be set as such, of which the default is the former (previously described) behaviour. Now a developer can apply an `Extension` class and not only add new actions that can be called, but now allow one of those added actions to become the default call when no action is supplied in the request.
This commit is contained in:
parent
f8e2ec0938
commit
c5e9744280
652
client/dist/js/bundle.js
vendored
652
client/dist/js/bundle.js
vendored
@ -1,651 +1 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // identity function for calling harmony imports with the correct context
|
||||
/******/ __webpack_require__.i = function(value) { return value; };
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 10);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = jQuery;
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = Injector;
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = React;
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react__ = __webpack_require__(2);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_dom__ = __webpack_require__(12);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react_dom__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lib_Injector__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lib_Injector___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_lib_Injector__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_components_GridFieldActionsMenu_GridFieldActionsMenuComponent__ = __webpack_require__(11);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var InjectedActionsMenu = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3_lib_Injector__["provideInjector"])(__WEBPACK_IMPORTED_MODULE_4_components_GridFieldActionsMenu_GridFieldActionsMenuComponent__["a" /* default */]);
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.js-injector-boot .ss-gridfield .actions-menu__activator').entwine({
|
||||
onmatch: function onmatch() {
|
||||
this.drawActionsMenu();
|
||||
|
||||
$('.cms-edit-form')._setupChangeTracker();
|
||||
},
|
||||
getItemId: function getItemId() {
|
||||
return this.closest('.ss-gridfield-item').data('id');
|
||||
},
|
||||
getData: function getData() {
|
||||
return JSON.parse(decodeURIComponent(this.data('actions')) || '[]');
|
||||
},
|
||||
drawActionsMenu: function drawActionsMenu() {
|
||||
var items = [];
|
||||
this.getData().forEach(function (menuGroup) {
|
||||
if (items.length) {
|
||||
items.push(__WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement('div', { className: 'dropdown-divider' }));
|
||||
}
|
||||
items.push(menuGroup.map(function (_ref) {
|
||||
var Title = _ref.Title,
|
||||
Link = _ref.Link,
|
||||
Type = _ref.Type;
|
||||
return __WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement(
|
||||
'a',
|
||||
{ href: Link, className: 'dropdown-item actions-menu__' + Type + '-action' },
|
||||
Title
|
||||
);
|
||||
}));
|
||||
});
|
||||
|
||||
var scrollingContainer = this.closest('form').css('position', 'relative').get(0);
|
||||
__WEBPACK_IMPORTED_MODULE_2_react_dom___default.a.render(__WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement(
|
||||
InjectedActionsMenu,
|
||||
{ id: 'actions-menu_' + this.getItemId(), container: scrollingContainer },
|
||||
items
|
||||
), this.get(0));
|
||||
}
|
||||
});
|
||||
$('.actions-menu__versioning-action').entwine({
|
||||
onclick: function onclick(e) {
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.ajax({
|
||||
headers: { 'X-Pjax': 'CurrentForm,Breadcrumbs' },
|
||||
url: this.prop('href'),
|
||||
type: 'GET',
|
||||
complete: function complete() {},
|
||||
success: function success(data, status, xhr) {
|
||||
var newContentEls = $('.cms-container').handleAjaxResponse(data, status, xhr);
|
||||
if (!newContentEls) return;
|
||||
newContentEls.filter('form').trigger('aftersubmitform', { status: status, xhr: xhr });
|
||||
}
|
||||
});
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.add-existing-search-dialog').entwine({
|
||||
loadDialog: function loadDialog(deferred) {
|
||||
var dialog = this.addClass('loading').children('.ui-dialog-content').empty();
|
||||
|
||||
deferred.done(function (data) {
|
||||
dialog.html(data).parent().removeClass('loading');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.ss-gridfield .add-existing-search').entwine({
|
||||
onclick: function onclick() {
|
||||
var dialog = $('<div></div>').appendTo('body').dialog({
|
||||
modal: true,
|
||||
resizable: false,
|
||||
width: 500,
|
||||
height: 600,
|
||||
close: function close() {
|
||||
$(this).dialog('destroy').remove();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.parent().addClass('add-existing-search-dialog').loadDialog($.get(this.prop('href')));
|
||||
dialog.data('grid', this.closest('.ss-gridfield'));
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.add-existing-search-dialog .add-existing-search-form').entwine({
|
||||
onsubmit: function onsubmit() {
|
||||
this.closest('.add-existing-search-dialog').loadDialog($.get(this.prop('action'), this.serialize()));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.add-existing-search-dialog .add-existing-search-items a').entwine({
|
||||
onclick: function onclick() {
|
||||
var link = this.closest('.add-existing-search-items').data('add-link');
|
||||
var id = this.data('id');
|
||||
|
||||
var dialog = this.closest('.add-existing-search-dialog').addClass('loading').children('.ui-dialog-content').empty();
|
||||
|
||||
$.post(link, { id: id }, function () {
|
||||
dialog.data('grid').reload();
|
||||
dialog.dialog('close');
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.add-existing-search-dialog .add-existing-search-pagination a').entwine({
|
||||
onclick: function onclick() {
|
||||
this.closest('.add-existing-search-dialog').loadDialog($.get(this.prop('href')));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_i18n__ = __webpack_require__(13);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_i18n__);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.ss-gridfield.ss-gridfield-editable').entwine({
|
||||
reload: function reload(opts, success) {
|
||||
var grid = this;
|
||||
|
||||
var added = [];
|
||||
var index = 0;
|
||||
grid.find('tbody:first .ss-gridfield-item').each(function () {
|
||||
if ($(this).is('.ss-gridfield-inline-new')) {
|
||||
added.push({
|
||||
index: index,
|
||||
row: $(this).detach()
|
||||
});
|
||||
}
|
||||
index++;
|
||||
});
|
||||
|
||||
this._super(opts, function () {
|
||||
var body = grid.find('tbody:first');
|
||||
$.each(added, function (i, item) {
|
||||
var row = item.row,
|
||||
index = item.index,
|
||||
replaces = void 0;
|
||||
|
||||
if (index === 0) {
|
||||
body.prepend(row);
|
||||
} else {
|
||||
replaces = body.find('.ss-gridfield-item:nth-child(' + index + ')');
|
||||
if (replaces.length) {
|
||||
replaces.after(row);
|
||||
} else {
|
||||
body.append(row);
|
||||
}
|
||||
}
|
||||
grid.find('tbody:first').children('.ss-gridfield-no-items').hide();
|
||||
});
|
||||
|
||||
if (success) success.apply(grid, arguments);
|
||||
});
|
||||
},
|
||||
onpaste: function onpaste(e) {
|
||||
var clipboardData = typeof e.originalEvent.clipboardData !== 'undefined' ? e.originalEvent.clipboardData : null;
|
||||
if (clipboardData) {
|
||||
var input = $(e.target);
|
||||
var inputType = input.attr('type');
|
||||
if (inputType === 'text' || inputType === 'email') {
|
||||
var lastInput = this.find('.ss-gridfield-inline-new:last').find('input');
|
||||
if (input.attr('type') === 'text' && input.is(lastInput) && input.val() === '') {
|
||||
var inputWrapperDivClass = input.parent().attr('class');
|
||||
|
||||
var lines = clipboardData.getData('text/plain').match(/[^\r\n]+/g);
|
||||
var linesLength = lines.length;
|
||||
|
||||
if (linesLength > 1) {
|
||||
var elementsChanged = [];
|
||||
for (var i = 1; i < linesLength; ++i) {
|
||||
this.trigger('addnewinline');
|
||||
var row = this.find('.ss-gridfield-inline-new:last');
|
||||
var rowInput = row.find('.' + inputWrapperDivClass).find('input');
|
||||
rowInput.val(lines[i]);
|
||||
elementsChanged.push(rowInput);
|
||||
}
|
||||
|
||||
input.data('pasteManipulatedElements', elementsChanged);
|
||||
|
||||
setTimeout(function () {
|
||||
input.val(lines[0]);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onkeyup: function onkeyup(e) {
|
||||
if (e.keyCode == 90 && e.ctrlKey) {
|
||||
var target = $(e.target);
|
||||
var elementsChanged = target.data('pasteManipulatedElements');
|
||||
if (typeof elementsChanged !== 'undefined' && elementsChanged && elementsChanged.length) {
|
||||
for (var i = 0; i < elementsChanged.length; ++i) {
|
||||
elementsChanged[i].closest('tr').remove();
|
||||
}
|
||||
target.data('pasteManipulatedElements', []);
|
||||
}
|
||||
}
|
||||
},
|
||||
onaddnewinline: function onaddnewinline(e) {
|
||||
if (e.target != this[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tmpl = window.tmpl;
|
||||
var row = this.find('.ss-gridfield-add-inline-template:last');
|
||||
var num = this.data('add-inline-num') || 1;
|
||||
|
||||
tmpl.cache[this[0].id + 'ss-gridfield-add-inline-template'] = tmpl(row.html());
|
||||
|
||||
this.find('tbody:first').append(tmpl(this[0].id + 'ss-gridfield-add-inline-template', { num: num }));
|
||||
this.find('tbody:first').children('.ss-gridfield-no-items').hide();
|
||||
this.data('add-inline-num', num + 1);
|
||||
|
||||
$('.ss-gridfield-orderable tbody').rebuildSort();
|
||||
}
|
||||
});
|
||||
|
||||
$('.ss-gridfield-add-new-inline').entwine({
|
||||
onclick: function onclick() {
|
||||
this.getGridField().trigger('addnewinline');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.ss-gridfield-delete-inline').entwine({
|
||||
onclick: function onclick() {
|
||||
var msg = __WEBPACK_IMPORTED_MODULE_1_i18n___default.a._t('GridFieldExtensions.CONFIRMDEL', 'Are you sure you want to delete this?');
|
||||
|
||||
if (confirm(msg)) {
|
||||
this.parents('tr.ss-gridfield-inline-new:first').remove();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.ss-gridfield-add-new-multi-class .btn__addnewmulticlass').entwine({
|
||||
onclick: function onclick() {
|
||||
var link = this.data('href');
|
||||
var cls = this.parents('.ss-gridfield-add-new-multi-class').find('select').val();
|
||||
|
||||
if (cls && cls.length) {
|
||||
this.getGridField().showDetailView(link.replace('{class}', encodeURI(cls)));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.ss-gridfield-add-new-multi-class select').entwine({
|
||||
onadd: function onadd() {
|
||||
this.update();
|
||||
},
|
||||
onchange: function onchange() {
|
||||
this.update();
|
||||
},
|
||||
update: function update() {
|
||||
var btn = this.parents('.ss-gridfield-add-new-multi-class').find('[data-add-multiclass]');
|
||||
|
||||
if (this.val() && this.val().length) {
|
||||
btn.removeClass('disabled');
|
||||
} else {
|
||||
btn.addClass('disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.ss-gridfield-configurable-paginator .pagination-page-size-select').entwine({
|
||||
onchange: function onchange() {
|
||||
this.parent().find('.ss-gridfield-pagesize-submit').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.grid-field .ss-gridfield-item').entwine({
|
||||
onclick: function onclick(e) {
|
||||
if (this.find('.editable-column-field').length) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
||||
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
|
||||
$('.ss-gridfield-orderable tbody').entwine({
|
||||
rebuildSort: function rebuildSort() {
|
||||
var grid = this.getGridField();
|
||||
|
||||
var minSort = null;
|
||||
grid.getItems().each(function () {
|
||||
var sortField = $(this).find('.ss-orderable-hidden-sort');
|
||||
if (sortField.length) {
|
||||
var thisSort = sortField.val();
|
||||
if (minSort === null && thisSort > 0) {
|
||||
minSort = thisSort;
|
||||
} else if (thisSort > 0) {
|
||||
minSort = Math.min(minSort, thisSort);
|
||||
}
|
||||
}
|
||||
});
|
||||
minSort = Math.max(1, minSort);
|
||||
|
||||
var sort = minSort;
|
||||
grid.getItems().each(function () {
|
||||
var sortField = $(this).find('.ss-orderable-hidden-sort');
|
||||
if (sortField.length) {
|
||||
sortField.val(sort);
|
||||
sort++;
|
||||
}
|
||||
});
|
||||
},
|
||||
onadd: function onadd() {
|
||||
var self = this;
|
||||
|
||||
var helper = function helper(e, row) {
|
||||
return row.clone().addClass('ss-gridfield-orderhelper').width('auto').find('.col-buttons').remove().end();
|
||||
};
|
||||
|
||||
var update = function update(event, ui) {
|
||||
var postback = true;
|
||||
if (ui != undefined && ui.item.hasClass('ss-gridfield-inline-new')) {
|
||||
postback = false;
|
||||
}
|
||||
|
||||
self.rebuildSort();
|
||||
|
||||
var grid = self.getGridField();
|
||||
if (grid.data('immediate-update') && postback) {
|
||||
grid.reload({
|
||||
url: grid.data('url-reorder')
|
||||
});
|
||||
} else {
|
||||
var form = $('.cms-edit-form');
|
||||
form.addClass('changed');
|
||||
}
|
||||
};
|
||||
|
||||
this.sortable({
|
||||
handle: '.handle',
|
||||
helper: helper,
|
||||
opacity: 0.7,
|
||||
update: update
|
||||
});
|
||||
},
|
||||
onremove: function onremove() {
|
||||
if (this.data('sortable')) {
|
||||
this.sortable('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.ss-gridfield-orderable .ss-gridfield-previouspage, .ss-gridfield-orderable .ss-gridfield-nextpage').entwine({
|
||||
onadd: function onadd() {
|
||||
var grid = this.getGridField();
|
||||
|
||||
if (this.is(':disabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var drop = function drop(e, ui) {
|
||||
var page = void 0;
|
||||
|
||||
if ($(this).hasClass('ss-gridfield-previouspage')) {
|
||||
page = 'prev';
|
||||
} else {
|
||||
page = 'next';
|
||||
}
|
||||
|
||||
grid.find('tbody').sortable('cancel');
|
||||
grid.reload({
|
||||
url: grid.data('url-movetopage'),
|
||||
data: [{ name: 'move[id]', value: ui.draggable.data('id') }, { name: 'move[page]', value: page }]
|
||||
});
|
||||
};
|
||||
|
||||
this.droppable({
|
||||
accept: '.ss-gridfield-item',
|
||||
activeClass: 'ui-droppable-active ui-state-highlight',
|
||||
disabled: this.prop('disabled'),
|
||||
drop: drop,
|
||||
tolerance: 'pointer'
|
||||
});
|
||||
},
|
||||
onremove: function onremove() {
|
||||
if (this.hasClass('ui-droppable')) this.droppable('destroy');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(4);
|
||||
__webpack_require__(5);
|
||||
__webpack_require__(6);
|
||||
__webpack_require__(7);
|
||||
__webpack_require__(8);
|
||||
__webpack_require__(3);
|
||||
__webpack_require__(9);
|
||||
|
||||
/***/ }),
|
||||
/* 11 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* unused harmony export Component */
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_lib_Injector__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_lib_Injector___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_lib_Injector__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react__ = __webpack_require__(2);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react__);
|
||||
|
||||
|
||||
|
||||
var ActionsMenu = function ActionsMenu(_ref) {
|
||||
var PopoverField = _ref.PopoverField,
|
||||
id = _ref.id,
|
||||
children = _ref.children,
|
||||
container = _ref.container;
|
||||
return __WEBPACK_IMPORTED_MODULE_1_react___default.a.createElement(
|
||||
PopoverField,
|
||||
{
|
||||
id: id,
|
||||
buttonSize: 'sm',
|
||||
data: { placement: 'bottom' },
|
||||
className: 'mr-0 btn-sm',
|
||||
popoverClassName: 'actions-menu__actions',
|
||||
container: container
|
||||
},
|
||||
children
|
||||
);
|
||||
};
|
||||
|
||||
ActionsMenu.propTypes = {
|
||||
id: __WEBPACK_IMPORTED_MODULE_1_react__["PropTypes"].string.isRequired,
|
||||
PopoverField: __WEBPACK_IMPORTED_MODULE_1_react__["PropTypes"].oneOfType([__WEBPACK_IMPORTED_MODULE_1_react__["PropTypes"].node, __WEBPACK_IMPORTED_MODULE_1_react__["PropTypes"].func])
|
||||
};
|
||||
|
||||
ActionsMenu.defaultProps = {
|
||||
id: '',
|
||||
PopoverField: null
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ __webpack_exports__["a"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_lib_Injector__["inject"])(['PopoverField'], function (PopoverField) {
|
||||
return { PopoverField: PopoverField };
|
||||
}, function () {
|
||||
return 'ActionsMenu';
|
||||
})(ActionsMenu));
|
||||
|
||||
/***/ }),
|
||||
/* 12 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = ReactDom;
|
||||
|
||||
/***/ }),
|
||||
/* 13 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = i18n;
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
//# sourceMappingURL=bundle.js.map
|
||||
!function(e){function i(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}var t={};i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},i.p="",i(i.s=10)}([function(e,i){e.exports=jQuery},function(e,i){e.exports=Injector},function(e,i){e.exports=React},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0),a=t.n(n),s=t(2),d=t.n(s),r=t(12),o=t.n(r),l=t(1),c=(t.n(l),t(11)),u=t.i(l.provideInjector)(c.a);a.a.entwine("ss",function(e){e(".js-injector-boot .ss-gridfield .actions-menu__activator").entwine({onmatch:function(){this.drawActionsMenu(),e(".cms-edit-form")._setupChangeTracker()},getItemId:function(){return this.closest(".ss-gridfield-item").data("id")},getData:function(){return JSON.parse(decodeURIComponent(this.data("actions"))||"[]")},drawActionsMenu:function(){var e=[];this.getData().forEach(function(i){e.length&&e.push(d.a.createElement("div",{className:"dropdown-divider"})),e.push(i.map(function(e){var i=e.Title,t=e.Link,n=e.Type;return d.a.createElement("a",{href:t,className:"dropdown-item actions-menu__"+n+"-action"},i)}))});var i=this.closest("form").css("position","relative").get(0);o.a.render(d.a.createElement(u,{id:"actions-menu_"+this.getItemId(),container:i},e),this.get(0))}}),e(".actions-menu__versioning-action").entwine({onclick:function(i){return a.a.ajax({headers:{"X-Pjax":"CurrentForm,Breadcrumbs"},url:this.prop("href"),type:"GET",complete:function(){},success:function(i,t,n){var a=e(".cms-container").handleAjaxResponse(i,t,n);a&&a.filter("form").trigger("aftersubmitform",{status:t,xhr:n})}}),i.stopPropagation(),!1}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0);t.n(n).a.entwine("ss",function(e){e(".add-existing-search-dialog").entwine({loadDialog:function(e){var i=this.addClass("loading").children(".ui-dialog-content").empty();e.done(function(e){i.html(e).parent().removeClass("loading")})}}),e(".ss-gridfield .add-existing-search").entwine({onclick:function(){var i=e("<div></div>").appendTo("body").dialog({modal:!0,resizable:!1,width:500,height:600,close:function(){e(this).dialog("destroy").remove()}});return i.parent().addClass("add-existing-search-dialog").loadDialog(e.get(this.prop("href"))),i.data("grid",this.closest(".ss-gridfield")),!1}}),e(".add-existing-search-dialog .add-existing-search-form").entwine({onsubmit:function(){return this.closest(".add-existing-search-dialog").loadDialog(e.get(this.prop("action"),this.serialize())),!1}}),e(".add-existing-search-dialog .add-existing-search-items a").entwine({onclick:function(){var i=this.closest(".add-existing-search-items").data("add-link"),t=this.data("id"),n=this.closest(".add-existing-search-dialog").addClass("loading").children(".ui-dialog-content").empty();return e.post(i,{id:t},function(){n.data("grid").reload(),n.dialog("close")}),!1}}),e(".add-existing-search-dialog .add-existing-search-pagination a").entwine({onclick:function(){return this.closest(".add-existing-search-dialog").loadDialog(e.get(this.prop("href"))),!1}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0),a=t.n(n),s=t(13),d=t.n(s);a.a.entwine("ss",function(e){e(".ss-gridfield.ss-gridfield-editable").entwine({reload:function(i,t){var n=this,a=[],s=0;n.find("tbody:first .ss-gridfield-item").each(function(){e(this).is(".ss-gridfield-inline-new")&&a.push({index:s,row:e(this).detach()}),s++}),this._super(i,function(){var i=n.find("tbody:first");e.each(a,function(e,t){var a=t.row,s=t.index,d=void 0;0===s?i.prepend(a):(d=i.find(".ss-gridfield-item:nth-child("+s+")"),d.length?d.after(a):i.append(a)),n.find("tbody:first").children(".ss-gridfield-no-items").hide()}),t&&t.apply(n,arguments)})},onpaste:function(i){var t=void 0!==i.originalEvent.clipboardData?i.originalEvent.clipboardData:null;if(t){var n=e(i.target),a=n.attr("type");if("text"===a||"email"===a){var s=this.find(".ss-gridfield-inline-new:last").find("input");if("text"===n.attr("type")&&n.is(s)&&""===n.val()){var d=n.parent().attr("class"),r=t.getData("text/plain").match(/[^\r\n]+/g),o=r.length;if(o>1){for(var l=[],c=1;c<o;++c){this.trigger("addnewinline");var u=this.find(".ss-gridfield-inline-new:last"),f=u.find("."+d).find("input");f.val(r[c]),l.push(f)}n.data("pasteManipulatedElements",l),setTimeout(function(){n.val(r[0])},0)}}}}},onkeyup:function(i){if(90==i.keyCode&&i.ctrlKey){var t=e(i.target),n=t.data("pasteManipulatedElements");if(void 0!==n&&n&&n.length){for(var a=0;a<n.length;++a)n[a].closest("tr").remove();t.data("pasteManipulatedElements",[])}}},onaddnewinline:function(i){if(i.target==this[0]){var t=window.tmpl,n=this.find(".ss-gridfield-add-inline-template:last"),a=this.data("add-inline-num")||1;t.cache[this[0].id+"ss-gridfield-add-inline-template"]=t(n.html()),this.find("tbody:first").append(t(this[0].id+"ss-gridfield-add-inline-template",{num:a})),this.find("tbody:first").children(".ss-gridfield-no-items").hide(),this.data("add-inline-num",a+1),e(".ss-gridfield-orderable tbody").rebuildSort()}}}),e(".ss-gridfield-add-new-inline").entwine({onclick:function(){return this.getGridField().trigger("addnewinline"),!1}}),e(".ss-gridfield-delete-inline").entwine({onclick:function(){var e=d.a._t("GridFieldExtensions.CONFIRMDEL","Are you sure you want to delete this?");return confirm(e)&&this.parents("tr.ss-gridfield-inline-new:first").remove(),!1}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0);t.n(n).a.entwine("ss",function(e){e(".ss-gridfield-add-new-multi-class .btn__addnewmulticlass").entwine({onclick:function(){var e=this.data("href"),i=this.parents(".ss-gridfield-add-new-multi-class").find("select").val();return i&&i.length&&this.getGridField().showDetailView(e.replace("{class}",encodeURI(i))),!1}}),e(".ss-gridfield-add-new-multi-class select").entwine({onadd:function(){this.update()},onchange:function(){this.update()},update:function(){var e=this.parents(".ss-gridfield-add-new-multi-class").find("[data-add-multiclass]");this.val()&&this.val().length?e.removeClass("disabled"):e.addClass("disabled")}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0);t.n(n).a.entwine("ss",function(e){e(".ss-gridfield-configurable-paginator .pagination-page-size-select").entwine({onchange:function(){this.parent().find(".ss-gridfield-pagesize-submit").trigger("click")}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0);t.n(n).a.entwine("ss",function(e){e(".grid-field .ss-gridfield-item").entwine({onclick:function(e){this.find(".editable-column-field").length&&e.stopPropagation()}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0);t.n(n).a.entwine("ss",function(e){e(".ss-gridfield-orderable tbody").entwine({rebuildSort:function(){var i=this.getGridField(),t=null;i.getItems().each(function(){var i=e(this).find(".ss-orderable-hidden-sort");if(i.length){var n=i.val();null===t&&n>0?t=n:n>0&&(t=Math.min(t,n))}}),t=Math.max(1,t);var n=t;i.getItems().each(function(){var i=e(this).find(".ss-orderable-hidden-sort");i.length&&(i.val(n),n++)})},onadd:function(){var i=this,t=function(e,i){return i.clone().addClass("ss-gridfield-orderhelper").width("auto").find(".col-buttons").remove().end()},n=function(t,n){var a=!0;void 0!=n&&n.item.hasClass("ss-gridfield-inline-new")&&(a=!1),i.rebuildSort();var s=i.getGridField();s.data("immediate-update")&&a?s.reload({url:s.data("url-reorder")}):e(".cms-edit-form").addClass("changed")};this.sortable({handle:".handle",helper:t,opacity:.7,update:n})},onremove:function(){this.data("sortable")&&this.sortable("destroy")}}),e(".ss-gridfield-orderable .ss-gridfield-previouspage, .ss-gridfield-orderable .ss-gridfield-nextpage").entwine({onadd:function(){var i=this.getGridField();if(this.is(":disabled"))return!1;var t=function(t,n){var a=void 0;a=e(this).hasClass("ss-gridfield-previouspage")?"prev":"next",i.find("tbody").sortable("cancel"),i.reload({url:i.data("url-movetopage"),data:[{name:"move[id]",value:n.draggable.data("id")},{name:"move[page]",value:a}]})};this.droppable({accept:".ss-gridfield-item",activeClass:"ui-droppable-active ui-state-highlight",disabled:this.prop("disabled"),drop:t,tolerance:"pointer"})},onremove:function(){this.hasClass("ui-droppable")&&this.droppable("destroy")}})})},function(e,i,t){t(4),t(5),t(6),t(7),t(8),t(3),t(9)},function(e,i,t){"use strict";var n=t(1),a=(t.n(n),t(2)),s=t.n(a),d=function(e){var i=e.PopoverField,t=e.id,n=e.children,a=e.container;return s.a.createElement(i,{id:t,buttonSize:"sm",data:{placement:"bottom"},className:"mr-0 btn-sm",popoverClassName:"actions-menu__actions",container:a},n)};d.propTypes={id:a.PropTypes.string.isRequired,PopoverField:a.PropTypes.oneOfType([a.PropTypes.node,a.PropTypes.func])},d.defaultProps={id:"",PopoverField:null},i.a=t.i(n.inject)(["PopoverField"],function(e){return{PopoverField:e}},function(){return"ActionsMenu"})(d)},function(e,i){e.exports=ReactDom},function(e,i){e.exports=i18n}]);
|
3
client/dist/styles/bundle.css
vendored
3
client/dist/styles/bundle.css
vendored
@ -1,2 +1 @@
|
||||
.add-existing-search-dialog{min-width:inherit!important}.add-existing-search-dialog .add-existing-search-form .field{border:none;-webkit-box-shadow:none;box-shadow:none;margin-bottom:0;padding-bottom:0}.add-existing-search-dialog .add-existing-search-form .field label{padding-bottom:4px}.add-existing-search-dialog .add-existing-search-form .Actions{margin-top:10px;padding:0}.add-existing-search-dialog .add-existing-search-items li a{background:#fff;border:solid #ccc;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;display:block;padding:6px}.add-existing-search-dialog .add-existing-search-items li:first-child a{border-top-left-radius:4px;border-top-right-radius:4px;border-top-width:1px}.add-existing-search-dialog .add-existing-search-items li:last-child a{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.add-existing-search-dialog .add-existing-search-items li a:hover{background:#f4f4f4}.add-existing-search-dialog .add-existing-search-pagination li{background:#fff;display:block;float:left;margin-right:2px;margin-top:12px;padding:6px}.ss-gridfield-inline-new{background:#efe}.ss-gridfield-inline-new:nth-child(2n){background:#dfd}.ss-gridfield-add-new-multi-class{margin-bottom:8px!important;white-space:nowrap}.ss-gridfield-add-new-multi-class .field{border:none;-webkit-box-shadow:none;box-shadow:none;float:left;margin:0 4px 0 0}.cms-edit-form:not(.AssetAdmin) .ss-gridfield-add-new-multi-class .form-group .form__field-holder{display:inline;padding:0;margin:0}.cms-edit-form:not(.AssetAdmin) .ss-gridfield-add-new-multi-class .form-group{display:inline-block;margin:0;min-width:150px;width:calc(100% - 20px)}.ss-gridfield-add-new-multi-class .form-group:after{border:0}.btn__addnewmulticlass{border-top-left-radius:0;border-bottom-left-radius:0;line-height:1.85em}.ss-gridfield-add-new-multi-class .chosen-container-active.chosen-with-drop .chosen-single,.ss-gridfield-add-new-multi-class .chosen-container-single .chosen-single{border-top-right-radius:0;border-bottom-right-radius:0}.ss-gridfield-configurable-paginator .pagination-page-size{color:#fff;float:left;padding:6px 0}.ss-gridfield-configurable-paginator .pagination-page-size-select{margin-left:0;width:auto}.ss-gridfield-configurable-paginator .ss-gridfield-pagesize-submit{display:none}.ss-gridfield-configurable-paginator .pagination-page-number input{text-align:center}.ss-gridfield-editable .readonly{padding-top:0!important}.ss-gridfield-editable .TreeDropdownField,.ss-gridfield-editable input.text,.ss-gridfield-editable select,.ss-gridfield-editable textarea{margin:0!important;max-width:none!important}.ss-gridfield-editable select.dropdown{border:1px solid #b3b3b3;background-color:#fff;padding:7px 7px7px 4px;line-height:16px;border-radius:4px}.ss-gridfield-add-new-inline{margin-bottom:12px}.ss-gridfield-add-new-inline span.readonly{color:#fff!important}.ss-gridfield-add-new-inline .col-buttons{text-align:right}.actions-menu__actions .popover-body .dropdown-divider,.actions-menu__actions .popover-body .dropdown-item{margin-left:calc(-1.2308rem + 1px);margin-right:calc(-1.2308rem + 1px);width:calc(100% + 2.4616rem - 2px)}.ss-gridfield-orderable thead tr th.col-Reorder span{padding:0!important;margin-left:8px}.ss-gridfield-orderable .col-reorder{position:relative;padding:0!important;width:16px!important}.ss-gridfield-orderable .col-reorder .handle{cursor:move;padding:16px 0 11px}.ss-gridfield-orderable .col-reorder .handle .icon{height:100%;font-size:1.5em}.ss-gridfield-orderhelper{border-bottom:1px solid rgba(0,0,0,.1);border-top:1px solid rgba(0,0,0,.1);-webkit-box-shadow:0 0 8px rgba(0,0,0,.4);box-shadow:0 0 8px rgba(0,0,0,.4)}.ss-gridfield-orderable tfoot .ui-droppable{padding-left:12px;padding-right:12px}.ss-gridfield-orderable tfoot .ui-droppable-active{background-color:#d4cf90!important}.ss-gridfield-orderable tfoot .ss-gridfield-previouspage{background-position:-16px 9px!important;margin-left:0}.ss-gridfield-orderable tfoot .ss-gridfield-nextpage{background-position:-40px 9px!important;margin-right:0}
|
||||
/*# sourceMappingURL=bundle.css.map*/
|
||||
.add-existing-search-dialog{min-width:inherit!important}.add-existing-search-dialog .add-existing-search-form .field{border:none;-webkit-box-shadow:none;box-shadow:none;margin-bottom:0;padding-bottom:0}.add-existing-search-dialog .add-existing-search-form .field label{padding-bottom:4px}.add-existing-search-dialog .add-existing-search-form .Actions{margin-top:10px;padding:0}.add-existing-search-dialog .add-existing-search-items li a{background:#fff;border:solid #ccc;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;display:block;padding:6px}.add-existing-search-dialog .add-existing-search-items li:first-child a{border-top-left-radius:4px;border-top-right-radius:4px;border-top-width:1px}.add-existing-search-dialog .add-existing-search-items li:last-child a{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.add-existing-search-dialog .add-existing-search-items li a:hover{background:#f4f4f4}.add-existing-search-dialog .add-existing-search-pagination li{background:#fff;display:block;float:left;margin-right:2px;margin-top:12px;padding:6px}.ss-gridfield-inline-new{background:#efe}.ss-gridfield-inline-new:nth-child(2n){background:#dfd}.ss-gridfield-add-new-multi-class{margin-bottom:8px!important;white-space:nowrap}.ss-gridfield-add-new-multi-class .field{border:none;-webkit-box-shadow:none;box-shadow:none;float:left;margin:0 4px 0 0}.cms-edit-form:not(.AssetAdmin) .ss-gridfield-add-new-multi-class .form-group .form__field-holder{display:inline;padding:0;margin:0}.cms-edit-form:not(.AssetAdmin) .ss-gridfield-add-new-multi-class .form-group{display:inline-block;margin:0;min-width:150px;width:calc(100% - 20px)}.ss-gridfield-add-new-multi-class .form-group:after{border:0}.btn__addnewmulticlass{border-top-left-radius:0;border-bottom-left-radius:0;line-height:1.85em}.ss-gridfield-add-new-multi-class .chosen-container-active.chosen-with-drop .chosen-single,.ss-gridfield-add-new-multi-class .chosen-container-single .chosen-single{border-top-right-radius:0;border-bottom-right-radius:0}.ss-gridfield-configurable-paginator .pagination-page-size{color:#fff;float:left;padding:6px 0}.ss-gridfield-configurable-paginator .pagination-page-size-select{margin-left:0;width:auto}.ss-gridfield-configurable-paginator .ss-gridfield-pagesize-submit{display:none}.ss-gridfield-configurable-paginator .pagination-page-number input{text-align:center}.ss-gridfield-editable .readonly{padding-top:0!important}.ss-gridfield-editable .TreeDropdownField,.ss-gridfield-editable input.text,.ss-gridfield-editable select,.ss-gridfield-editable textarea{margin:0!important;max-width:none!important}.ss-gridfield-editable select.dropdown{border:1px solid #b3b3b3;background-color:#fff;padding:7px 7px7px 4px;line-height:16px;border-radius:4px}.ss-gridfield-add-new-inline{margin-bottom:12px}.ss-gridfield-add-new-inline span.readonly{color:#fff!important}.ss-gridfield-add-new-inline .col-buttons{text-align:right}.actions-menu__actions .popover-body .dropdown-divider,.actions-menu__actions .popover-body .dropdown-item{margin-left:calc(-1.2308rem + 1px);margin-right:calc(-1.2308rem + 1px);width:calc(100% + 2.4616rem - 2px)}.ss-gridfield-orderable thead tr th.col-Reorder span{padding:0!important;margin-left:8px}.ss-gridfield-orderable .col-reorder{position:relative;padding:0!important;width:16px!important}.ss-gridfield-orderable .col-reorder .handle{cursor:move;padding:16px 0 11px}.ss-gridfield-orderable .col-reorder .handle .icon{height:100%;font-size:1.5em}.ss-gridfield-orderhelper{border-bottom:1px solid rgba(0,0,0,.1);border-top:1px solid rgba(0,0,0,.1);-webkit-box-shadow:0 0 8px rgba(0,0,0,.4);box-shadow:0 0 8px rgba(0,0,0,.4)}.ss-gridfield-orderable tfoot .ui-droppable{padding-left:12px;padding-right:12px}.ss-gridfield-orderable tfoot .ui-droppable-active{background-color:#d4cf90!important}.ss-gridfield-orderable tfoot .ss-gridfield-previouspage{background-position:-16px 9px!important;margin-left:0}.ss-gridfield-orderable tfoot .ss-gridfield-nextpage{background-position:-40px 9px!important;margin-right:0}
|
@ -88,6 +88,7 @@ class GridFieldActionsMenu implements
|
||||
* Add each of the "Root" tabs to the actions for this component
|
||||
* We expect that a tabbed list of fields will always have a singular root.
|
||||
*
|
||||
* @param GridField $gridField
|
||||
* @param DataObject $record
|
||||
* @param string $typeName
|
||||
*
|
||||
@ -125,6 +126,7 @@ class GridFieldActionsMenu implements
|
||||
* If the object is versioned (has the {@link Versioned} extension applied) then add
|
||||
* actions to publish, unpublish, and archive - depending on record state.
|
||||
*
|
||||
* @param GridField $gridField
|
||||
* @param DataObject $record
|
||||
* @param string $typeName
|
||||
*
|
||||
@ -182,7 +184,7 @@ class GridFieldActionsMenu implements
|
||||
}
|
||||
// remove empty entries
|
||||
foreach ($actions as $section => $sectionItems) {
|
||||
$section = array_filter($sectionItems);
|
||||
$actions[$section] = array_filter($sectionItems);
|
||||
}
|
||||
$actions = array_filter($actions);
|
||||
// render
|
||||
|
@ -17,6 +17,7 @@ class GridFieldRecordActionHandler extends RequestHandler
|
||||
{
|
||||
|
||||
private static $allowed_actions = [
|
||||
'defaultAction',
|
||||
'detailForm',
|
||||
'publish',
|
||||
'unpublish',
|
||||
@ -28,11 +29,26 @@ class GridFieldRecordActionHandler extends RequestHandler
|
||||
'$ID//view' => 'detailForm',
|
||||
'$ID//ItemEditForm' => 'detailForm',
|
||||
'$ID//$Action!' => '$Action',
|
||||
'$ID' => 'detailForm',
|
||||
'$ID' => 'defaultAction',
|
||||
];
|
||||
|
||||
/**
|
||||
* Name of action method to run when `'ID' => 'defaultAction'` is matched
|
||||
* Allows for an author to update to e.g. an applied `Extension`'s method
|
||||
* @var string
|
||||
*/
|
||||
private static $default_action = 'detailForm';
|
||||
|
||||
/**
|
||||
* @var DataObject The object we're performing actions on
|
||||
*/
|
||||
protected $record = null;
|
||||
|
||||
/**
|
||||
* @var GridField The GridField we're performing actions through
|
||||
*/
|
||||
protected $gridField = null;
|
||||
|
||||
public function __construct(GridField $gridField, DataObjectInterface $record)
|
||||
{
|
||||
$this->gridField = $gridField;
|
||||
@ -40,6 +56,16 @@ class GridFieldRecordActionHandler extends RequestHandler
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function defaultAction(HTTPRequest $request)
|
||||
{
|
||||
$action = $this->config()->default_action;
|
||||
if ($this->hasAction($action) && $this->checkAccessAction($action)) {
|
||||
return $this->handleAction($request, $action);
|
||||
}
|
||||
$classMessage = Director::isLive() ? 'on this handler' : 'on class '.static::class;
|
||||
return $this->httpError(403, "Action '' isn't allowed $classMessage.");
|
||||
}
|
||||
|
||||
public function detailForm(HTTPRequest $request)
|
||||
{
|
||||
$detailForm = Injector::inst()->create(GridFieldDetailForm::class);
|
||||
|
Loading…
Reference in New Issue
Block a user