From a8de18eeb885052da4de235819a4fc0bdfb6eeec Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Mon, 22 Jan 2018 17:03:41 +0100 Subject: [PATCH 1/4] Add a button to show/hide password input. Signed-off-by: Ivan Sein --- css/style.scss | 2 ++ js/views/callinfoview.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/css/style.scss b/css/style.scss index 4808423875e..1d6b45171c7 100644 --- a/css/style.scss +++ b/css/style.scss @@ -923,11 +923,13 @@ video { } .detailCallInfoContainer .clipboard-button, +.detailCallInfoContainer .password-button, .detailCallInfoContainer .editable-text-label:hover .edit-button { display: inline-block; } .detailCallInfoContainer .clipboard-button .icon, +.detailCallInfoContainer .password-button .icon, .detailCallInfoContainer .editable-text-label .edit-button .icon { cursor: pointer; padding: 22px; diff --git a/js/views/callinfoview.js b/js/views/callinfoview.js index a8adbae136d..4dd7b46e9ff 100644 --- a/js/views/callinfoview.js +++ b/js/views/callinfoview.js @@ -51,6 +51,7 @@ ' ' + ' {{#if isPublic}}' + '
' + + '
' + '
' + ' '+ @@ -88,6 +89,7 @@ 'joinCallButton': 'button.join-call', 'leaveCallButton': 'button.leave-call', + 'passwordButton': '.password-button', 'passwordOption': '.password-option', 'passwordInput': '.password-input', 'passwordConfirm': '.password-confirm' @@ -102,6 +104,7 @@ 'change @ui.linkCheckbox': 'toggleLinkCheckbox', 'keyup @ui.passwordInput': 'keyUpPassword', + 'click @ui.passwordButton': 'showPasswordInput', 'click @ui.passwordConfirm': 'confirmPassword', 'click @ui.joinCallButton': 'joinCall', 'click @ui.leaveCallButton': 'leaveCall' @@ -210,6 +213,14 @@ title: t('spreed', 'Copy') }); this.initClipboard(); + + this.ui.passwordOption.hide(); + this.ui.passwordButton.tooltip({ + placement: 'bottom', + trigger: 'hover', + title: (this.model.get('hasPassword')) ? t('spreed', 'Change password') : t('spreed', 'Set password') + }); + }, _canModerate: function() { @@ -265,6 +276,12 @@ /** * Password */ + showPasswordInput: function() { + this.ui.passwordButton.hide(); + this.ui.passwordOption.show(); + this.ui.passwordInput.focus(); + }, + confirmPassword: function() { var newPassword = this.ui.passwordInput.val().trim(); @@ -284,6 +301,9 @@ }.bind(this) }); + this.ui.passwordOption.hide(); + this.ui.passwordButton.show(); + console.log('.rename-option'); }, @@ -294,6 +314,8 @@ } else if (e.keyCode === 27) { // ESC this.ui.passwordInput.val(''); + this.ui.passwordOption.hide(); + this.ui.passwordButton.show(); } }, From 43951d98e9f33095079c27d679054a7f122461cf Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Fri, 2 Feb 2018 14:43:21 +0100 Subject: [PATCH 2/4] Set opened lock icon when no password is set. Signed-off-by: Ivan Sein --- css/style.scss | 4 ++++ img/no-password.svg | 1 + js/views/callinfoview.js | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 img/no-password.svg diff --git a/css/style.scss b/css/style.scss index 1d6b45171c7..659fa385595 100644 --- a/css/style.scss +++ b/css/style.scss @@ -737,6 +737,10 @@ video { background-image: url('../img/menu-people.svg?v=1'); } +.icon-no-password { + background-image: url('../img/no-password.svg?v=1'); +} + #app-sidebar .close { position: absolute; top: 0; diff --git a/img/no-password.svg b/img/no-password.svg new file mode 100644 index 00000000000..981197eda76 --- /dev/null +++ b/img/no-password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/js/views/callinfoview.js b/js/views/callinfoview.js index 4dd7b46e9ff..4bde7de45ca 100644 --- a/js/views/callinfoview.js +++ b/js/views/callinfoview.js @@ -51,7 +51,7 @@ ' ' + ' {{#if isPublic}}' + '
' + - '
' + + '
' + '
' + ' '+ From a2efd5790d2e147f9df6e16e4294bd5b8d28a0b6 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Mon, 5 Feb 2018 17:24:27 +0100 Subject: [PATCH 3/4] Notify on error while setting password and hide input field only on success. Signed-off-by: Ivan Sein --- js/views/callinfoview.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/views/callinfoview.js b/js/views/callinfoview.js index 4bde7de45ca..31072bfe6bd 100644 --- a/js/views/callinfoview.js +++ b/js/views/callinfoview.js @@ -296,14 +296,15 @@ }, success: function() { this.ui.passwordInput.val(''); - + this.ui.passwordOption.hide(); + this.ui.passwordButton.show(); OCA.SpreedMe.app.syncRooms(); - }.bind(this) + }.bind(this), + error: function() { + OC.Notification.show(t('spreed', 'Error occurred while setting password'), {type: 'error'}); + } }); - this.ui.passwordOption.hide(); - this.ui.passwordButton.show(); - console.log('.rename-option'); }, From 4c5af5779c930da4fce493a011f4ef3953f6c8be Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Mon, 5 Feb 2018 17:31:31 +0100 Subject: [PATCH 4/4] Remove debug logs. Signed-off-by: Ivan Sein --- js/views/callinfoview.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/js/views/callinfoview.js b/js/views/callinfoview.js index 31072bfe6bd..c4ecee50e53 100644 --- a/js/views/callinfoview.js +++ b/js/views/callinfoview.js @@ -284,10 +284,6 @@ confirmPassword: function() { var newPassword = this.ui.passwordInput.val().trim(); - - console.log('Setting room password to "' + newPassword + '".'); - console.log('Setting room password to "' + this.model.get('hasPassword') + '".'); - $.ajax({ url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('token') + '/password', type: 'PUT', @@ -304,8 +300,6 @@ OC.Notification.show(t('spreed', 'Error occurred while setting password'), {type: 'error'}); } }); - - console.log('.rename-option'); }, keyUpPassword: function(e) {