Skip to content
Snippets Groups Projects
Commit cd44dff5 authored by Bart Visscher's avatar Bart Visscher
Browse files

Better feedback for saving calendar and openid settings

parent 32345977
No related branches found
No related tags found
No related merge requests found
$(document).ready(function(){ $(document).ready(function(){
$("#timezone").change( function(){ $("#timezone").change( function(){
OC.msg.startSaving('#calendar .msg')
// Serialize the data // Serialize the data
var post = $( "#timezone" ).serialize(); var post = $( "#timezone" ).serialize();
// Ajax foo
$.post( oc_webroot + '/apps/calendar/ajax/settimezone.php', post, function(data){ $.post( oc_webroot + '/apps/calendar/ajax/settimezone.php', post, function(data){
if( data.status == "success" ){ OC.msg.finishedSaving('#calendar .msg', data);
}
else{
$('#timezoneerror').html( data.data.message );
}
}); });
return false; return false;
}); });
......
...@@ -31,6 +31,6 @@ ...@@ -31,6 +31,6 @@
echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>'; echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';
endif; endif;
endforeach;?> endforeach;?>
</select><span id="timezoneerror"></span> </select><span class="msg"></span>
</fieldset> </fieldset>
</form> </form>
$(document).ready(function(){ $(document).ready(function(){
$('#openidform #identity').blur(function(event){ $('#openidform #identity').blur(function(event){
event.preventDefault(); event.preventDefault();
OC.msg.startSaving('#openidform .msg');
var post = $( "#openidform" ).serialize(); var post = $( "#openidform" ).serialize();
$.post( 'ajax/openid.php', post, function(data){ $.post( 'ajax/openid.php', post, function(data){
if( data.status == "success" ){ OC.msg.finishedSaving('#openidform .msg', data);
}else{
alert('error while setting OpenID');
}
}); });
}); });
// reset value when edited, workaround because of .select() not working with disabled inputs
$('#openid').focus(function(event){
openidValue = $('#openid').val();
});
$('#openid').blur(function(event){
$('#openid').val(openidValue);
});
}); });
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<strong>OpenID</strong> <strong>OpenID</strong>
<?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].OC::$WEBROOT.'/?'; echo OC_User::getUser(); ?><br /><em><?php echo $l->t('you can authenticate to other sites with this address');?></em><br /> <?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].OC::$WEBROOT.'/?'; echo OC_User::getUser(); ?><br /><em><?php echo $l->t('you can authenticate to other sites with this address');?></em><br />
<label for="identity"><?php echo $l->t('Authorized OpenID provider');?></label> <label for="identity"><?php echo $l->t('Authorized OpenID provider');?></label>
<input type="text" name="identity" id="identity" value="<?php echo $_['identity']; ?>" placeholder="<?php echo $l->t('Your address at Wordpress, Identi.ca, &hellip;');?>" /> <input type="text" name="identity" id="identity" value="<?php echo $_['identity']; ?>" placeholder="<?php echo $l->t('Your address at Wordpress, Identi.ca, &hellip;');?>" /><span class="msg"></span>
</fieldset> </fieldset>
</form> </form>
...@@ -5,6 +5,9 @@ input#openid, input#webdav { width:20em; } ...@@ -5,6 +5,9 @@ input#openid, input#webdav { width:20em; }
#passwordchanged { display:none; } #passwordchanged { display:none; }
input#identity { width:20em; } input#identity { width:20em; }
.msg.success{ color:#fff; background-color:#0f0; padding:3px; text-shadow:1px 1px #000; }
.msg.error{ color:#fff; background-color:#f00; padding:3px; text-shadow:1px 1px #000; }
/* USERS */ /* USERS */
form { display:inline; } form { display:inline; }
......
...@@ -48,12 +48,26 @@ $(document).ready(function(){ ...@@ -48,12 +48,26 @@ $(document).ready(function(){
}); });
return false; return false;
}); });
// reset value when edited, workaround because of .select() not working with disabled inputs
$('#webdav').focus(function(event){
openidValue = $('#webdav').val();
});
$('#webdav').blur(function(event){
$('#webdav').val(openidValue);
});
} ); } );
OC.msg={
startSaving:function(selector){
$(selector)
.html( t('settings', 'Saving...') )
.removeClass('success')
.removeClass('error')
.stop(true, true)
.show();
},
finishedSaving:function(selector, data){
if( data.status == "success" ){
$(selector).html( data.data.message )
.addClass('success')
.stop(true, true)
.delay(3000)
.fadeOut(600);
}else{
$(selector).html( data.data.message ).addClass('error');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment