mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUG Fix issue with old asset-admin repeating "level up" button
BUG Fix incorrectly built dist files
This commit is contained in:
parent
8e9a243966
commit
7c151321b4
8
client/dist/js/AssetAdmin.js
vendored
8
client/dist/js/AssetAdmin.js
vendored
@ -42,7 +42,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.AssetAdmin.cms-edit-form .ss-gridfield .col-buttons .action.gridfield-button-delete, .AssetAdmin.cms-edit-form .Actions button.action.action-delete').entwine({
|
||||
$('.AssetAdmin.cms-edit-form .ss-gridfield .col-buttons .action.gridfield-button-delete, .AssetAdmin.cms-edit-form .btn-toolbar button.action.action-delete').entwine({
|
||||
onclick: function onclick(e) {
|
||||
var msg;
|
||||
if (this.closest('.ss-gridfield-item').data('class') == 'Folder') {
|
||||
@ -103,11 +103,5 @@
|
||||
$('.AssetAdmin.cms-edit-form .ss-gridfield').reload();
|
||||
}
|
||||
});
|
||||
|
||||
$('.AssetAdmin .grid-levelup').entwine({
|
||||
onmatch: function onmatch() {
|
||||
this.closest('.ui-tabs-panel').find('.cms-actions-row').prepend(this);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
40
client/dist/js/CMSMain.AddForm.js
vendored
40
client/dist/js/CMSMain.AddForm.js
vendored
@ -37,6 +37,7 @@
|
||||
ParentCache: {},
|
||||
onadd: function onadd() {
|
||||
var self = this;
|
||||
|
||||
this.find('#Form_AddForm_ParentID_Holder .TreeDropdownField').bind('change', function () {
|
||||
self.updateTypeList();
|
||||
});
|
||||
@ -95,37 +96,44 @@
|
||||
|
||||
return false;
|
||||
} else {
|
||||
disallowedChildren = hint && typeof hint.disallowedChildren !== 'undefined' ? hint.disallowedChildren : [], this.updateSelectionFilter(disallowedChildren, defaultChildClass);
|
||||
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 li').each(function () {
|
||||
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 (!isAllowed) {
|
||||
$(this).setSelected(false);
|
||||
}
|
||||
if (allAllowed === null) {
|
||||
allAllowed = isAllowed;
|
||||
} else {
|
||||
allAllowed = allAllowed && isAllowed;
|
||||
}
|
||||
});
|
||||
|
||||
if (defaultChildClass) {
|
||||
var selectedEl = this.find('#Form_AddForm_PageType li input[value=' + defaultChildClass + ']').parents('li:first');
|
||||
var selectedEl = this.find('#Form_AddForm_PageType div.radio input[value=' + defaultChildClass + ']').parents('li:first');
|
||||
} else {
|
||||
var selectedEl = this.find('#Form_AddForm_PageType li:not(.disabled):first');
|
||||
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 li:not(.disabled)').length ? 'enable' : 'disable';
|
||||
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 li").entwine({
|
||||
$(".cms-add-form #Form_AddForm_PageType div.radio").entwine({
|
||||
onclick: function onclick(e) {
|
||||
this.setSelected(true);
|
||||
},
|
||||
@ -142,22 +150,29 @@
|
||||
},
|
||||
setEnabled: function setEnabled(bool) {
|
||||
$(this).toggleClass('disabled', !bool);
|
||||
if (!bool) $(this).find('input').attr('disabled', 'disabled').removeAttr('checked');else $(this).find('input').removeAttr('disabled');
|
||||
if (!bool) {
|
||||
$(this).find('input').attr('disabled', 'disabled').removeAttr('checked');
|
||||
} else {
|
||||
$(this).find('input').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".cms-page-add-button").entwine({
|
||||
$(".cms-content-addpage-button").entwine({
|
||||
onclick: function onclick(e) {
|
||||
var tree = $('.cms-tree'),
|
||||
list = $('.cms-list'),
|
||||
parentId = 0;
|
||||
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);
|
||||
if (state) {
|
||||
parentId = parseInt(JSON.parse(state).ParentID, 10);
|
||||
}
|
||||
}
|
||||
|
||||
var data = { selector: this.data('targetPanel'), pjax: this.data('pjax') },
|
||||
@ -168,7 +183,6 @@
|
||||
} else {
|
||||
url = this.attr('href');
|
||||
}
|
||||
|
||||
$('.cms-container').loadPanel(url, null, data);
|
||||
e.preventDefault();
|
||||
|
||||
|
16
client/dist/js/CMSMain.EditForm.js
vendored
16
client/dist/js/CMSMain.EditForm.js
vendored
@ -179,7 +179,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_print').entwine({
|
||||
$('.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;
|
||||
@ -190,7 +190,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_rollback').entwine({
|
||||
$('.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(),
|
||||
@ -208,7 +208,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_archive').entwine({
|
||||
$('.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(),
|
||||
@ -222,7 +222,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_restore').entwine({
|
||||
$('.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(),
|
||||
@ -237,7 +237,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_delete').entwine({
|
||||
$('.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(),
|
||||
@ -251,7 +251,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_unpublish').entwine({
|
||||
$('.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(),
|
||||
@ -280,7 +280,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions button[name=action_publish]').entwine({
|
||||
$('.cms-edit-form .btn-toolbar button[name=action_publish]').entwine({
|
||||
onbuttonafterrefreshalternate: function onbuttonafterrefreshalternate() {
|
||||
if (this.button('option', 'showingAlternate')) {
|
||||
this.addClass('ss-ui-action-constructive');
|
||||
@ -290,7 +290,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.cms-edit-form .Actions button[name=action_save]').entwine({
|
||||
$('.cms-edit-form .btn-toolbar button[name=action_save]').entwine({
|
||||
onbuttonafterrefreshalternate: function onbuttonafterrefreshalternate() {
|
||||
if (this.button('option', 'showingAlternate')) {
|
||||
this.addClass('ss-ui-action-constructive');
|
||||
|
@ -133,10 +133,4 @@ $.entwine('ss', function($){
|
||||
$('.AssetAdmin.cms-edit-form .ss-gridfield').reload();
|
||||
}
|
||||
});
|
||||
|
||||
$('.AssetAdmin .grid-levelup').entwine({
|
||||
onmatch: function () {
|
||||
this.closest('.ui-tabs-panel').find('.cms-actions-row').prepend(this);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -166,7 +166,7 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
|
||||
new GridFieldEditButton(),
|
||||
new GridFieldDeleteAction(),
|
||||
new GridFieldDetailForm(),
|
||||
GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d')
|
||||
GridFieldLevelup::create($folder->ID)->setLinkSpec($this->Link('show') . '/%d')
|
||||
);
|
||||
|
||||
$gridField = GridField::create('File', $title, $this->getList(), $gridFieldConfig);
|
||||
|
@ -101,12 +101,15 @@ gulp.task('bundle-legacy', function bundleLeftAndMain() {
|
||||
});
|
||||
|
||||
gulp.task('umd-cms', () => { // eslint-disable-line
|
||||
return transformToUmd(glob.sync(`${PATHS.CMS_JS_SRC}/*.js`), PATHS.CMS_JS_DIST);
|
||||
return transformToUmd(glob.sync(
|
||||
`${PATHS.CMS_JS_SRC}/**/*.js`,
|
||||
{ ignore: `${PATHS.CMS_JS_SRC}/bundles/*` }
|
||||
), PATHS.CMS_JS_DIST);
|
||||
});
|
||||
|
||||
gulp.task('umd-watch', () => { // eslint-disable-line
|
||||
if (isDev) {
|
||||
gulp.watch(`${PATHS.CMS_JS_SRC}/*.js`, ['umd-cms']);
|
||||
gulp.watch(`${PATHS.CMS_JS_SRC}/**/*.js`, ['umd-cms']);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user