mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT: CMS Editor Upload panel now loads the root files directly and allows the user to upload to the root assets dir (from r97601)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102520 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
95350bcdf8
commit
afc0cd0ee7
@ -8,7 +8,14 @@
|
|||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
/**
|
||||||
|
* On page refresh load the initial images (in root)
|
||||||
|
*/
|
||||||
|
if($("#FolderImages").length > 0) loadImages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show / Hide the Upload Form
|
||||||
|
*/
|
||||||
$("#Form_EditorToolbarImageForm .showUploadField a").click(function() {
|
$("#Form_EditorToolbarImageForm .showUploadField a").click(function() {
|
||||||
if($(this).hasClass("showing")) {
|
if($(this).hasClass("showing")) {
|
||||||
$("#Form_EditorToolbarImageForm_Files-0").parents('.file').hide();
|
$("#Form_EditorToolbarImageForm_Files-0").parents('.file').hide();
|
||||||
@ -20,6 +27,9 @@
|
|||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On folder change - lookup the new images
|
||||||
|
*/
|
||||||
$("#Form_EditorToolbarImageForm_Files-0").change(function() {
|
$("#Form_EditorToolbarImageForm_Files-0").change(function() {
|
||||||
$("#contentPanel form").ajaxForm({
|
$("#contentPanel form").ajaxForm({
|
||||||
url: 'admin/assets/UploadForm?action_doUpload=1',
|
url: 'admin/assets/UploadForm?action_doUpload=1',
|
||||||
@ -35,27 +45,35 @@
|
|||||||
|
|
||||||
$("#FolderImages").html('<h2>'+ ss.i18n._t('HtmlEditorField.Loading', 'Loading') + '</h2>');
|
$("#FolderImages").html('<h2>'+ ss.i18n._t('HtmlEditorField.Loading', 'Loading') + '</h2>');
|
||||||
|
|
||||||
var ajaxURL = 'admin/EditorToolbar/ImageForm';
|
loadImages();
|
||||||
|
|
||||||
$.get(ajaxURL, {
|
|
||||||
action_callfieldmethod: "1",
|
|
||||||
fieldName: "FolderImages",
|
|
||||||
ajax: "1",
|
|
||||||
methodName: "getimages",
|
|
||||||
folderID: $("#Form_EditorToolbarImageForm_FolderID").val(),
|
|
||||||
searchText: $("#Form_EditorToolbarImageForm_getimagesSearch").val(),
|
|
||||||
cacheKillerDate: parseInt((new Date()).getTime()),
|
|
||||||
cacheKillerRand: parseInt(10000 * Math.random())
|
|
||||||
},
|
|
||||||
function(data) {
|
|
||||||
$("#FolderImages").html(data);
|
|
||||||
|
|
||||||
$("#FolderImages").each(function() {
|
|
||||||
Behaviour.apply(this);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).submit();
|
}).submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads images from getimages() to the thumbnail view. It's called on
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function loadImages(sel) {
|
||||||
|
console.debug(this);
|
||||||
|
$.get('admin/EditorToolbar/ImageForm', {
|
||||||
|
action_callfieldmethod: "1",
|
||||||
|
fieldName: "FolderImages",
|
||||||
|
ajax: "1",
|
||||||
|
methodName: "getimages",
|
||||||
|
folderID: $("#Form_EditorToolbarImageForm_FolderID").val(),
|
||||||
|
searchText: $("#Form_EditorToolbarImageForm_getimagesSearch").val(),
|
||||||
|
cacheKillerDate: parseInt((new Date()).getTime()),
|
||||||
|
cacheKillerRand: parseInt(10000 * Math.random())
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
$("#FolderImages").html(data);
|
||||||
|
|
||||||
|
$("#FolderImages").each(function() {
|
||||||
|
Behaviour.apply(this);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
Loading…
x
Reference in New Issue
Block a user