Commit 5f1d91db authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1465462: Fixing webservices js for config page



For post bootstrap merge

Change-Id: Ib4e78760497ffbcbe8c7df320a1ba50d93098961
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent f032808b
......@@ -18,29 +18,21 @@
</div>
{/foreach}
</div>
<script type="application/javascript">
jQuery(function() {
jQuery('.pseudofieldset').each(function() {
var fieldset = jQuery(this);
var legend = fieldset.find('.pseudolegend').first();
var legendh4 = legend.find('h4').first();
legendh4.find('a').click(function(e) {
fieldset.toggleClass('collapsed');
var isCollapsed = fieldset.hasClass('collapsed');
if (!isCollapsed) {
fieldset.find(':input').not(':hidden').first().focus();
}
e.preventDefault();
jQuery('.pseudofieldset').each(function(index) {
jQuery(this).find('.pseudolegend').click(function(event) {
jQuery(event.target).find('.panel-body').collapse('toggle');
});
// Keep open current section after save/reload of page.
// Will reopen only the fieldset that had a form saved within it
var opened = '{$opened}';
if (opened !== '') {
jQuery('#' + opened + '_pseudofieldset').closest('div.pseudofieldset').removeClass('collapsed');
if (jQuery(this).find('#' + opened + '_pseudofieldset').length) {
// collapse the others
jQuery('#accordion .panel-body.in').collapse('hide');
jQuery(this).find('#' + opened + '_pseudofieldset').parent().find('.panel-body').collapse('show');
}
});
});
});
</script>
......
......@@ -39,11 +39,11 @@ $inlinejs = <<<JS
$('#activate_webservices_enabled').change(function() {
// open the protocols fieldset
$('#activate_webservices_protos_pseudofieldset').closest('.pseudofieldset').removeClass('collapsed');
if ($(this).is(':checked')) {
// alert user to switch protocols on if none are active
if ($('#activate_webservices_protos_pseudofieldset').closest('.pseudofieldset').find('input:checkbox:checked').length == 0) {
$('#activate_webservices_protos_pseudofieldset').closest('.pseudolegend').after('<div class="error">You need to enable at least one Protocol</div>');
$('#activate_webservices_protos_pseudofieldset').parent().find('.panel-body').collapse('show');
$('#activate_webservices_protos_pseudofieldset').find('div:first').before('<div class="error">You need to enable at least one Protocol</div>');
}
}
else {
......
......@@ -7,9 +7,8 @@ So I can benefit from the mahara/moodle cross over.
Scenario: Turning Master swtiches and protocol switches on checking test client page is accessible (Bug 1431540)
Given I log in as "admin" with password "Password1"
And I follow "Administration"
And I go to "webservice/admin/index.php"
And I choose "Web services" in "Extensions"
# Turning the master switch on
And I follow "Web services master switch"
And I check "activate_webservices_enabled"
# Turning the master switch off so the protocols are disabled
And I uncheck "activate_webservices_enabled"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment