mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1617 from open-sausages/pulls/4.0/webpack-optimise
Remove framework bundle include
This commit is contained in:
commit
07ba92c5b7
193
client/dist/js/CMSMain.AddForm.js
vendored
193
client/dist/js/CMSMain.AddForm.js
vendored
@ -1,193 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.CMSMain.AddForm', ['jQuery'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery);
|
|
||||||
global.ssCMSMainAddForm = 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-add-form .parent-mode :input").entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
if (this.val() == 'top') {
|
|
||||||
var parentField = this.closest('form').find('#Form_AddForm_ParentID_Holder .TreeDropdownField');
|
|
||||||
parentField.setValue('');
|
|
||||||
parentField.setTitle('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".cms-add-form").entwine({
|
|
||||||
ParentID: 0,
|
|
||||||
ParentCache: {},
|
|
||||||
onadd: function onadd() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
this.find('#Form_AddForm_ParentID_Holder .TreeDropdownField').bind('change', function () {
|
|
||||||
self.updateTypeList();
|
|
||||||
});
|
|
||||||
this.find(".SelectionGroup.parent-mode").bind('change', function () {
|
|
||||||
self.updateTypeList();
|
|
||||||
});
|
|
||||||
this.updateTypeList();
|
|
||||||
},
|
|
||||||
loadCachedChildren: function loadCachedChildren(parentID) {
|
|
||||||
var cache = this.getParentCache();
|
|
||||||
if (typeof cache[parentID] !== 'undefined') return cache[parentID];else return null;
|
|
||||||
},
|
|
||||||
saveCachedChildren: function saveCachedChildren(parentID, children) {
|
|
||||||
var cache = this.getParentCache();
|
|
||||||
cache[parentID] = children;
|
|
||||||
this.setParentCache(cache);
|
|
||||||
},
|
|
||||||
|
|
||||||
updateTypeList: function updateTypeList() {
|
|
||||||
var hints = this.data('hints'),
|
|
||||||
parentTree = this.find('#Form_AddForm_ParentID_Holder .TreeDropdownField'),
|
|
||||||
parentMode = this.find("input[name=ParentModeField]:checked").val(),
|
|
||||||
metadata = parentTree.data('metadata'),
|
|
||||||
id = metadata && parentMode === 'child' ? parentTree.getValue() || this.getParentID() : null,
|
|
||||||
newClassName = metadata ? metadata.ClassName : null,
|
|
||||||
hintKey = newClassName && parentMode === 'child' ? newClassName : 'Root',
|
|
||||||
hint = typeof hints[hintKey] !== 'undefined' ? hints[hintKey] : null,
|
|
||||||
self = this,
|
|
||||||
defaultChildClass = hint && typeof hint.defaultChild !== 'undefined' ? hint.defaultChild : null,
|
|
||||||
disallowedChildren = [];
|
|
||||||
|
|
||||||
if (id) {
|
|
||||||
if (this.hasClass('loading')) return;
|
|
||||||
this.addClass('loading');
|
|
||||||
|
|
||||||
this.setParentID(id);
|
|
||||||
if (!parentTree.getValue()) parentTree.setValue(id);
|
|
||||||
|
|
||||||
disallowedChildren = this.loadCachedChildren(id);
|
|
||||||
if (disallowedChildren !== null) {
|
|
||||||
this.updateSelectionFilter(disallowedChildren, defaultChildClass);
|
|
||||||
this.removeClass('loading');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: self.data('childfilter'),
|
|
||||||
data: { 'ParentID': id },
|
|
||||||
success: function success(data) {
|
|
||||||
self.saveCachedChildren(id, data);
|
|
||||||
self.updateSelectionFilter(data, defaultChildClass);
|
|
||||||
},
|
|
||||||
complete: function complete() {
|
|
||||||
self.removeClass('loading');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
disallowedChildren = hint && typeof hint.disallowedChildren !== 'undefined' ? hint.disallowedChildren : [];
|
|
||||||
this.updateSelectionFilter(disallowedChildren, defaultChildClass);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
updateSelectionFilter: function updateSelectionFilter(disallowedChildren, defaultChildClass) {
|
|
||||||
var allAllowed = null;
|
|
||||||
this.find('#Form_AddForm_PageType div.radio').each(function () {
|
|
||||||
var className = $(this).find('input').val(),
|
|
||||||
isAllowed = $.inArray(className, disallowedChildren) === -1;
|
|
||||||
|
|
||||||
$(this).setEnabled(isAllowed);
|
|
||||||
if (!isAllowed) {
|
|
||||||
$(this).setSelected(false);
|
|
||||||
}
|
|
||||||
if (allAllowed === null) {
|
|
||||||
allAllowed = isAllowed;
|
|
||||||
} else {
|
|
||||||
allAllowed = allAllowed && isAllowed;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (defaultChildClass) {
|
|
||||||
var selectedEl = this.find('#Form_AddForm_PageType div.radio input[value=' + defaultChildClass + ']').parents('li:first');
|
|
||||||
} else {
|
|
||||||
var selectedEl = this.find('#Form_AddForm_PageType div.radio:not(.disabled):first');
|
|
||||||
}
|
|
||||||
selectedEl.setSelected(true);
|
|
||||||
selectedEl.siblings().setSelected(false);
|
|
||||||
|
|
||||||
var buttonState = this.find('#Form_AddForm_PageType div.radio:not(.disabled)').length ? 'enable' : 'disable';
|
|
||||||
this.find('button[name=action_doAdd]').button(buttonState);
|
|
||||||
|
|
||||||
this.find('.message-restricted')[allAllowed ? 'hide' : 'show']();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".cms-add-form #Form_AddForm_PageType div.radio").entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
this.setSelected(true);
|
|
||||||
},
|
|
||||||
setSelected: function setSelected(bool) {
|
|
||||||
var input = this.find('input');
|
|
||||||
if (bool && !input.is(':disabled')) {
|
|
||||||
this.siblings().setSelected(false);
|
|
||||||
this.toggleClass('selected', true);
|
|
||||||
input.prop('checked', true);
|
|
||||||
} else {
|
|
||||||
this.toggleClass('selected', false);
|
|
||||||
input.prop('checked', false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setEnabled: function setEnabled(bool) {
|
|
||||||
$(this).toggleClass('disabled', !bool);
|
|
||||||
if (!bool) {
|
|
||||||
$(this).find('input').attr('disabled', 'disabled').removeAttr('checked');
|
|
||||||
} else {
|
|
||||||
$(this).find('input').removeAttr('disabled');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".cms-content-addpage-button").entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var tree = $('.cms-tree'),
|
|
||||||
list = $('.cms-list'),
|
|
||||||
parentId = 0,
|
|
||||||
extraParams;
|
|
||||||
|
|
||||||
if (tree.is(':visible')) {
|
|
||||||
var selected = tree.jstree('get_selected');
|
|
||||||
parentId = selected ? $(selected[0]).data('id') : null;
|
|
||||||
} else {
|
|
||||||
var state = list.find('input[name="Page[GridState]"]').val();
|
|
||||||
if (state) {
|
|
||||||
parentId = parseInt(JSON.parse(state).ParentID, 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var data = { selector: this.data('targetPanel'), pjax: this.data('pjax') },
|
|
||||||
url;
|
|
||||||
if (parentId) {
|
|
||||||
extraParams = this.data('extraParams') ? this.data('extraParams') : '';
|
|
||||||
url = $.path.addSearchParams(i18n.sprintf(this.data('urlAddpage'), parentId), extraParams);
|
|
||||||
} else {
|
|
||||||
url = this.attr('href');
|
|
||||||
}
|
|
||||||
$('.cms-container').loadPanel(url, null, data);
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
this.blur();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
324
client/dist/js/CMSMain.EditForm.js
vendored
324
client/dist/js/CMSMain.EditForm.js
vendored
@ -1,324 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.CMSMain.EditForm', ['jQuery', 'i18n'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'), require('i18n'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery, global.i18n);
|
|
||||||
global.ssCMSMainEditForm = mod.exports;
|
|
||||||
}
|
|
||||||
})(this, function (_jQuery, _i18n) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var _jQuery2 = _interopRequireDefault(_jQuery);
|
|
||||||
|
|
||||||
var _i18n2 = _interopRequireDefault(_i18n);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) {
|
|
||||||
return obj && obj.__esModule ? obj : {
|
|
||||||
default: obj
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
_jQuery2.default.entwine('ss', function ($) {
|
|
||||||
$('.cms-edit-form :input[name=ClassName]').entwine({
|
|
||||||
onchange: function onchange() {
|
|
||||||
alert(_i18n2.default._t('CMSMAIN.ALERTCLASSNAME'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form input[name=Title]').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
self.data('OrigVal', self.val());
|
|
||||||
|
|
||||||
var form = self.closest('form');
|
|
||||||
var urlSegmentInput = $('input:text[name=URLSegment]', form);
|
|
||||||
var liveLinkInput = $('input[name=LiveLink]', form);
|
|
||||||
|
|
||||||
if (urlSegmentInput.length > 0) {
|
|
||||||
self._addActions();
|
|
||||||
this.bind('change', function (e) {
|
|
||||||
var origTitle = self.data('OrigVal');
|
|
||||||
var title = self.val();
|
|
||||||
self.data('OrigVal', title);
|
|
||||||
|
|
||||||
if (urlSegmentInput.val().indexOf(urlSegmentInput.data('defaultUrl')) === 0 && liveLinkInput.val() == '') {
|
|
||||||
self.updateURLSegment(title);
|
|
||||||
} else {
|
|
||||||
$('.update', self.parent()).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
self.updateRelatedFields(title, origTitle);
|
|
||||||
self.updateBreadcrumbLabel(title);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
|
|
||||||
updateRelatedFields: function updateRelatedFields(title, origTitle) {
|
|
||||||
this.parents('form').find('input[name=MetaTitle], input[name=MenuTitle]').each(function () {
|
|
||||||
var $this = $(this);
|
|
||||||
if ($this.val() == origTitle) {
|
|
||||||
$this.val(title);
|
|
||||||
|
|
||||||
if ($this.updatedRelatedFields) $this.updatedRelatedFields();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
updateURLSegment: function updateURLSegment(title) {
|
|
||||||
var urlSegmentInput = $('input:text[name=URLSegment]', this.closest('form'));
|
|
||||||
var urlSegmentField = urlSegmentInput.closest('.field.urlsegment');
|
|
||||||
var updateURLFromTitle = $('.update', this.parent());
|
|
||||||
urlSegmentField.update(title);
|
|
||||||
if (updateURLFromTitle.is(':visible')) {
|
|
||||||
updateURLFromTitle.hide();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
updateBreadcrumbLabel: function updateBreadcrumbLabel(title) {
|
|
||||||
var pageID = $('.cms-edit-form input[name=ID]').val();
|
|
||||||
var panelCrumb = $('span.cms-panel-link.crumb');
|
|
||||||
if (title && title != "") {
|
|
||||||
panelCrumb.text(title);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_addActions: function _addActions() {
|
|
||||||
var self = this;
|
|
||||||
var updateURLFromTitle;
|
|
||||||
|
|
||||||
updateURLFromTitle = $('<button />', {
|
|
||||||
'class': 'update ss-ui-button-small',
|
|
||||||
'text': _i18n2.default._t('URLSEGMENT.UpdateURL'),
|
|
||||||
'type': 'button',
|
|
||||||
'click': function click(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
self.updateURLSegment(self.val());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateURLFromTitle.insertAfter(self);
|
|
||||||
updateURLFromTitle.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .parentTypeSelector').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var self = this;
|
|
||||||
this.find(':input[name=ParentType]').bind('click', function (e) {
|
|
||||||
self._toggleSelection(e);
|
|
||||||
});
|
|
||||||
this.find('.TreeDropdownField').bind('change', function (e) {
|
|
||||||
self._changeParentId(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
this._changeParentId();
|
|
||||||
this._toggleSelection();
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
|
|
||||||
_toggleSelection: function _toggleSelection(e) {
|
|
||||||
var selected = this.find(':input[name=ParentType]:checked').val(),
|
|
||||||
holder = this.find('#Form_EditForm_ParentID_Holder');
|
|
||||||
|
|
||||||
if (selected == 'root') this.find(':input[name=ParentID]').val(0);else this.find(':input[name=ParentID]').val(this.find('#Form_EditForm_ParentType_subpage').data('parentIdValue'));
|
|
||||||
|
|
||||||
if (selected != 'root') {
|
|
||||||
holder.slideDown(400, function () {
|
|
||||||
$(this).css('overflow', 'visible');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
holder.slideUp();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_changeParentId: function _changeParentId(e) {
|
|
||||||
var value = this.find(':input[name=ParentID]').val();
|
|
||||||
|
|
||||||
this.find('#Form_EditForm_ParentType_subpage').data('parentIdValue', value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form #CanViewType, .cms-edit-form #CanEditType, .cms-edit-form #CanCreateTopLevelType').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var dropdown;
|
|
||||||
if (this.attr('id') == 'CanViewType') dropdown = $('#Form_EditForm_ViewerGroups_Holder');else if (this.attr('id') == 'CanEditType') dropdown = $('#Form_EditForm_EditorGroups_Holder');else if (this.attr('id') == 'CanCreateTopLevelType') dropdown = $('#Form_EditForm_CreateTopLevelGroups_Holder');
|
|
||||||
|
|
||||||
this.find('.optionset :input').bind('change', function (e) {
|
|
||||||
var wrapper = $(this).closest('.middleColumn').parent('div');
|
|
||||||
if (e.target.value == 'OnlyTheseUsers') {
|
|
||||||
wrapper.addClass('remove-splitter');
|
|
||||||
dropdown['show']();
|
|
||||||
} else {
|
|
||||||
wrapper.removeClass('remove-splitter');
|
|
||||||
dropdown['hide']();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
|
|
||||||
dropdown[currentVal == 'OnlyTheseUsers' ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar #Form_EditForm_action_print').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var printURL = $(this[0].form).attr('action').replace(/\?.*$/, '') + '/printable/' + $(':input[name=ID]', this[0].form).val();
|
|
||||||
if (printURL.substr(0, 7) != 'http://') printURL = $('base').attr('href') + printURL;
|
|
||||||
|
|
||||||
window.open(printURL, 'printable');
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar #Form_EditForm_action_rollback').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var form = this.parents('form:first'),
|
|
||||||
version = form.find(':input[name=Version]').val(),
|
|
||||||
message = '';
|
|
||||||
if (version) {
|
|
||||||
message = _i18n2.default.sprintf(_i18n2.default._t('CMSMain.RollbackToVersion'), version);
|
|
||||||
} else {
|
|
||||||
message = _i18n2.default._t('CMSMain.ConfirmRestoreFromLive');
|
|
||||||
}
|
|
||||||
if (confirm(message)) {
|
|
||||||
return this._super(e);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar #Form_EditForm_action_archive').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var form = this.parents('form:first'),
|
|
||||||
version = form.find(':input[name=Version]').val(),
|
|
||||||
message = '';
|
|
||||||
message = _i18n2.default.sprintf(_i18n2.default._t('CMSMain.Archive'), version);
|
|
||||||
if (confirm(message)) {
|
|
||||||
return this._super(e);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar #Form_EditForm_action_restore').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var form = this.parents('form:first'),
|
|
||||||
version = form.find(':input[name=Version]').val(),
|
|
||||||
message = '',
|
|
||||||
toRoot = this.data('toRoot');
|
|
||||||
message = _i18n2.default.sprintf(_i18n2.default._t(toRoot ? 'CMSMain.RestoreToRoot' : 'CMSMain.Restore'), version);
|
|
||||||
if (confirm(message)) {
|
|
||||||
return this._super(e);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar #Form_EditForm_action_delete').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var form = this.parents('form:first'),
|
|
||||||
version = form.find(':input[name=Version]').val(),
|
|
||||||
message = '';
|
|
||||||
message = _i18n2.default.sprintf(_i18n2.default._t('CMSMain.DeleteFromDraft'), version);
|
|
||||||
if (confirm(message)) {
|
|
||||||
return this._super(e);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var form = this.parents('form:first'),
|
|
||||||
version = form.find(':input[name=Version]').val(),
|
|
||||||
message = '';
|
|
||||||
message = _i18n2.default.sprintf(_i18n2.default._t('CMSMain.Unpublish'), version);
|
|
||||||
if (confirm(message)) {
|
|
||||||
return this._super(e);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form.changed').entwine({
|
|
||||||
onmatch: function onmatch(e) {
|
|
||||||
this.find('button[name=action_save]').button('option', 'showingAlternate', true);
|
|
||||||
this.find('button[name=action_publish]').button('option', 'showingAlternate', true);
|
|
||||||
this._super(e);
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch(e) {
|
|
||||||
var saveButton = this.find('button[name=action_save]');
|
|
||||||
if (saveButton.data('button')) saveButton.button('option', 'showingAlternate', false);
|
|
||||||
var publishButton = this.find('button[name=action_publish]');
|
|
||||||
if (publishButton.data('button')) publishButton.button('option', 'showingAlternate', false);
|
|
||||||
this._super(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar button[name=action_publish]').entwine({
|
|
||||||
onbuttonafterrefreshalternate: function onbuttonafterrefreshalternate() {
|
|
||||||
if (this.button('option', 'showingAlternate')) {
|
|
||||||
this.addClass('ss-ui-action-constructive');
|
|
||||||
} else {
|
|
||||||
this.removeClass('ss-ui-action-constructive');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form .btn-toolbar button[name=action_save]').entwine({
|
|
||||||
onbuttonafterrefreshalternate: function onbuttonafterrefreshalternate() {
|
|
||||||
if (this.button('option', 'showingAlternate')) {
|
|
||||||
this.addClass('ss-ui-action-constructive');
|
|
||||||
} else {
|
|
||||||
this.removeClass('ss-ui-action-constructive');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
this.redraw();
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
redraw: function redraw() {
|
|
||||||
var treeField = $('.cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder');
|
|
||||||
if ($(this).attr('id') == 'Form_EditForm_ParentType_root') treeField.slideUp();else treeField.slideDown();
|
|
||||||
},
|
|
||||||
onclick: function onclick() {
|
|
||||||
this.redraw();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr('id') == 'Form_EditForm_ParentType_root') {
|
|
||||||
$('.cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder').hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
163
client/dist/js/CMSMain.Tree.js
vendored
163
client/dist/js/CMSMain.Tree.js
vendored
@ -1,163 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.CMSMain.Tree', ['jQuery', 'i18n'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'), require('i18n'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery, global.i18n);
|
|
||||||
global.ssCMSMainTree = mod.exports;
|
|
||||||
}
|
|
||||||
})(this, function (_jQuery, _i18n) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var _jQuery2 = _interopRequireDefault(_jQuery);
|
|
||||||
|
|
||||||
var _i18n2 = _interopRequireDefault(_i18n);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) {
|
|
||||||
return obj && obj.__esModule ? obj : {
|
|
||||||
default: obj
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
_jQuery2.default.entwine('ss.tree', function ($) {
|
|
||||||
$('.cms-tree').entwine({
|
|
||||||
fromDocument: {
|
|
||||||
'oncontext_show.vakata': function oncontext_showVakata(e) {
|
|
||||||
this.adjustContextClass();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
adjustContextClass: function adjustContextClass() {
|
|
||||||
var menus = $('#vakata-contextmenu').find("ul ul");
|
|
||||||
|
|
||||||
menus.each(function (i) {
|
|
||||||
var col = "1",
|
|
||||||
count = $(menus[i]).find('li').length;
|
|
||||||
|
|
||||||
if (count > 20) {
|
|
||||||
col = "3";
|
|
||||||
} else if (count > 10) {
|
|
||||||
col = "2";
|
|
||||||
}
|
|
||||||
|
|
||||||
$(menus[i]).addClass('col-' + col).removeClass('right');
|
|
||||||
|
|
||||||
$(menus[i]).find('li').on("mouseenter", function (e) {
|
|
||||||
$(this).parent('ul').removeClass("right");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getTreeConfig: function getTreeConfig() {
|
|
||||||
var self = this,
|
|
||||||
config = this._super(),
|
|
||||||
hints = this.getHints();
|
|
||||||
config.plugins.push('contextmenu');
|
|
||||||
config.contextmenu = {
|
|
||||||
'items': function items(node) {
|
|
||||||
|
|
||||||
var menuitems = {
|
|
||||||
edit: {
|
|
||||||
'label': node.hasClass('edit-disabled') ? _i18n2.default._t('Tree.EditPage', 'Edit page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree') : _i18n2.default._t('Tree.ViewPage', 'View page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'),
|
|
||||||
'action': function action(obj) {
|
|
||||||
$('.cms-container').entwine('.ss').loadPanel(_i18n2.default.sprintf(self.data('urlEditpage'), obj.data('id')));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!node.hasClass('nochildren')) {
|
|
||||||
menuitems['showaslist'] = {
|
|
||||||
'label': _i18n2.default._t('Tree.ShowAsList'),
|
|
||||||
'action': function action(obj) {
|
|
||||||
$('.cms-container').entwine('.ss').loadPanel(self.data('urlListview') + '&ParentID=' + obj.data('id'), null, { tabState: { 'pages-controller-cms-content': { 'tabSelector': '.content-listview' } } });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var pagetype = node.data('pagetype'),
|
|
||||||
id = node.data('id'),
|
|
||||||
allowedChildren = node.find('>a .item').data('allowedchildren'),
|
|
||||||
menuAllowedChildren = {},
|
|
||||||
hasAllowedChildren = false;
|
|
||||||
|
|
||||||
$.each(allowedChildren, function (klass, title) {
|
|
||||||
hasAllowedChildren = true;
|
|
||||||
menuAllowedChildren["allowedchildren-" + klass] = {
|
|
||||||
'label': '<span class="jstree-pageicon"></span>' + title,
|
|
||||||
'_class': 'class-' + klass,
|
|
||||||
'action': function action(obj) {
|
|
||||||
$('.cms-container').entwine('.ss').loadPanel($.path.addSearchParams(_i18n2.default.sprintf(self.data('urlAddpage'), id, klass), self.data('extraParams')));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
if (hasAllowedChildren) {
|
|
||||||
menuitems['addsubpage'] = {
|
|
||||||
'label': _i18n2.default._t('Tree.AddSubPage', 'Add page under this page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'),
|
|
||||||
'submenu': menuAllowedChildren
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!node.hasClass('edit-disabled')) {
|
|
||||||
menuitems['duplicate'] = {
|
|
||||||
'label': _i18n2.default._t('Tree.Duplicate'),
|
|
||||||
'submenu': [{
|
|
||||||
'label': _i18n2.default._t('Tree.ThisPageOnly'),
|
|
||||||
'action': function action(obj) {
|
|
||||||
$('.cms-container').entwine('.ss').loadPanel($.path.addSearchParams(_i18n2.default.sprintf(self.data('urlDuplicate'), obj.data('id')), self.data('extraParams')));
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
'label': _i18n2.default._t('Tree.ThisPageAndSubpages'),
|
|
||||||
'action': function action(obj) {
|
|
||||||
$('.cms-container').entwine('.ss').loadPanel($.path.addSearchParams(_i18n2.default.sprintf(self.data('urlDuplicatewithchildren'), obj.data('id')), self.data('extraParams')));
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return menuitems;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-tree a.jstree-clicked').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var self = this,
|
|
||||||
panel = self.parents('.cms-panel-content'),
|
|
||||||
scrollTo;
|
|
||||||
|
|
||||||
if (self.offset().top < 0 || self.offset().top > panel.height() - self.height()) {
|
|
||||||
scrollTo = panel.scrollTop() + self.offset().top + panel.height() / 2;
|
|
||||||
|
|
||||||
panel.animate({
|
|
||||||
scrollTop: scrollTo
|
|
||||||
}, 'slow');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-tree-filtered .clear-filter').entwine({
|
|
||||||
onclick: function onclick() {
|
|
||||||
window.location = location.protocol + '//' + location.host + location.pathname;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-tree-filtered').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var self = this,
|
|
||||||
setHeight = function setHeight() {
|
|
||||||
var height = $('.cms-content-tools .cms-panel-content').height() - self.parent().siblings('.cms-content-toolbar').outerHeight(true);
|
|
||||||
self.css('height', height + 'px');
|
|
||||||
};
|
|
||||||
|
|
||||||
setHeight();
|
|
||||||
$(window).on('resize', window.ss.debounce(setHeight, 300));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
104
client/dist/js/CMSMain.js
vendored
104
client/dist/js/CMSMain.js
vendored
@ -1,104 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.CMSMain', ['jQuery'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery);
|
|
||||||
global.ssCMSMain = 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-header-info').entwine({
|
|
||||||
'from .cms-panel': {
|
|
||||||
ontoggle: function ontoggle(e) {
|
|
||||||
var $treeViewPanel = this.closest('.cms-content').find(e.target);
|
|
||||||
|
|
||||||
if ($treeViewPanel.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.parent()[$treeViewPanel.hasClass('collapsed') ? 'addClass' : 'removeClass']('collapsed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.cms-content-toolbar').entwine({
|
|
||||||
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
|
|
||||||
$.each(this.find('.cms-actions-buttons-row .tool-button'), function () {
|
|
||||||
var $button = $(this),
|
|
||||||
toolId = $button.data('toolid'),
|
|
||||||
isActive = $button.hasClass('active');
|
|
||||||
|
|
||||||
if (toolId !== void 0) {
|
|
||||||
$button.data('active', false).removeClass('active');
|
|
||||||
$('#' + toolId).hide();
|
|
||||||
|
|
||||||
self.bindActionButtonEvents($button);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
|
|
||||||
$.each(this.find('.cms-actions-buttons-row .tool-button'), function () {
|
|
||||||
var $button = $(this);
|
|
||||||
self.unbindActionButtonEvents($button);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
bindActionButtonEvents: function bindActionButtonEvents($button) {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
$button.on('click.cmsContentToolbar', function (e) {
|
|
||||||
self.showHideTool($button);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
unbindActionButtonEvents: function unbindActionButtonEvents($button) {
|
|
||||||
$button.off('.cmsContentToolbar');
|
|
||||||
},
|
|
||||||
|
|
||||||
showHideTool: function showHideTool($button) {
|
|
||||||
var isActive = $button.data('active'),
|
|
||||||
toolId = $button.data('toolid'),
|
|
||||||
$action = $('#' + toolId);
|
|
||||||
|
|
||||||
$.each(this.find('.cms-actions-buttons-row .tool-button'), function () {
|
|
||||||
var $currentButton = $(this),
|
|
||||||
$currentAction = $('#' + $currentButton.data('toolid'));
|
|
||||||
|
|
||||||
if ($currentButton.data('toolid') !== toolId) {
|
|
||||||
$currentAction.hide();
|
|
||||||
$currentButton.data('active', false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$button[isActive ? 'removeClass' : 'addClass']('active');
|
|
||||||
$action[isActive ? 'hide' : 'show']();
|
|
||||||
$button.data('active', !isActive);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
134
client/dist/js/CMSPageHistoryController.js
vendored
134
client/dist/js/CMSPageHistoryController.js
vendored
@ -1,134 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.CMSPageHistoryController', ['jQuery', 'i18n'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'), require('i18n'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery, global.i18n);
|
|
||||||
global.ssCMSPageHistoryController = mod.exports;
|
|
||||||
}
|
|
||||||
})(this, function (_jQuery, _i18n) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var _jQuery2 = _interopRequireDefault(_jQuery);
|
|
||||||
|
|
||||||
var _i18n2 = _interopRequireDefault(_i18n);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) {
|
|
||||||
return obj && obj.__esModule ? obj : {
|
|
||||||
default: obj
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
_jQuery2.default.entwine('ss', function ($) {
|
|
||||||
$('#Form_VersionsForm').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
|
|
||||||
onsubmit: function onsubmit(e, d) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var id,
|
|
||||||
self = this;
|
|
||||||
|
|
||||||
id = this.find(':input[name=ID]').val();
|
|
||||||
|
|
||||||
if (!id) return false;
|
|
||||||
|
|
||||||
var button, url, selected, to, from, compare, data;
|
|
||||||
|
|
||||||
compare = this.find(":input[name=CompareMode]").is(":checked");
|
|
||||||
selected = this.find("table input[type=checkbox]").filter(":checked");
|
|
||||||
|
|
||||||
if (compare) {
|
|
||||||
if (selected.length != 2) return false;
|
|
||||||
|
|
||||||
to = selected.eq(0).val();
|
|
||||||
from = selected.eq(1).val();
|
|
||||||
button = this.find(':submit[name=action_doCompare]');
|
|
||||||
url = _i18n2.default.sprintf(this.data('linkTmplCompare'), id, from, to);
|
|
||||||
} else {
|
|
||||||
to = selected.eq(0).val();
|
|
||||||
button = this.find(':submit[name=action_doShowVersion]');
|
|
||||||
url = _i18n2.default.sprintf(this.data('linkTmplShow'), id, to);
|
|
||||||
}
|
|
||||||
|
|
||||||
$('.cms-container').loadPanel(url, '', { pjax: 'CurrentForm' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#Form_VersionsForm input[name=ShowUnpublished]').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
this.toggle();
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
|
|
||||||
onchange: function onchange() {
|
|
||||||
this.toggle();
|
|
||||||
},
|
|
||||||
toggle: function toggle() {
|
|
||||||
var self = $(this);
|
|
||||||
var form = self.parents('form');
|
|
||||||
|
|
||||||
if (self.attr('checked')) {
|
|
||||||
form.find('tr[data-published=false]').show();
|
|
||||||
} else {
|
|
||||||
form.find("tr[data-published=false]").hide()._unselect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#Form_VersionsForm tbody tr").entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
var compare, selected;
|
|
||||||
|
|
||||||
compare = this.parents("form").find(':input[name=CompareMode]').attr("checked");
|
|
||||||
selected = this.siblings(".active");
|
|
||||||
|
|
||||||
if (compare && this.hasClass('active')) {
|
|
||||||
this._unselect();
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else if (compare) {
|
|
||||||
if (selected.length > 1) {
|
|
||||||
return alert(_i18n2.default._t('ONLYSELECTTWO', 'You can only compare two versions at this time.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
this._select();
|
|
||||||
|
|
||||||
if (selected.length == 1) {
|
|
||||||
this.parents('form').submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
this._select();
|
|
||||||
selected._unselect();
|
|
||||||
|
|
||||||
this.parents("form").submit();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_unselect: function _unselect() {
|
|
||||||
this.removeClass('active');
|
|
||||||
this.find(":input[type=checkbox]").attr("checked", false);
|
|
||||||
},
|
|
||||||
|
|
||||||
_select: function _select() {
|
|
||||||
this.addClass('active');
|
|
||||||
this.find(":input[type=checkbox]").attr("checked", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
48
client/dist/js/RedirectorPage.js
vendored
48
client/dist/js/RedirectorPage.js
vendored
@ -1,48 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.RedirectorPage', ['jQuery'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery);
|
|
||||||
global.ssRedirectorPage = 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 ($) {
|
|
||||||
$('#Form_EditForm_RedirectionType input').entwine({
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
var self = $(this);
|
|
||||||
if (self.attr('checked')) this.toggle();
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onunmatch: function onunmatch() {
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
onclick: function onclick() {
|
|
||||||
this.toggle();
|
|
||||||
},
|
|
||||||
toggle: function toggle() {
|
|
||||||
if ($(this).attr('value') == 'Internal') {
|
|
||||||
$('#Form_EditForm_ExternalURL_Holder').hide();
|
|
||||||
$('#Form_EditForm_LinkToID_Holder').show();
|
|
||||||
} else {
|
|
||||||
$('#Form_EditForm_ExternalURL_Holder').show();
|
|
||||||
$('#Form_EditForm_LinkToID_Holder').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
52
client/dist/js/SilverStripeNavigator.js
vendored
52
client/dist/js/SilverStripeNavigator.js
vendored
@ -1,50 +1,2 @@
|
|||||||
(function (global, factory) {
|
!function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=document.getElementsByTagName("base")[0].href.replace("http://","").replace(/\//g,"_").replace(/\./g,"_");return t+e}var o=r(2),u=n(o);(0,u["default"])(document).ready(function(){(0,u["default"])("#switchView a.newWindow").on("click",function(e){var t=window.open(this.href,i(this.target));return t.focus(),!1}),(0,u["default"])("#SilverStripeNavigatorLink").on("click",function(e){return(0,u["default"])("#SilverStripeNavigatorLinkPopup").toggle(),!1}),(0,u["default"])("#SilverStripeNavigatorLinkPopup a.close").on("click",function(e){return(0,u["default"])("#SilverStripeNavigatorLinkPopup").hide(),!1}),(0,u["default"])("#SilverStripeNavigatorLinkPopup input").on("focus",function(e){this.select()})})},function(e,t){e.exports=jQuery}]);
|
||||||
if (typeof define === "function" && define.amd) {
|
//# sourceMappingURL=SilverStripeNavigator.js.map
|
||||||
define('ss.SilverStripeNavigator', ['jQuery'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery);
|
|
||||||
global.ssSilverStripeNavigator = mod.exports;
|
|
||||||
}
|
|
||||||
})(this, function (_jQuery) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var _jQuery2 = _interopRequireDefault(_jQuery);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) {
|
|
||||||
return obj && obj.__esModule ? obj : {
|
|
||||||
default: obj
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function windowName(suffix) {
|
|
||||||
var base = document.getElementsByTagName('base')[0].href.replace('http://', '').replace(/\//g, '_').replace(/\./g, '_');
|
|
||||||
return base + suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
(0, _jQuery2.default)(document).ready(function () {
|
|
||||||
(0, _jQuery2.default)('#switchView a.newWindow').on('click', function (e) {
|
|
||||||
var w = window.open(this.href, windowName(this.target));
|
|
||||||
w.focus();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
(0, _jQuery2.default)('#SilverStripeNavigatorLink').on('click', function (e) {
|
|
||||||
(0, _jQuery2.default)('#SilverStripeNavigatorLinkPopup').toggle();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
(0, _jQuery2.default)('#SilverStripeNavigatorLinkPopup a.close').on('click', function (e) {
|
|
||||||
(0, _jQuery2.default)('#SilverStripeNavigatorLinkPopup').hide();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
(0, _jQuery2.default)('#SilverStripeNavigatorLinkPopup input').on('focus', function (e) {
|
|
||||||
this.select();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
131
client/dist/js/SiteTreeURLSegmentField.js
vendored
131
client/dist/js/SiteTreeURLSegmentField.js
vendored
@ -1,131 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
if (typeof define === "function" && define.amd) {
|
|
||||||
define('ss.SiteTreeURLSegmentField', ['jQuery'], factory);
|
|
||||||
} else if (typeof exports !== "undefined") {
|
|
||||||
factory(require('jQuery'));
|
|
||||||
} else {
|
|
||||||
var mod = {
|
|
||||||
exports: {}
|
|
||||||
};
|
|
||||||
factory(global.jQuery);
|
|
||||||
global.ssSiteTreeURLSegmentField = 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 ($) {
|
|
||||||
$('.field.urlsegment:not(.readonly)').entwine({
|
|
||||||
MaxPreviewLength: 55,
|
|
||||||
|
|
||||||
Ellipsis: '...',
|
|
||||||
|
|
||||||
onmatch: function onmatch() {
|
|
||||||
if (this.find(':text').length) this.toggleEdit(false);
|
|
||||||
this.redraw();
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
|
|
||||||
redraw: function redraw() {
|
|
||||||
var field = this.find(':text'),
|
|
||||||
url = decodeURI(field.data('prefix') + field.val()),
|
|
||||||
previewUrl = url;
|
|
||||||
|
|
||||||
if (url.length > this.getMaxPreviewLength()) {
|
|
||||||
previewUrl = this.getEllipsis() + url.substr(url.length - this.getMaxPreviewLength(), url.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.find('.preview').attr('href', encodeURI(url + field.data('suffix'))).text(previewUrl);
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleEdit: function toggleEdit(toggle) {
|
|
||||||
var field = this.find(':text');
|
|
||||||
|
|
||||||
this.find('.preview-holder')[toggle ? 'hide' : 'show']();
|
|
||||||
this.find('.edit-holder')[toggle ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
if (toggle) {
|
|
||||||
field.data("origval", field.val());
|
|
||||||
field.focus();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
update: function update() {
|
|
||||||
var self = this,
|
|
||||||
field = this.find(':text'),
|
|
||||||
currentVal = field.data('origval'),
|
|
||||||
title = arguments[0],
|
|
||||||
updateVal = title && title !== "" ? title : field.val();
|
|
||||||
|
|
||||||
if (currentVal != updateVal) {
|
|
||||||
this.addClass('loading');
|
|
||||||
this.suggest(updateVal, function (data) {
|
|
||||||
field.val(decodeURIComponent(data.value));
|
|
||||||
self.toggleEdit(false);
|
|
||||||
self.removeClass('loading');
|
|
||||||
self.redraw();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.toggleEdit(false);
|
|
||||||
this.redraw();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
cancel: function cancel() {
|
|
||||||
var field = this.find(':text');
|
|
||||||
field.val(field.data("origval"));
|
|
||||||
this.toggleEdit(false);
|
|
||||||
},
|
|
||||||
|
|
||||||
suggest: function suggest(val, callback) {
|
|
||||||
var self = this,
|
|
||||||
field = self.find(':text'),
|
|
||||||
urlParts = $.path.parseUrl(self.closest('form').attr('action')),
|
|
||||||
url = urlParts.hrefNoSearch + '/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val);
|
|
||||||
if (urlParts.search) url += '&' + urlParts.search.replace(/^\?/, '');
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
success: function success(data) {
|
|
||||||
callback.apply(this, arguments);
|
|
||||||
},
|
|
||||||
error: function error(xhr, status) {
|
|
||||||
xhr.statusText = xhr.responseText;
|
|
||||||
},
|
|
||||||
complete: function complete() {
|
|
||||||
self.removeClass('loading');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.field.urlsegment .edit').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.closest('.field').toggleEdit(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.field.urlsegment .update').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.closest('.field').update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.field.urlsegment .cancel').entwine({
|
|
||||||
onclick: function onclick(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.closest('.field').cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
2
client/dist/js/bundle-legacy.js
vendored
2
client/dist/js/bundle-legacy.js
vendored
@ -1,2 +0,0 @@
|
|||||||
!function(t){function e(i){if(n[i])return n[i].exports;var a=n[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";n(1),n(3),n(5),n(6),n(7),n(8),n(9),n(10),n(11)},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t(".cms-add-form .parent-mode :input").entwine({onclick:function e(t){if("top"==this.val()){var e=this.closest("form").find("#Form_AddForm_ParentID_Holder .TreeDropdownField");e.setValue(""),e.setTitle("")}}}),t(".cms-add-form").entwine({ParentID:0,ParentCache:{},onadd:function n(){var t=this;this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField").bind("change",function(){t.updateTypeList()}),this.find(".SelectionGroup.parent-mode").bind("change",function(){t.updateTypeList()}),this.updateTypeList()},loadCachedChildren:function i(t){var e=this.getParentCache();return"undefined"!=typeof e[t]?e[t]:null},saveCachedChildren:function a(t,e){var n=this.getParentCache();n[t]=e,this.setParentCache(n)},updateTypeList:function o(){var e=this.data("hints"),n=this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField"),i=this.find("input[name=ParentModeField]:checked").val(),a=n.data("metadata"),o=a&&"child"===i?n.getValue()||this.getParentID():null,s=a?a.ClassName:null,r=s&&"child"===i?s:"Root",d="undefined"!=typeof e[r]?e[r]:null,l=this,c=d&&"undefined"!=typeof d.defaultChild?d.defaultChild:null,u=[];if(o){if(this.hasClass("loading"))return;return this.addClass("loading"),this.setParentID(o),n.getValue()||n.setValue(o),u=this.loadCachedChildren(o),null!==u?(this.updateSelectionFilter(u,c),void this.removeClass("loading")):(t.ajax({url:l.data("childfilter"),data:{ParentID:o},success:function h(t){l.saveCachedChildren(o,t),l.updateSelectionFilter(t,c)},complete:function f(){l.removeClass("loading")}}),!1)}u=d&&"undefined"!=typeof d.disallowedChildren?d.disallowedChildren:[],this.updateSelectionFilter(u,c)},updateSelectionFilter:function s(e,n){var i=null;if(this.find("#Form_AddForm_PageType div.radio").each(function(){var n=t(this).find("input").val(),a=t.inArray(n,e)===-1;t(this).setEnabled(a),a||t(this).setSelected(!1),i=null===i?a:i&&a}),n)var a=this.find("#Form_AddForm_PageType div.radio input[value="+n+"]").parents("li:first");else var a=this.find("#Form_AddForm_PageType div.radio:not(.disabled):first");a.setSelected(!0),a.siblings().setSelected(!1);var o=this.find("#Form_AddForm_PageType div.radio:not(.disabled)").length?"enable":"disable";this.find("button[name=action_doAdd]").button(o),this.find(".message-restricted")[i?"hide":"show"]()}}),t(".cms-add-form #Form_AddForm_PageType div.radio").entwine({onclick:function r(t){this.setSelected(!0)},setSelected:function d(t){var e=this.find("input");t&&!e.is(":disabled")?(this.siblings().setSelected(!1),this.toggleClass("selected",!0),e.prop("checked",!0)):(this.toggleClass("selected",!1),e.prop("checked",!1))},setEnabled:function l(e){t(this).toggleClass("disabled",!e),e?t(this).find("input").removeAttr("disabled"):t(this).find("input").attr("disabled","disabled").removeAttr("checked")}}),t(".cms-content-addpage-button").entwine({onclick:function c(e){var n=t(".cms-tree"),i=t(".cms-list"),a=0,o;if(n.is(":visible")){var s=n.jstree("get_selected");a=s?t(s[0]).data("id"):null}else{var r=i.find('input[name="Page[GridState]"]').val();r&&(a=parseInt(JSON.parse(r).ParentID,10))}var d={selector:this.data("targetPanel"),pjax:this.data("pjax")},l;a?(o=this.data("extraParams")?this.data("extraParams"):"",l=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),a),o)):l=this.attr("href"),t(".cms-container").loadPanel(l,null,d),e.preventDefault(),this.blur()}})})},function(t,e){t.exports=jQuery},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(4),r=i(s);o["default"].entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function e(){alert(r["default"]._t("CMSMAIN.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({onmatch:function n(){var e=this;e.data("OrigVal",e.val());var n=e.closest("form"),i=t("input:text[name=URLSegment]",n),a=t("input[name=LiveLink]",n);i.length>0&&(e._addActions(),this.bind("change",function(n){var o=e.data("OrigVal"),s=e.val();e.data("OrigVal",s),0===i.val().indexOf(i.data("defaultUrl"))&&""==a.val()?e.updateURLSegment(s):t(".update",e.parent()).show(),e.updateRelatedFields(s,o),e.updateBreadcrumbLabel(s)})),this._super()},onunmatch:function i(){this._super()},updateRelatedFields:function a(e,n){this.parents("form").find("input[name=MetaTitle], input[name=MenuTitle]").each(function(){var i=t(this);i.val()==n&&(i.val(e),i.updatedRelatedFields&&i.updatedRelatedFields())})},updateURLSegment:function o(e){var n=t("input:text[name=URLSegment]",this.closest("form")),i=n.closest(".field.urlsegment"),a=t(".update",this.parent());i.update(e),a.is(":visible")&&a.hide()},updateBreadcrumbLabel:function s(e){var n=t(".cms-edit-form input[name=ID]").val(),i=t("span.cms-panel-link.crumb");e&&""!=e&&i.text(e)},_addActions:function d(){var e=this,n;n=t("<button />",{"class":"update ss-ui-button-small",text:r["default"]._t("URLSEGMENT.UpdateURL"),type:"button",click:function i(t){t.preventDefault(),e.updateURLSegment(e.val())}}),n.insertAfter(e),n.hide()}}),t(".cms-edit-form .parentTypeSelector").entwine({onmatch:function l(){var t=this;this.find(":input[name=ParentType]").bind("click",function(e){t._toggleSelection(e)}),this.find(".TreeDropdownField").bind("change",function(e){t._changeParentId(e)}),this._changeParentId(),this._toggleSelection(),this._super()},onunmatch:function c(){this._super()},_toggleSelection:function u(e){var n=this.find(":input[name=ParentType]:checked").val(),i=this.find("#Form_EditForm_ParentID_Holder");"root"==n?this.find(":input[name=ParentID]").val(0):this.find(":input[name=ParentID]").val(this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue")),"root"!=n?i.slideDown(400,function(){t(this).css("overflow","visible")}):i.slideUp()},_changeParentId:function h(t){var e=this.find(":input[name=ParentID]").val();this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue",e)}}),t(".cms-edit-form #CanViewType, .cms-edit-form #CanEditType, .cms-edit-form #CanCreateTopLevelType").entwine({onmatch:function f(){var e;"CanViewType"==this.attr("id")?e=t("#Form_EditForm_ViewerGroups_Holder"):"CanEditType"==this.attr("id")?e=t("#Form_EditForm_EditorGroups_Holder"):"CanCreateTopLevelType"==this.attr("id")&&(e=t("#Form_EditForm_CreateTopLevelGroups_Holder")),this.find(".optionset :input").bind("change",function(n){var i=t(this).closest(".middleColumn").parent("div");"OnlyTheseUsers"==n.target.value?(i.addClass("remove-splitter"),e.show()):(i.removeClass("remove-splitter"),e.hide())});var n=this.find("input[name="+this.attr("id")+"]:checked").val();e["OnlyTheseUsers"==n?"show":"hide"](),this._super()},onunmatch:function m(){this._super()}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_print").entwine({onclick:function p(e){var n=t(this[0].form).attr("action").replace(/\?.*$/,"")+"/printable/"+t(":input[name=ID]",this[0].form).val();return"http://"!=n.substr(0,7)&&(n=t("base").attr("href")+n),window.open(n,"printable"),!1}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_rollback").entwine({onclick:function v(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=n?r["default"].sprintf(r["default"]._t("CMSMain.RollbackToVersion"),n):r["default"]._t("CMSMain.ConfirmRestoreFromLive"),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({onclick:function g(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=r["default"].sprintf(r["default"]._t("CMSMain.Archive"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_restore").entwine({onclick:function _(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="",a=this.data("toRoot");return i=r["default"].sprintf(r["default"]._t(a?"CMSMain.RestoreToRoot":"CMSMain.Restore"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_delete").entwine({onclick:function b(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=r["default"].sprintf(r["default"]._t("CMSMain.DeleteFromDraft"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function w(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=r["default"].sprintf(r["default"]._t("CMSMain.Unpublish"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function C(t){this.find("button[name=action_save]").button("option","showingAlternate",!0),this.find("button[name=action_publish]").button("option","showingAlternate",!0),this._super(t)},onunmatch:function F(t){var e=this.find("button[name=action_save]");e.data("button")&&e.button("option","showingAlternate",!1);var n=this.find("button[name=action_publish]");n.data("button")&&n.button("option","showingAlternate",!1),this._super(t)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({onbuttonafterrefreshalternate:function P(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function S(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")}}),t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({onmatch:function T(){this.redraw(),this._super()},onunmatch:function k(){this._super()},redraw:function x(){var e=t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder");"Form_EditForm_ParentType_root"==t(this).attr("id")?e.slideUp():e.slideDown()},onclick:function E(){this.redraw()}}),"Form_EditForm_ParentType_root"==t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr("id")&&t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder").hide()})},function(t,e){t.exports=i18n},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function e(t){var e=this.closest(".cms-content").find(t.target);0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms-content-toolbar").entwine({onmatch:function n(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),i=n.data("toolid"),a=n.hasClass("active");void 0!==i&&(n.data("active",!1).removeClass("active"),t("#"+i).hide(),e.bindActionButtonEvents(n))})},onunmatch:function i(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this);e.unbindActionButtonEvents(n)})},bindActionButtonEvents:function a(t){var e=this;t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function o(t){t.off(".cmsContentToolbar")},showHideTool:function s(e){var n=e.data("active"),i=e.data("toolid"),a=t("#"+i);t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var e=t(this),n=t("#"+e.data("toolid"));e.data("toolid")!==i&&(n.hide(),e.data("active",!1))}),e[n?"removeClass":"addClass"]("active"),a[n?"hide":"show"](),e.data("active",!n)}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(4),r=i(s);o["default"].entwine("ss.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function e(t){this.adjustContextClass()}},adjustContextClass:function n(){var e=t("#vakata-contextmenu").find("ul ul");e.each(function(n){var i="1",a=t(e[n]).find("li").length;a>20?i="3":a>10&&(i="2"),t(e[n]).addClass("col-"+i).removeClass("right"),t(e[n]).find("li").on("mouseenter",function(e){t(this).parent("ul").removeClass("right")})})},getTreeConfig:function i(){var e=this,n=this._super(),i=this.getHints();return n.plugins.push("contextmenu"),n.contextmenu={items:function a(n){var i={edit:{label:n.hasClass("edit-disabled")?r["default"]._t("Tree.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):r["default"]._t("Tree.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),action:function c(n){t(".cms-container").entwine(".ss").loadPanel(r["default"].sprintf(e.data("urlEditpage"),n.data("id")))}}};n.hasClass("nochildren")||(i.showaslist={label:r["default"]._t("Tree.ShowAsList"),action:function u(n){t(".cms-container").entwine(".ss").loadPanel(e.data("urlListview")+"&ParentID="+n.data("id"),null,{tabState:{"pages-controller-cms-content":{tabSelector:".content-listview"}}})}});var a=n.data("pagetype"),o=n.data("id"),s=n.find(">a .item").data("allowedchildren"),d={},l=!1;return t.each(s,function(n,i){l=!0,d["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+i,_class:"class-"+n,action:function a(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlAddpage"),o,n),e.data("extraParams")))}}}),l&&(i.addsubpage={label:r["default"]._t("Tree.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:d}),n.hasClass("edit-disabled")||(i.duplicate={label:r["default"]._t("Tree.Duplicate"),submenu:[{label:r["default"]._t("Tree.ThisPageOnly"),action:function h(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicate"),n.data("id")),e.data("extraParams")))}},{label:r["default"]._t("Tree.ThisPageAndSubpages"),action:function f(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicatewithchildren"),n.data("id")),e.data("extraParams")))}}]}),i}},n}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function a(){var t=this,e=t.parents(".cms-panel-content"),n;(t.offset().top<0||t.offset().top>e.height()-t.height())&&(n=e.scrollTop()+t.offset().top+e.height()/2,e.animate({scrollTop:n},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function o(){window.location=location.protocol+"//"+location.host+location.pathname}}),t(".cms-tree-filtered").entwine({onmatch:function s(){var e=this,n=function i(){var n=t(".cms-content-tools .cms-panel-content").height()-e.parent().siblings(".cms-content-toolbar").outerHeight(!0);e.css("height",n+"px")};n(),t(window).on("resize",window.ss.debounce(n,300))}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(4),r=i(s);o["default"].entwine("ss",function(t){t("#Form_VersionsForm").entwine({onmatch:function e(){this._super()},onunmatch:function n(){this._super()},onsubmit:function i(e,n){e.preventDefault();var i,a=this;if(i=this.find(":input[name=ID]").val(),!i)return!1;var o,s,d,l,c,u,h;if(u=this.find(":input[name=CompareMode]").is(":checked"),d=this.find("table input[type=checkbox]").filter(":checked"),u){if(2!=d.length)return!1;l=d.eq(0).val(),c=d.eq(1).val(),o=this.find(":submit[name=action_doCompare]"),s=r["default"].sprintf(this.data("linkTmplCompare"),i,c,l)}else l=d.eq(0).val(),o=this.find(":submit[name=action_doShowVersion]"),s=r["default"].sprintf(this.data("linkTmplShow"),i,l);t(".cms-container").loadPanel(s,"",{pjax:"CurrentForm"})}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function a(){this.toggle(),this._super()},onunmatch:function o(){this._super()},onchange:function s(){this.toggle()},toggle:function d(){var e=t(this),n=e.parents("form");e.attr("checked")?n.find("tr[data-published=false]").show():n.find("tr[data-published=false]").hide()._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function l(t){var e,n;return e=this.parents("form").find(":input[name=CompareMode]").attr("checked"),n=this.siblings(".active"),e&&this.hasClass("active")?void this._unselect():e?n.length>1?alert(r["default"]._t("ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),void(1==n.length&&this.parents("form").submit())):(this._select(),n._unselect(),this.parents("form").submit(),void 0)},_unselect:function c(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)},_select:function u(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t("#Form_EditForm_RedirectionType input").entwine({onmatch:function e(){var e=t(this);e.attr("checked")&&this.toggle(),this._super()},onunmatch:function n(){this._super()},onclick:function i(){this.toggle()},toggle:function a(){"Internal"==t(this).attr("value")?(t("#Form_EditForm_ExternalURL_Holder").hide(),t("#Form_EditForm_LinkToID_Holder").show()):(t("#Form_EditForm_ExternalURL_Holder").show(),t("#Form_EditForm_LinkToID_Holder").hide())}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t){var e=document.getElementsByTagName("base")[0].href.replace("http://","").replace(/\//g,"_").replace(/\./g,"_");return e+t}var o=n(2),s=i(o);(0,s["default"])(document).ready(function(){(0,s["default"])("#switchView a.newWindow").on("click",function(t){var e=window.open(this.href,a(this.target));return e.focus(),!1}),(0,s["default"])("#SilverStripeNavigatorLink").on("click",function(t){return(0,s["default"])("#SilverStripeNavigatorLinkPopup").toggle(),!1}),(0,s["default"])("#SilverStripeNavigatorLinkPopup a.close").on("click",function(t){return(0,s["default"])("#SilverStripeNavigatorLinkPopup").hide(),!1}),(0,s["default"])("#SilverStripeNavigatorLinkPopup input").on("focus",function(t){this.select()})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function e(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),this._super()},redraw:function n(){var t=this.find(":text"),e=decodeURI(t.data("prefix")+t.val()),n=e;e.length>this.getMaxPreviewLength()&&(n=this.getEllipsis()+e.substr(e.length-this.getMaxPreviewLength(),e.length)),this.find(".preview").attr("href",encodeURI(e+t.data("suffix"))).text(n)},toggleEdit:function i(t){var e=this.find(":text");this.find(".preview-holder")[t?"hide":"show"](),this.find(".edit-holder")[t?"show":"hide"](),t&&(e.data("origval",e.val()),e.focus())},update:function a(){var t=this,e=this.find(":text"),n=e.data("origval"),i=arguments[0],a=i&&""!==i?i:e.val();n!=a?(this.addClass("loading"),this.suggest(a,function(n){e.val(decodeURIComponent(n.value)),t.toggleEdit(!1),t.removeClass("loading"),t.redraw()})):(this.toggleEdit(!1),this.redraw())},cancel:function o(){var t=this.find(":text");t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function s(e,n){var i=this,a=i.find(":text"),o=t.path.parseUrl(i.closest("form").attr("action")),s=o.hrefNoSearch+"/field/"+a.attr("name")+"/suggest/?value="+encodeURIComponent(e);o.search&&(s+="&"+o.search.replace(/^\?/,"")),t.ajax({url:s,success:function r(t){n.apply(this,arguments)},error:function d(t,e){t.statusText=t.responseText},complete:function l(){i.removeClass("loading")}})}}),t(".field.urlsegment .edit").entwine({onclick:function r(t){t.preventDefault(),this.closest(".field").toggleEdit(!0)}}),t(".field.urlsegment .update").entwine({onclick:function d(t){t.preventDefault(),this.closest(".field").update()}}),t(".field.urlsegment .cancel").entwine({onclick:function l(t){t.preventDefault(),this.closest(".field").cancel()}})})},function(t,e){}]);
|
|
||||||
//# sourceMappingURL=bundle-legacy.js.map
|
|
2
client/dist/js/bundle.js
vendored
Normal file
2
client/dist/js/bundle.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
!function(t){function e(i){if(n[i])return n[i].exports;var a=n[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";n(3),n(4),n(6),n(7),n(8),n(9),n(10),n(11)},,function(t,e){t.exports=jQuery},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t(".cms-add-form .parent-mode :input").entwine({onclick:function e(t){if("top"==this.val()){var e=this.closest("form").find("#Form_AddForm_ParentID_Holder .TreeDropdownField");e.setValue(""),e.setTitle("")}}}),t(".cms-add-form").entwine({ParentID:0,ParentCache:{},onadd:function n(){var t=this;this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField").bind("change",function(){t.updateTypeList()}),this.find(".SelectionGroup.parent-mode").bind("change",function(){t.updateTypeList()}),this.updateTypeList()},loadCachedChildren:function i(t){var e=this.getParentCache();return"undefined"!=typeof e[t]?e[t]:null},saveCachedChildren:function a(t,e){var n=this.getParentCache();n[t]=e,this.setParentCache(n)},updateTypeList:function o(){var e=this.data("hints"),n=this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField"),i=this.find("input[name=ParentModeField]:checked").val(),a=n.data("metadata"),o=a&&"child"===i?n.getValue()||this.getParentID():null,s=a?a.ClassName:null,r=s&&"child"===i?s:"Root",d="undefined"!=typeof e[r]?e[r]:null,l=this,c=d&&"undefined"!=typeof d.defaultChild?d.defaultChild:null,u=[];if(o){if(this.hasClass("loading"))return;return this.addClass("loading"),this.setParentID(o),n.getValue()||n.setValue(o),u=this.loadCachedChildren(o),null!==u?(this.updateSelectionFilter(u,c),void this.removeClass("loading")):(t.ajax({url:l.data("childfilter"),data:{ParentID:o},success:function h(t){l.saveCachedChildren(o,t),l.updateSelectionFilter(t,c)},complete:function f(){l.removeClass("loading")}}),!1)}u=d&&"undefined"!=typeof d.disallowedChildren?d.disallowedChildren:[],this.updateSelectionFilter(u,c)},updateSelectionFilter:function s(e,n){var i=null;if(this.find("#Form_AddForm_PageType div.radio").each(function(){var n=t(this).find("input").val(),a=t.inArray(n,e)===-1;t(this).setEnabled(a),a||t(this).setSelected(!1),i=null===i?a:i&&a}),n)var a=this.find("#Form_AddForm_PageType div.radio input[value="+n+"]").parents("li:first");else var a=this.find("#Form_AddForm_PageType div.radio:not(.disabled):first");a.setSelected(!0),a.siblings().setSelected(!1);var o=this.find("#Form_AddForm_PageType div.radio:not(.disabled)").length?"enable":"disable";this.find("button[name=action_doAdd]").button(o),this.find(".message-restricted")[i?"hide":"show"]()}}),t(".cms-add-form #Form_AddForm_PageType div.radio").entwine({onclick:function r(t){this.setSelected(!0)},setSelected:function d(t){var e=this.find("input");t&&!e.is(":disabled")?(this.siblings().setSelected(!1),this.toggleClass("selected",!0),e.prop("checked",!0)):(this.toggleClass("selected",!1),e.prop("checked",!1))},setEnabled:function l(e){t(this).toggleClass("disabled",!e),e?t(this).find("input").removeAttr("disabled"):t(this).find("input").attr("disabled","disabled").removeAttr("checked")}}),t(".cms-content-addpage-button").entwine({onclick:function c(e){var n=t(".cms-tree"),i=t(".cms-list"),a=0,o;if(n.is(":visible")){var s=n.jstree("get_selected");a=s?t(s[0]).data("id"):null}else{var r=i.find('input[name="Page[GridState]"]').val();r&&(a=parseInt(JSON.parse(r).ParentID,10))}var d={selector:this.data("targetPanel"),pjax:this.data("pjax")},l;a?(o=this.data("extraParams")?this.data("extraParams"):"",l=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),a),o)):l=this.attr("href"),t(".cms-container").loadPanel(l,null,d),e.preventDefault(),this.blur()}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s);o["default"].entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function e(){alert(r["default"]._t("CMSMAIN.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({onmatch:function n(){var e=this;e.data("OrigVal",e.val());var n=e.closest("form"),i=t("input:text[name=URLSegment]",n),a=t("input[name=LiveLink]",n);i.length>0&&(e._addActions(),this.bind("change",function(n){var o=e.data("OrigVal"),s=e.val();e.data("OrigVal",s),0===i.val().indexOf(i.data("defaultUrl"))&&""==a.val()?e.updateURLSegment(s):t(".update",e.parent()).show(),e.updateRelatedFields(s,o),e.updateBreadcrumbLabel(s)})),this._super()},onunmatch:function i(){this._super()},updateRelatedFields:function a(e,n){this.parents("form").find("input[name=MetaTitle], input[name=MenuTitle]").each(function(){var i=t(this);i.val()==n&&(i.val(e),i.updatedRelatedFields&&i.updatedRelatedFields())})},updateURLSegment:function o(e){var n=t("input:text[name=URLSegment]",this.closest("form")),i=n.closest(".field.urlsegment"),a=t(".update",this.parent());i.update(e),a.is(":visible")&&a.hide()},updateBreadcrumbLabel:function s(e){var n=t(".cms-edit-form input[name=ID]").val(),i=t("span.cms-panel-link.crumb");e&&""!=e&&i.text(e)},_addActions:function d(){var e=this,n;n=t("<button />",{"class":"update ss-ui-button-small",text:r["default"]._t("URLSEGMENT.UpdateURL"),type:"button",click:function i(t){t.preventDefault(),e.updateURLSegment(e.val())}}),n.insertAfter(e),n.hide()}}),t(".cms-edit-form .parentTypeSelector").entwine({onmatch:function l(){var t=this;this.find(":input[name=ParentType]").bind("click",function(e){t._toggleSelection(e)}),this.find(".TreeDropdownField").bind("change",function(e){t._changeParentId(e)}),this._changeParentId(),this._toggleSelection(),this._super()},onunmatch:function c(){this._super()},_toggleSelection:function u(e){var n=this.find(":input[name=ParentType]:checked").val(),i=this.find("#Form_EditForm_ParentID_Holder");"root"==n?this.find(":input[name=ParentID]").val(0):this.find(":input[name=ParentID]").val(this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue")),"root"!=n?i.slideDown(400,function(){t(this).css("overflow","visible")}):i.slideUp()},_changeParentId:function h(t){var e=this.find(":input[name=ParentID]").val();this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue",e)}}),t(".cms-edit-form #CanViewType, .cms-edit-form #CanEditType, .cms-edit-form #CanCreateTopLevelType").entwine({onmatch:function f(){var e;"CanViewType"==this.attr("id")?e=t("#Form_EditForm_ViewerGroups_Holder"):"CanEditType"==this.attr("id")?e=t("#Form_EditForm_EditorGroups_Holder"):"CanCreateTopLevelType"==this.attr("id")&&(e=t("#Form_EditForm_CreateTopLevelGroups_Holder")),this.find(".optionset :input").bind("change",function(n){var i=t(this).closest(".middleColumn").parent("div");"OnlyTheseUsers"==n.target.value?(i.addClass("remove-splitter"),e.show()):(i.removeClass("remove-splitter"),e.hide())});var n=this.find("input[name="+this.attr("id")+"]:checked").val();e["OnlyTheseUsers"==n?"show":"hide"](),this._super()},onunmatch:function m(){this._super()}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_print").entwine({onclick:function p(e){var n=t(this[0].form).attr("action").replace(/\?.*$/,"")+"/printable/"+t(":input[name=ID]",this[0].form).val();return"http://"!=n.substr(0,7)&&(n=t("base").attr("href")+n),window.open(n,"printable"),!1}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_rollback").entwine({onclick:function v(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=n?r["default"].sprintf(r["default"]._t("CMSMain.RollbackToVersion"),n):r["default"]._t("CMSMain.ConfirmRestoreFromLive"),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({onclick:function g(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=r["default"].sprintf(r["default"]._t("CMSMain.Archive"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_restore").entwine({onclick:function _(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="",a=this.data("toRoot");return i=r["default"].sprintf(r["default"]._t(a?"CMSMain.RestoreToRoot":"CMSMain.Restore"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_delete").entwine({onclick:function b(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=r["default"].sprintf(r["default"]._t("CMSMain.DeleteFromDraft"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function w(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=r["default"].sprintf(r["default"]._t("CMSMain.Unpublish"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function C(t){this.find("button[name=action_save]").button("option","showingAlternate",!0),this.find("button[name=action_publish]").button("option","showingAlternate",!0),this._super(t)},onunmatch:function F(t){var e=this.find("button[name=action_save]");e.data("button")&&e.button("option","showingAlternate",!1);var n=this.find("button[name=action_publish]");n.data("button")&&n.button("option","showingAlternate",!1),this._super(t)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({onbuttonafterrefreshalternate:function P(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function T(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")}}),t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({onmatch:function S(){this.redraw(),this._super()},onunmatch:function k(){this._super()},redraw:function x(){var e=t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder");"Form_EditForm_ParentType_root"==t(this).attr("id")?e.slideUp():e.slideDown()},onclick:function E(){this.redraw()}}),"Form_EditForm_ParentType_root"==t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr("id")&&t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder").hide()})},function(t,e){t.exports=i18n},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function e(t){var e=this.closest(".cms-content").find(t.target);0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms-content-toolbar").entwine({onmatch:function n(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),i=n.data("toolid"),a=n.hasClass("active");void 0!==i&&(n.data("active",!1).removeClass("active"),t("#"+i).hide(),e.bindActionButtonEvents(n))})},onunmatch:function i(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this);e.unbindActionButtonEvents(n)})},bindActionButtonEvents:function a(t){var e=this;t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function o(t){t.off(".cmsContentToolbar")},showHideTool:function s(e){var n=e.data("active"),i=e.data("toolid"),a=t("#"+i);t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var e=t(this),n=t("#"+e.data("toolid"));e.data("toolid")!==i&&(n.hide(),e.data("active",!1))}),e[n?"removeClass":"addClass"]("active"),a[n?"hide":"show"](),e.data("active",!n)}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s);o["default"].entwine("ss.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function e(t){this.adjustContextClass()}},adjustContextClass:function n(){var e=t("#vakata-contextmenu").find("ul ul");e.each(function(n){var i="1",a=t(e[n]).find("li").length;a>20?i="3":a>10&&(i="2"),t(e[n]).addClass("col-"+i).removeClass("right"),t(e[n]).find("li").on("mouseenter",function(e){t(this).parent("ul").removeClass("right")})})},getTreeConfig:function i(){var e=this,n=this._super(),i=this.getHints();return n.plugins.push("contextmenu"),n.contextmenu={items:function a(n){var i={edit:{label:n.hasClass("edit-disabled")?r["default"]._t("Tree.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):r["default"]._t("Tree.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),action:function c(n){t(".cms-container").entwine(".ss").loadPanel(r["default"].sprintf(e.data("urlEditpage"),n.data("id")))}}};n.hasClass("nochildren")||(i.showaslist={label:r["default"]._t("Tree.ShowAsList"),action:function u(n){t(".cms-container").entwine(".ss").loadPanel(e.data("urlListview")+"&ParentID="+n.data("id"),null,{tabState:{"pages-controller-cms-content":{tabSelector:".content-listview"}}})}});var a=n.data("pagetype"),o=n.data("id"),s=n.find(">a .item").data("allowedchildren"),d={},l=!1;return t.each(s,function(n,i){l=!0,d["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+i,_class:"class-"+n,action:function a(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlAddpage"),o,n),e.data("extraParams")))}}}),l&&(i.addsubpage={label:r["default"]._t("Tree.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:d}),n.hasClass("edit-disabled")||(i.duplicate={label:r["default"]._t("Tree.Duplicate"),submenu:[{label:r["default"]._t("Tree.ThisPageOnly"),action:function h(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicate"),n.data("id")),e.data("extraParams")))}},{label:r["default"]._t("Tree.ThisPageAndSubpages"),action:function f(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicatewithchildren"),n.data("id")),e.data("extraParams")))}}]}),i}},n}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function a(){var t=this,e=t.parents(".cms-panel-content"),n;(t.offset().top<0||t.offset().top>e.height()-t.height())&&(n=e.scrollTop()+t.offset().top+e.height()/2,e.animate({scrollTop:n},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function o(){window.location=location.protocol+"//"+location.host+location.pathname}}),t(".cms-tree-filtered").entwine({onmatch:function s(){var e=this,n=function i(){var n=t(".cms-content-tools .cms-panel-content").height()-e.parent().siblings(".cms-content-toolbar").outerHeight(!0);e.css("height",n+"px")};n(),t(window).on("resize",window.ss.debounce(n,300))}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s);o["default"].entwine("ss",function(t){t("#Form_VersionsForm").entwine({onmatch:function e(){this._super()},onunmatch:function n(){this._super()},onsubmit:function i(e,n){e.preventDefault();var i,a=this;if(i=this.find(":input[name=ID]").val(),!i)return!1;var o,s,d,l,c,u,h;if(u=this.find(":input[name=CompareMode]").is(":checked"),d=this.find("table input[type=checkbox]").filter(":checked"),u){if(2!=d.length)return!1;l=d.eq(0).val(),c=d.eq(1).val(),o=this.find(":submit[name=action_doCompare]"),s=r["default"].sprintf(this.data("linkTmplCompare"),i,c,l)}else l=d.eq(0).val(),o=this.find(":submit[name=action_doShowVersion]"),s=r["default"].sprintf(this.data("linkTmplShow"),i,l);t(".cms-container").loadPanel(s,"",{pjax:"CurrentForm"})}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function a(){this.toggle(),this._super()},onunmatch:function o(){this._super()},onchange:function s(){this.toggle()},toggle:function d(){var e=t(this),n=e.parents("form");e.attr("checked")?n.find("tr[data-published=false]").show():n.find("tr[data-published=false]").hide()._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function l(t){var e,n;return e=this.parents("form").find(":input[name=CompareMode]").attr("checked"),n=this.siblings(".active"),e&&this.hasClass("active")?void this._unselect():e?n.length>1?alert(r["default"]._t("ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),void(1==n.length&&this.parents("form").submit())):(this._select(),n._unselect(),this.parents("form").submit(),void 0)},_unselect:function c(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)},_select:function u(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t("#Form_EditForm_RedirectionType input").entwine({onmatch:function e(){var e=t(this);e.attr("checked")&&this.toggle(),this._super()},onunmatch:function n(){this._super()},onclick:function i(){this.toggle()},toggle:function a(){"Internal"==t(this).attr("value")?(t("#Form_EditForm_ExternalURL_Holder").hide(),t("#Form_EditForm_LinkToID_Holder").show()):(t("#Form_EditForm_ExternalURL_Holder").show(),t("#Form_EditForm_LinkToID_Holder").hide())}})})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a);o["default"].entwine("ss",function(t){t(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function e(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),this._super()},redraw:function n(){var t=this.find(":text"),e=decodeURI(t.data("prefix")+t.val()),n=e;e.length>this.getMaxPreviewLength()&&(n=this.getEllipsis()+e.substr(e.length-this.getMaxPreviewLength(),e.length)),this.find(".preview").attr("href",encodeURI(e+t.data("suffix"))).text(n)},toggleEdit:function i(t){var e=this.find(":text");this.find(".preview-holder")[t?"hide":"show"](),this.find(".edit-holder")[t?"show":"hide"](),t&&(e.data("origval",e.val()),e.focus())},update:function a(){var t=this,e=this.find(":text"),n=e.data("origval"),i=arguments[0],a=i&&""!==i?i:e.val();n!=a?(this.addClass("loading"),this.suggest(a,function(n){e.val(decodeURIComponent(n.value)),t.toggleEdit(!1),t.removeClass("loading"),t.redraw()})):(this.toggleEdit(!1),this.redraw())},cancel:function o(){var t=this.find(":text");t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function s(e,n){var i=this,a=i.find(":text"),o=t.path.parseUrl(i.closest("form").attr("action")),s=o.hrefNoSearch+"/field/"+a.attr("name")+"/suggest/?value="+encodeURIComponent(e);o.search&&(s+="&"+o.search.replace(/^\?/,"")),t.ajax({url:s,success:function r(t){n.apply(this,arguments)},error:function d(t,e){t.statusText=t.responseText},complete:function l(){i.removeClass("loading")}})}}),t(".field.urlsegment .edit").entwine({onclick:function r(t){t.preventDefault(),this.closest(".field").toggleEdit(!0)}}),t(".field.urlsegment .update").entwine({onclick:function d(t){t.preventDefault(),this.closest(".field").update()}}),t(".field.urlsegment .cancel").entwine({onclick:function l(t){t.preventDefault(),this.closest(".field").cancel()}})})},function(t,e){}]);
|
||||||
|
//# sourceMappingURL=bundle.js.map
|
@ -4,7 +4,6 @@ require('../legacy/CMSMain.js');
|
|||||||
require('../legacy/CMSMain.Tree.js');
|
require('../legacy/CMSMain.Tree.js');
|
||||||
require('../legacy/CMSPageHistoryController.js');
|
require('../legacy/CMSPageHistoryController.js');
|
||||||
require('../legacy/RedirectorPage.js');
|
require('../legacy/RedirectorPage.js');
|
||||||
require('../legacy/SilverStripeNavigator.js');
|
|
||||||
require('../legacy/SiteTreeURLSegmentField.js');
|
require('../legacy/SiteTreeURLSegmentField.js');
|
||||||
|
|
||||||
require('../styles/bundle.scss');
|
require('../styles/bundle.scss');
|
@ -140,21 +140,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
Requirements::javascript(CMS_DIR . '/client/dist/js/bundle.js');
|
||||||
|
Requirements::javascript(CMS_DIR . '/client/dist/js/SilverStripeNavigator.js');
|
||||||
Requirements::css(CMS_DIR . '/client/dist/styles/bundle.css');
|
Requirements::css(CMS_DIR . '/client/dist/styles/bundle.css');
|
||||||
Requirements::customCSS($this->generatePageIconsCss());
|
Requirements::customCSS($this->generatePageIconsCss());
|
||||||
Requirements::add_i18n_javascript(CMS_DIR . '/client/lang', false, true);
|
Requirements::add_i18n_javascript(CMS_DIR . '/client/lang', false, true);
|
||||||
Requirements::javascript(CMS_DIR . '/client/dist/js/bundle-legacy.js', [
|
|
||||||
'provides' => [
|
|
||||||
CMS_DIR . '/client/dist/js/CMSMain.AddForm.js',
|
|
||||||
CMS_DIR . '/client/dist/js/CMSMain.EditForm.js',
|
|
||||||
CMS_DIR . '/client/dist/js/CMSMain.js',
|
|
||||||
CMS_DIR . '/client/dist/js/CMSMain.Tree.js',
|
|
||||||
CMS_DIR . '/client/dist/js/CMSPageHistoryController.js',
|
|
||||||
CMS_DIR . '/client/dist/js/RedirectorPage.js',
|
|
||||||
CMS_DIR . '/client/dist/js/SilverStripeNavigator.js',
|
|
||||||
CMS_DIR . '/client/dist/js/SiteTreeURLSegmentField.js'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
CMSBatchActionHandler::register('publish', 'SilverStripe\\CMS\\BatchActions\\CMSBatchAction_Publish');
|
CMSBatchActionHandler::register('publish', 'SilverStripe\\CMS\\BatchActions\\CMSBatchAction_Publish');
|
||||||
CMSBatchActionHandler::register('unpublish', 'SilverStripe\\CMS\\BatchActions\\CMSBatchAction_Unpublish');
|
CMSBatchActionHandler::register('unpublish', 'SilverStripe\\CMS\\BatchActions\\CMSBatchAction_Unpublish');
|
||||||
|
@ -42,9 +42,6 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function Field($properties = array()) {
|
public function Field($properties = array()) {
|
||||||
Requirements::javascript(CMS_DIR . '/client/dist/js/SiteTreeURLSegmentField.js');
|
|
||||||
Requirements::add_i18n_javascript(CMS_DIR . '/client/lang', false, true);
|
|
||||||
Requirements::css(FRAMEWORK_ADMIN_DIR . '/client/dist/styles/bundle.css');
|
|
||||||
return parent::Field($properties);
|
return parent::Field($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ const SUPPORTED_BROWSERS = [
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
'bundle-legacy': `${PATHS.CMS_JS_SRC}/bundles/legacy.js`,
|
bundle: `${PATHS.CMS_JS_SRC}/bundles/bundle.js`,
|
||||||
// SilverStripeNavigator: `${PATHS.CMS_CSS_SRC}/SilverStripeNavigator.scss`,
|
// See https://github.com/webpack/webpack/issues/300#issuecomment-45313650
|
||||||
|
SilverStripeNavigator: [`${PATHS.CMS_JS_SRC}/legacy/SilverStripeNavigator.js`],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
modulesDirectories: [PATHS.CMS_JS_SRC, PATHS.MODULES],
|
modulesDirectories: [PATHS.CMS_JS_SRC, PATHS.MODULES],
|
||||||
|
Loading…
Reference in New Issue
Block a user