Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.0' into 3.1
Browse files Browse the repository at this point in the history
Conflicts:
	admin/javascript/LeftAndMain.js
	tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php
	tests/control/ControllerTest.php
  • Loading branch information
chillu committed Jun 19, 2013
2 parents 5c3809a + c5a7193 commit 2160fb8
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 58 deletions.
59 changes: 36 additions & 23 deletions admin/javascript/LeftAndMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@ jQuery.noConflict();
*/
(function($) {

window.onresize = function(e) {
var windowWidth, windowHeight;
$(window).bind('resize.leftandmain', function(e) {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
$('.cms-container').trigger('windowresize');
};
var cb = function() {$('.cms-container').trigger('windowresize');};

// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});

// setup jquery.entwine
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
Expand Down Expand Up @@ -136,7 +149,7 @@ jQuery.noConflict();
this._super();
return;
}

// Initialize layouts
this.redraw();

Expand Down Expand Up @@ -228,15 +241,15 @@ jQuery.noConflict();
},
this.getLayoutOptions()
));

// Trigger layout algorithm once at the top. This also lays out children - we move from outside to
// inside, resizing to fit the parent.
this.layout();

// Redraw on all the children that need it
this.find('.cms-panel-layout').redraw();
this.find('.cms-content-fields[data-layout-type]').redraw();
this.find('.cms-edit-form[data-layout-type]').redraw();
this.find('.cms-panel-layout').redraw();
this.find('.cms-content-fields[data-layout-type]').redraw();
this.find('.cms-edit-form[data-layout-type]').redraw();
this.find('.cms-preview').redraw();
this.find('.cms-content').redraw();
},
Expand Down Expand Up @@ -590,7 +603,7 @@ jQuery.noConflict();
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage === null) return;

var selectedTabs = [], url = this._tabStateUrl();
this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
var id = $(el).attr('id');
if(!id) return; // we need a unique reference
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
Expand Down Expand Up @@ -650,8 +663,8 @@ jQuery.noConflict();
} else if(sessionStates) {
$.each(sessionStates, function(i, sessionState) {
if(tabset.is('#' + sessionState.id)) index = sessionState.selected;
});
}
});
}
if(index !== null) tabset.tabs('select', index);
});
},
Expand All @@ -671,7 +684,7 @@ jQuery.noConflict();
} else {
for(var i=0;i<s.length;i++) {
if(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));
}
}
}
},

Expand Down Expand Up @@ -818,18 +831,18 @@ jQuery.noConflict();
$('.cms-content .Actions').entwine({
onmatch: function() {
this.find('.ss-ui-button').click(function() {
var form = this.form;
var form = this.form;

// forms don't natively store the button they've been triggered with
if(form) {
form.clickedButton = this;
// Reset the clicked button shortly after the onsubmit handlers
// have fired on the form
// forms don't natively store the button they've been triggered with
if(form) {
form.clickedButton = this;
// Reset the clicked button shortly after the onsubmit handlers
// have fired on the form
setTimeout(function() {
form.clickedButton = null;
}, 10);
}
});
}
});

this.redraw();
this._super();
Expand Down Expand Up @@ -974,13 +987,13 @@ jQuery.noConflict();
$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({
onclick: function(e) {
e.preventDefault();

var form = $(this).parents('form');

form.clearForm();
form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); // Reset chosen.js
form.submit();
}
}
})

/**
Expand Down Expand Up @@ -1051,7 +1064,7 @@ jQuery.noConflict();
},
redrawTabs: function() {
this.rewriteHashlinks();

var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');

if(!this.data('uiTabs')) this.tabs({
Expand Down
6 changes: 6 additions & 0 deletions conf/ConfigureFromEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* - SS_DATABASE_SUFFIX: A suffix to add to the database name.
* - SS_DATABASE_PREFIX: A prefix to add to the database name.
* - SS_DATABASE_TIMEZONE: Set the database timezone to something other than the system timezone.
* - SS_DATABASE_MEMORY: Use in-memory state if possible. Useful for testing, currently only
* supported by the SQLite database adapter.
*
* There is one more setting that is intended to be used by people who work on SilverStripe.
* - SS_DATABASE_CHOOSE_NAME: Boolean/Int. If set, then the system will choose a default database name for you if
Expand Down Expand Up @@ -110,6 +112,10 @@
// For schema enabled drivers:
if(defined('SS_DATABASE_SCHEMA'))
$databaseConfig["schema"] = SS_DATABASE_SCHEMA;

// For SQlite3 memory databases (mainly for testing purposes)
if(defined('SS_DATABASE_MEMORY'))
$databaseConfig["memory"] = SS_DATABASE_MEMORY;
}

if(defined('SS_SEND_ALL_EMAILS_TO')) {
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ the markup in the `else` clause is used, if that clause is present.
:::ss
<% if $MyDinner=="quiche" %>
Real men don't eat quiche
<% else_if $MyDinner=$YourDinner %>
<% else_if $MyDinner==$YourDinner %>
We both have good taste
<% else %>
Can I have some of your chips?
Expand Down
18 changes: 9 additions & 9 deletions docs/en/topics/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ The `phpunit` binary should be used from the root directory of your website.

# Runs all tests defined in phpunit.xml
phpunit

# Run all tests of a specific module
phpunit framework/tests/

# Run specific tests within a specific module
phpunit framework/tests/filesystem

# Run a specific test
phpunit framework/tests/filesystem/FolderTest.php

# Run tests with optional `$_GET` parameters (you need an empty second argument)
phpunit framework/tests '' flush=all

Expand All @@ -81,16 +81,16 @@ particularly around formatting test output.

# Run all tests
sake dev/tests/all

# Run all tests of a specific module (comma-separated)
sake dev/tests/module/framework,cms

# Run specific tests (comma-separated)
sake dev/tests/FolderTest,OtherTest

# Run tests with optional `$_GET` parameters
sake dev/tests/all flush=all

# Skip some tests
sake dev/tests/all SkipTests=MySkippedTest

Expand Down Expand Up @@ -187,4 +187,4 @@ understand the problem space and discover suitable APIs for performing specific
**Behavior Driven Development (BDD):** An extension of the test-driven programming style, where tests are used primarily
for describing the specification of how code should perform. In practice, there's little or no technical difference - it
all comes down to language. In BDD, the usual terminology is changed to reflect this change of focus, so *Specification*
is used in place of *Test Case*, and *should* is used in place of *expect* and *assert*.
is used in place of *Test Case*, and *should* is used in place of *expect* and *assert*.
18 changes: 16 additions & 2 deletions javascript/TreeDropdownField.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@
* On resize of any close the open treedropdownfields
* as we'll need to redo with widths
*/
$(window).resize(function() {
$('.TreeDropdownField').closePanel();
var windowWidth, windowHeight;
$(window).bind('resize.treedropdownfield', function() {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
var cb = function() {$('.TreeDropdownField').closePanel();};

// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});

var strings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,13 @@ public function theIFillInTheDropdownWith($field, $value)
}

assertNotNull($container, 'Chosen.js field container not found');

// Click on newly expanded list element, indirectly setting the dropdown value
$linkEl = $container->find('xpath', './/a[./@href]');
assertNotNull($linkEl, 'Chosen.js link element not found');
$this->getSession()->wait(100); // wait for dropdown overlay to appear
$linkEl->click();

if(in_array('treedropdown', explode(' ', $container->getAttribute('class')))) {
// wait for ajax dropdown to load
$this->getSession()->wait(
Expand Down Expand Up @@ -422,7 +422,7 @@ protected function findParentByClass(NodeElement $el, $class) {
) {
if($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) {
return $container;
}
}
$container = $container->getParent();
}

Expand Down
Loading

0 comments on commit 2160fb8

Please sign in to comment.