Fixed problem with JS manipulation of provider sync state.

This commit is contained in:
Alex Tselegidis 2015-07-27 22:29:20 +02:00
parent f89527fe58
commit 1812d66bb4
2 changed files with 5 additions and 9 deletions

View file

@ -57,7 +57,7 @@
<button id="enable-sync" class="btn" data-toggle="button" <button id="enable-sync" class="btn" data-toggle="button"
title="<?php echo $this->lang->line('enable_appointment_sync_hint'); ?>"> title="<?php echo $this->lang->line('enable_appointment_sync_hint'); ?>">
<span class="glyphicon glyphicon-calendar"></span> <span class="glyphicon glyphicon-calendar"></span>
<?php echo $this->lang->line('enable_sync'); ?> <span><?php echo $this->lang->line('enable_sync'); ?></span>
</button> </button>
<?php } ?> <?php } ?>

View file

@ -268,13 +268,11 @@ var BackendCalendar = {
// style changes. // style changes.
if ($('#select-filter-item option:selected').attr('google-sync') === 'true') { if ($('#select-filter-item option:selected').attr('google-sync') === 'true') {
$('#enable-sync').addClass('btn-success enabled'); $('#enable-sync').addClass('btn-success enabled');
$('#enable-sync span:eq(1)').addClass('icon-white'); $('#enable-sync span:eq(1)').text(EALang['disable_sync']);
$('#enable-sync span:eq(2)').text(EALang['disable_sync']);
$('#google-sync').prop('disabled', false); $('#google-sync').prop('disabled', false);
} else { } else {
$('#enable-sync').removeClass('btn-success enabled'); $('#enable-sync').removeClass('btn-success enabled');
$('#enable-sync span:eq(1)').removeClass('icon-white'); $('#enable-sync span:eq(1)').text(EALang['enable_sync']);
$('#enable-sync span:eq(2)').text(EALang['enable_sync']);
$('#google-sync').prop('disabled', true); $('#google-sync').prop('disabled', true);
} }
} }
@ -715,8 +713,7 @@ var BackendCalendar = {
windowHandle.close(); windowHandle.close();
window.clearInterval(authInterval); window.clearInterval(authInterval);
$('#enable-sync').addClass('btn-success enabled'); $('#enable-sync').addClass('btn-success enabled');
$('#enable-sync span:eq(1)').addClass('icon-white'); $('#enable-sync span:eq(1)').text(EALang['disable_sync']);
$('#enable-sync span:eq(2)').text(EALang['disable_sync']);
$('#google-sync').prop('disabled', false); $('#google-sync').prop('disabled', false);
$('#select-filter-item option:selected').attr('google-sync', 'true'); $('#select-filter-item option:selected').attr('google-sync', 'true');
@ -760,8 +757,7 @@ var BackendCalendar = {
BackendCalendar.disableProviderSync(provider['id']); BackendCalendar.disableProviderSync(provider['id']);
$('#enable-sync').removeClass('btn-success enabled'); $('#enable-sync').removeClass('btn-success enabled');
$('#enable-sync span:eq(1)').removeClass('icon-white'); $('#enable-sync span:eq(1)').text(EALang['enable_sync']);
$('#enable-sync span:eq(2)').text(EALang['enable_sync']);
$('#google-sync').prop('disabled', true); $('#google-sync').prop('disabled', true);
$('#select-filter-item option:selected').attr('google-sync', 'false'); $('#select-filter-item option:selected').attr('google-sync', 'false');