mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix SSViewerTest not restoring old requirements
BUG Fix incorrect js path in UploadField.php Restore changes missing from merge
This commit is contained in:
parent
2fc9d69197
commit
6cebffd89b
@ -173,7 +173,7 @@ $.entwine('ss.tree', function($){
|
||||
ids = this.getIDs(),
|
||||
allIds = [],
|
||||
viewMode = $('.cms-content-batchactions-button'),
|
||||
selectedAction = this.find(':input[name=Action]').val();
|
||||
actionUrl = this.find(':input[name=Action]').val();
|
||||
|
||||
// Default to refreshing the entire tree
|
||||
if(rootNode == null) rootNode = st;
|
||||
@ -183,7 +183,7 @@ $.entwine('ss.tree', function($){
|
||||
}
|
||||
|
||||
// If no action is selected, enable all nodes
|
||||
if(!selectedAction || selectedAction == -1 || !viewMode.hasClass('active')) {
|
||||
if(!actionUrl || actionUrl == -1 || !viewMode.hasClass('active')) {
|
||||
$(rootNode).find('li').each(function() {
|
||||
$(this).setEnabled(true);
|
||||
});
|
||||
@ -197,8 +197,12 @@ $.entwine('ss.tree', function($){
|
||||
});
|
||||
|
||||
// Post to the server to ask which pages can have this batch action applied
|
||||
var applicablePagesURL = selectedAction + '/applicablepages/?csvIDs=' + allIds.join(',');
|
||||
jQuery.getJSON(applicablePagesURL, function(applicableIDs) {
|
||||
// Retain existing query parameters in URL before appending path
|
||||
var actionUrlParts = $.path.parseUrl(actionUrl);
|
||||
var applicablePagesUrl = actionUrlParts.hrefNoSearch + '/applicablepages/';
|
||||
applicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, actionUrlParts.search);
|
||||
applicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, {csvIDs: allIds.join(',')});
|
||||
jQuery.getJSON(applicablePagesUrl, function(applicableIDs) {
|
||||
// Set a CSS class on each tree node indicating which can be batch-actioned and which can't
|
||||
jQuery(rootNode).find('li').each(function() {
|
||||
$(this).removeClass('treeloading');
|
||||
|
@ -1540,7 +1540,7 @@ class UploadField_SelectHandler extends RequestHandler {
|
||||
|
||||
public function index() {
|
||||
// Requires a separate JS file, because we can't reach into the iframe with entwine.
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/UploadField_select.js');
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/UploadField_select.js');
|
||||
return $this->renderWith('CMSDialog');
|
||||
}
|
||||
|
||||
|
@ -147,10 +147,12 @@ class SSViewerTest extends SapphireTest {
|
||||
$requirements->expects($this->once())->method('javascript')->with($jsFile);
|
||||
$requirements->expects($this->once())->method('css')->with($cssFile);
|
||||
|
||||
$origReq = Requirements::backend();
|
||||
Requirements::set_backend($requirements);
|
||||
|
||||
$template = $this->render("<% require javascript($jsFile) %>
|
||||
<% require css($cssFile) %>");
|
||||
Requirements::set_backend($origReq);
|
||||
|
||||
$this->assertFalse((bool)trim($template), "Should be no content in this return.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user