mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ecbee33385
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@104369 467b73ca-7a2a-4603-9d3b-597d59a354a9
79 lines
1.9 KiB
JavaScript
Executable File
79 lines
1.9 KiB
JavaScript
Executable File
/**
|
|
* File: AssetAdmin.js
|
|
*/
|
|
|
|
/**
|
|
* Configuration for the left hand tree
|
|
*/
|
|
if(typeof SiteTreeHandlers == 'undefined') SiteTreeHandlers = {};
|
|
SiteTreeHandlers.parentChanged_url = 'admin/assets/ajaxupdateparent';
|
|
SiteTreeHandlers.orderChanged_url = 'admin/assets/ajaxupdatesort';
|
|
SiteTreeHandlers.loadPage_url = 'admin/assets/getitem';
|
|
SiteTreeHandlers.loadTree_url = 'admin/assets/getsubtree';
|
|
SiteTreeHandlers.showRecord_url = 'admin/assets/show/';
|
|
SiteTreeHandlers.controller_url = 'admin/assets';
|
|
|
|
var _HANDLER_FORMS = {
|
|
addpage : 'Form_AddForm',
|
|
deletepage : 'Form_DeleteItemsForm',
|
|
sortitems : 'sortitems_options'
|
|
};
|
|
|
|
(function($) {
|
|
/**
|
|
* Delete selected folders through "batch actions" tab.
|
|
*/
|
|
$(document).ready(function() {
|
|
$('#Form_BatchActionsForm').entwine('ss').register(
|
|
// TODO Hardcoding of base URL
|
|
'admin/assets/batchactions/delete',
|
|
function(ids) {
|
|
var confirmed = confirm(
|
|
ss.i18n.sprintf(
|
|
ss.i18n._t('AssetAdmin.BATCHACTIONSDELETECONFIRM'),
|
|
ids.length
|
|
)
|
|
);
|
|
return (confirmed) ? ids : false;
|
|
}
|
|
);
|
|
});
|
|
|
|
$.entwine('ss', function($){
|
|
|
|
/**
|
|
* Class: #Form_SyncForm
|
|
*/
|
|
$('#Form_SyncForm').entwine({
|
|
|
|
/**
|
|
* Function: onsubmit
|
|
*
|
|
* Parameters:
|
|
* (Event) e
|
|
*/
|
|
onsubmit: function(e) {
|
|
var button = jQuery(this).find(':submit:first');
|
|
button.addClass('loading');
|
|
$.get(
|
|
jQuery(this).attr('action'),
|
|
function() {
|
|
button.removeClass('loading');
|
|
// reload current form and tree
|
|
var currNode = $('#sitetree')[0].firstSelected();
|
|
if(currNode) {
|
|
var url = $(currNode).find('a').attr('href');
|
|
$('#Form_EditForm').loadForm(url);
|
|
}
|
|
$('#sitetree')[0].setCustomURL('admin/assets/getsubtree');
|
|
$('#sitetree')[0].reload({onSuccess: function() {
|
|
// TODO Reset current tree node
|
|
}});
|
|
}
|
|
);
|
|
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
}(jQuery)); |