summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-06 10:21:35 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-07 13:17:37 +0100
commit8d986160b899684dd5e76c3996ba04902152df4e (patch)
treed4ab0aa3ccb43a51d6335e9bef7a89a57f1396e0 /apps
parent4e6043fd6b8853a6ea20fab6d9f71e21f35f0825 (diff)
downloadnextcloud-server-8d986160b899684dd5e76c3996ba04902152df4e.tar.gz
nextcloud-server-8d986160b899684dd5e76c3996ba04902152df4e.zip
Improved inline confirm icon with opacity and fixed ext share loading state
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/css/public.scss16
-rw-r--r--apps/files_sharing/js/public.js40
-rw-r--r--apps/files_sharing/lib/Template/ExternalShareMenuAction.php4
3 files changed, 23 insertions, 37 deletions
diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss
index e040d449129..e30c97ae7aa 100644
--- a/apps/files_sharing/css/public.scss
+++ b/apps/files_sharing/css/public.scss
@@ -105,25 +105,9 @@ thead {
border-color: rgba(0,0,0,0.3) !important;
}
-/* within #save */
-#save .save-form {
- position: relative;
- margin-right: -10px;
-}
#remote_address {
width: 200px;
- margin-right: 4px;
- height: 31px;
-}
-
-#save-button-confirm {
- position: absolute;
- background-color: transparent;
- border: none;
- margin: 0;
- right: 0px;
- height: 40px;
}
#public-upload .avatardiv {
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index ae19500080b..607c50f5028 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -271,7 +271,7 @@ OCA.Sharing.PublicApp = {
});
$('#remote_address').on("keyup paste", function() {
- if ($(this).val() === '') {
+ if ($(this).val() === '' || $('#save > .icon.icon-loading-small').length > 0) {
$('#save-button-confirm').prop('disabled', true);
} else {
$('#save-button-confirm').prop('disabled', false);
@@ -329,6 +329,7 @@ OCA.Sharing.PublicApp = {
*/
_legacyCreateFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) {
+ var self = this;
var location = window.location.protocol + '//' + window.location.host + OC.webroot;
if(remote.substr(-1) !== '/') {
@@ -346,6 +347,7 @@ OCA.Sharing.PublicApp = {
// 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) {
if (protocol !== 'http' && protocol !== 'https') {
+ self._toggleLoading();
OC.dialogs.alert(t('files_sharing', 'No compatible server found at {remote}', {remote: remote}),
t('files_sharing', 'Invalid server URL'));
} else {
@@ -355,30 +357,30 @@ OCA.Sharing.PublicApp = {
}
},
- _createFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) {
+ _toggleLoading: function() {
+ var loading = $('#save > .icon.icon-loading-small').length === 0;
+ if (loading) {
+ $('#save > .icon-external')
+ .removeClass("icon-external")
+ .addClass("icon-loading-small");
+ $('#save #save-button-confirm').prop("disabled", true);
- 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 > .icon-loading-small')
+ .addClass("icon-external")
+ .removeClass("icon-loading-small");
+ $('#save #save-button-confirm').prop("disabled", false);
- }
- else {
- $('#save-button-confirm')
- .removeClass("icon-confirm")
- .addClass("icon-loading-small");
+ }
+ },
- }
- };
+ _createFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) {
+ var self = this;
- toggleLoading();
+ this._toggleLoading();
if (remote.indexOf('@') === -1) {
this._legacyCreateFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected);
- toggleLoading();
return;
}
@@ -402,7 +404,7 @@ OCA.Sharing.PublicApp = {
function (jqXHR) {
OC.dialogs.alert(JSON.parse(jqXHR.responseText).message,
t('files_sharing', 'Failed to add the public link to your Nextcloud'));
- toggleLoading();
+ self._toggleLoading();
}
);
}
diff --git a/apps/files_sharing/lib/Template/ExternalShareMenuAction.php b/apps/files_sharing/lib/Template/ExternalShareMenuAction.php
index f548a3bc6f1..635b301e57c 100644
--- a/apps/files_sharing/lib/Template/ExternalShareMenuAction.php
+++ b/apps/files_sharing/lib/Template/ExternalShareMenuAction.php
@@ -60,9 +60,9 @@ class ExternalShareMenuAction extends SimpleMenuAction {
'<span id="save-button">' . Util::sanitizeHTML($this->getLabel()) . '</span>' .
'<form class="save-form hidden" action="#">' .
'<input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
- '<button id="save-button-confirm" class="icon-confirm svg" disabled=""></button>' .
+ '<input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
'</form>' .
'</a>' .
'</li>';
}
-} \ No newline at end of file
+}