]> source.dussan.org Git - nextcloud-server.git/commitdiff
Better feedback for saving calendar and openid settings
authorBart Visscher <bartv@thisnet.nl>
Sun, 11 Sep 2011 15:20:23 +0000 (17:20 +0200)
committerBart Visscher <bartv@thisnet.nl>
Sun, 11 Sep 2011 18:38:52 +0000 (20:38 +0200)
apps/calendar/js/settings.js
apps/calendar/templates/settings.php
apps/user_openid/js/settings.js
apps/user_openid/templates/settings.php
settings/css/settings.css
settings/js/personal.js

index b2da81b0d0f9a291d42f70499d97f023c521bb0c..90876389858523f44c451e6fbc1d9ede52c33e40 100644 (file)
@@ -1,14 +1,10 @@
 $(document).ready(function(){
        $("#timezone").change( function(){
+               OC.msg.startSaving('#calendar .msg')
                // Serialize the data
                var post = $( "#timezone" ).serialize();
-               // Ajax foo
                $.post( oc_webroot + '/apps/calendar/ajax/settimezone.php', post, function(data){
-                       if( data.status == "success" ){
-                       }
-                       else{
-                               $('#timezoneerror').html( data.data.message );
-                       }
+                       OC.msg.finishedSaving('#calendar .msg', data);
                });
                return false;
        });
index f0863b9cb7f191891ec6d2373fc6fa41cb76b110..122f8a9bf935aa76a1c69b45fddf05b1e790ec12 100644 (file)
@@ -31,6 +31,6 @@
                                echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';
                        endif;
                 endforeach;?>
-                </select><span id="timezoneerror"></span>
+                </select><span class="msg"></span>
         </fieldset>
 </form>
index cfecd7b1cb4d0c7c81843b44a06de0e0399633d4..83170e6b844164fdbcbcf5dc7add13a9dc6341da 100644 (file)
@@ -1,20 +1,10 @@
 $(document).ready(function(){
        $('#openidform #identity').blur(function(event){
                event.preventDefault();
+               OC.msg.startSaving('#openidform .msg');
                var post = $( "#openidform" ).serialize();
                $.post( 'ajax/openid.php', post, function(data){
-                       if( data.status == "success" ){
-                       }else{
-                               alert('error while setting OpenID');
-                       }
+                       OC.msg.finishedSaving('#openidform .msg', data);
                });
        });
-
-       // 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);
-       });
 });
index ffcd10e0b9960a9b3f1701b187fe61a938294bc0..7c742030ce38b00f57723c6a292692401fe1b945 100644 (file)
@@ -3,6 +3,6 @@
                <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 />
                <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>
 </form>
index 429e96ddb9a0f9177fb8e6c4e2e767d794f67783..7cb29e487bc2fd8e03ad18004c26430f1631fdcb 100644 (file)
@@ -5,6 +5,9 @@ input#openid, input#webdav { width:20em; }
 #passwordchanged { display:none; }
 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 */
 form { display:inline; }
index 65bb81b0f04e7e112cfbe3e53060719201b0e467..9578fb2c890c1f06a4dc81e8fe93ac33cf750d9d 100644 (file)
@@ -48,12 +48,26 @@ $(document).ready(function(){
                });
                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');
+               }
+       }
+}