add loading spinner to add to owncloud input field

Update public.js

Update public.js
This commit is contained in:
Erik Pellikka 2016-03-21 10:44:12 -04:00 committed by ErikPel
parent 2a7e9f08ff
commit 73d5889c5d
1 changed files with 19 additions and 0 deletions

View File

@ -292,6 +292,24 @@ OCA.Sharing.PublicApp = {
}, },
_saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) { _saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
var toggleLoading = function() {
var iconClass = $('#save-button-confirm').attr('class');
var loading = iconClass.indexOf('icon-loading-small') !== -1;
if(loading) {
$('#save-button-confirm')
.removeClass("icon-loading-small")
.addClass("icon-confirm");
}
else {
$('#save-button-confirm')
.removeClass("icon-confirm")
.addClass("icon-loading-small");
}
};
toggleLoading();
var location = window.location.protocol + '//' + window.location.host + OC.webroot; var location = window.location.protocol + '//' + window.location.host + OC.webroot;
if(remote.substr(-1) !== '/') { if(remote.substr(-1) !== '/') {
@ -309,6 +327,7 @@ OCA.Sharing.PublicApp = {
// this check needs to happen on the server due to the Content Security Policy directive // this check needs to happen on the server due to the Content Security Policy directive
$.get(OC.generateUrl('apps/files_sharing/testremote'), {remote: remote}).then(function (protocol) { $.get(OC.generateUrl('apps/files_sharing/testremote'), {remote: remote}).then(function (protocol) {
if (protocol !== 'http' && protocol !== 'https') { if (protocol !== 'http' && protocol !== 'https') {
toggleLoading();
OC.dialogs.alert(t('files_sharing', 'No ownCloud installation (7 or higher) found at {remote}', {remote: remote}), OC.dialogs.alert(t('files_sharing', 'No ownCloud installation (7 or higher) found at {remote}', {remote: remote}),
t('files_sharing', 'Invalid ownCloud url')); t('files_sharing', 'Invalid ownCloud url'));
} else { } else {