Improved inline confirm icon with opacity and fixed ext share loading state
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
4e6043fd6b
commit
8d986160b8
|
@ -105,25 +105,9 @@ thead {
|
||||||
border-color: rgba(0,0,0,0.3) !important;
|
border-color: rgba(0,0,0,0.3) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* within #save */
|
|
||||||
#save .save-form {
|
|
||||||
position: relative;
|
|
||||||
margin-right: -10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#remote_address {
|
#remote_address {
|
||||||
width: 200px;
|
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 {
|
#public-upload .avatardiv {
|
||||||
|
|
|
@ -271,7 +271,7 @@ OCA.Sharing.PublicApp = {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#remote_address').on("keyup paste", function() {
|
$('#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);
|
$('#save-button-confirm').prop('disabled', true);
|
||||||
} else {
|
} else {
|
||||||
$('#save-button-confirm').prop('disabled', false);
|
$('#save-button-confirm').prop('disabled', false);
|
||||||
|
@ -329,6 +329,7 @@ OCA.Sharing.PublicApp = {
|
||||||
*/
|
*/
|
||||||
_legacyCreateFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) {
|
_legacyCreateFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) {
|
||||||
|
|
||||||
|
var self = this;
|
||||||
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) !== '/') {
|
||||||
|
@ -346,6 +347,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') {
|
||||||
|
self._toggleLoading();
|
||||||
OC.dialogs.alert(t('files_sharing', 'No compatible server found at {remote}', {remote: remote}),
|
OC.dialogs.alert(t('files_sharing', 'No compatible server found at {remote}', {remote: remote}),
|
||||||
t('files_sharing', 'Invalid server URL'));
|
t('files_sharing', 'Invalid server URL'));
|
||||||
} else {
|
} 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;
|
||||||
var toggleLoading = function() {
|
|
||||||
var iconClass = $('#save-button-confirm').attr('class');
|
|
||||||
var loading = iconClass.indexOf('icon-loading-small') !== -1;
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
$('#save-button-confirm')
|
$('#save > .icon-external')
|
||||||
.removeClass("icon-loading-small")
|
.removeClass("icon-external")
|
||||||
.addClass("icon-confirm");
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#save-button-confirm')
|
|
||||||
.removeClass("icon-confirm")
|
|
||||||
.addClass("icon-loading-small");
|
.addClass("icon-loading-small");
|
||||||
|
$('#save #save-button-confirm').prop("disabled", true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#save > .icon-loading-small')
|
||||||
|
.addClass("icon-external")
|
||||||
|
.removeClass("icon-loading-small");
|
||||||
|
$('#save #save-button-confirm').prop("disabled", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
toggleLoading();
|
_createFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this._toggleLoading();
|
||||||
|
|
||||||
if (remote.indexOf('@') === -1) {
|
if (remote.indexOf('@') === -1) {
|
||||||
this._legacyCreateFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected);
|
this._legacyCreateFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected);
|
||||||
toggleLoading();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +404,7 @@ OCA.Sharing.PublicApp = {
|
||||||
function (jqXHR) {
|
function (jqXHR) {
|
||||||
OC.dialogs.alert(JSON.parse(jqXHR.responseText).message,
|
OC.dialogs.alert(JSON.parse(jqXHR.responseText).message,
|
||||||
t('files_sharing', 'Failed to add the public link to your Nextcloud'));
|
t('files_sharing', 'Failed to add the public link to your Nextcloud'));
|
||||||
toggleLoading();
|
self._toggleLoading();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ExternalShareMenuAction extends SimpleMenuAction {
|
||||||
'<span id="save-button">' . Util::sanitizeHTML($this->getLabel()) . '</span>' .
|
'<span id="save-button">' . Util::sanitizeHTML($this->getLabel()) . '</span>' .
|
||||||
'<form class="save-form hidden" action="#">' .
|
'<form class="save-form hidden" action="#">' .
|
||||||
'<input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
|
'<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>' .
|
'</form>' .
|
||||||
'</a>' .
|
'</a>' .
|
||||||
'</li>';
|
'</li>';
|
||||||
|
|
|
@ -165,6 +165,10 @@ img, object, video, button, textarea, input, select, div[contenteditable=true] {
|
||||||
background-image: url('../img/actions/confirm.svg?v=2');
|
background-image: url('../img/actions/confirm.svg?v=2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-confirm-fade {
|
||||||
|
background-image: url('../img/actions/confirm-fade.svg?v=2');
|
||||||
|
}
|
||||||
|
|
||||||
.icon-confirm-white {
|
.icon-confirm-white {
|
||||||
background-image: url('../img/actions/confirm-white.svg?v=2');
|
background-image: url('../img/actions/confirm-white.svg?v=2');
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,11 +149,6 @@ input[type='reset'] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: nc-darken($color-main-background, 3%);
|
background-color: nc-darken($color-main-background, 3%);
|
||||||
&.icon-confirm:not(:empty),
|
|
||||||
&.icon-confirm[value]:not([value=""]) {
|
|
||||||
background-position: calc(100% - 6px) center;
|
|
||||||
padding-right: 30px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
|
@ -223,6 +218,14 @@ input {
|
||||||
border-radius: 0 $border-radius $border-radius 0 !important;
|
border-radius: 0 $border-radius $border-radius 0 !important;
|
||||||
background-clip: padding-box; /* Avoid background under border */
|
background-clip: padding-box; /* Avoid background under border */
|
||||||
background-color: $color-main-background !important;
|
background-color: $color-main-background !important;
|
||||||
|
opacity: 1;
|
||||||
|
width: 16px;
|
||||||
|
padding: 7px 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
background-image: url('../img/actions/confirm-fade.svg?v=2') !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* only show confirm borders if input is not focused */
|
/* only show confirm borders if input is not focused */
|
||||||
&:not(:active):not(:hover):not(:focus){
|
&:not(:active):not(:hover):not(:focus){
|
||||||
|
@ -230,8 +233,11 @@ input {
|
||||||
&:active,
|
&:active,
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus {
|
&:focus {
|
||||||
border-left-color: $color-primary-element !important;
|
border-color: $color-primary-element !important;
|
||||||
border-radius: $border-radius !important;
|
border-radius: $border-radius !important;
|
||||||
|
&:disabled {
|
||||||
|
border-color: nc-darken($color-main-background, 14%) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path opacity=".5" d="m8.5 0.5c-0.8974 0-1.3404 1.0909-0.6973 1.7168l4.7837 4.7832h-11.573c-1.3523-0.019125-1.3523 2.0191 0 2h11.572l-4.7832 4.7832c-0.98163 0.94251 0.47155 2.3957 1.4141 1.4141l6.4911-6.49c0.387-0.3878 0.391-1.0228 0-1.414l-6.4906-6.4903c-0.1883-0.1935-0.4468-0.30268-0.7168-0.3027z"/></svg>
|
After Width: | Height: | Size: 406 B |
Loading…
Reference in New Issue