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:
Damian Mooyman 2016-01-21 13:37:45 +13:00
parent 2fc9d69197
commit 6cebffd89b
3 changed files with 12 additions and 6 deletions

View File

@ -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');

View File

@ -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');
}

View File

@ -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.");
}