diff --git a/css/style.scss b/css/style.scss index 4808423875e..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; @@ -923,11 +927,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/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 a8adbae136d..c4ecee50e53 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,12 +276,14 @@ /** * Password */ + showPasswordInput: function() { + this.ui.passwordButton.hide(); + this.ui.passwordOption.show(); + this.ui.passwordInput.focus(); + }, + 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', @@ -279,12 +292,14 @@ }, 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'}); + } }); - - console.log('.rename-option'); }, keyUpPassword: function(e) { @@ -294,6 +309,8 @@ } else if (e.keyCode === 27) { // ESC this.ui.passwordInput.val(''); + this.ui.passwordOption.hide(); + this.ui.passwordButton.show(); } },