mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Keep save button disabled if changed username invalid
- Disabled till username not changed - On change, if username is empty, then disabled - On change, if username is changed back to previous, then disabled - Else allow saving
This commit is contained in:
parent
89b112ea95
commit
409f3f7fbe
@ -532,6 +532,8 @@ class Tab(QtWidgets.QWidget):
|
||||
return self.share_mode
|
||||
elif self.mode == self.common.gui.MODE_RECEIVE:
|
||||
return self.receive_mode
|
||||
elif self.mode == self.common.gui.MODE_CHAT:
|
||||
return self.chat_mode
|
||||
else:
|
||||
return self.website_mode
|
||||
else:
|
||||
|
@ -34,6 +34,15 @@ $(function(){
|
||||
emitMessage(socket);
|
||||
});
|
||||
|
||||
// Keep buttons disabled unless changed or not empty
|
||||
$('#username').on('keyup',function() {
|
||||
if ($('#username').val() !== '' && $('#username').val() !== current_username) {
|
||||
$('#update-username').removeAttr('disabled');
|
||||
} else {
|
||||
$('#update-username').attr('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
// Update username
|
||||
$('#update-username').on('click', function() {
|
||||
var username = $('#username').val();
|
||||
|
@ -28,7 +28,7 @@
|
||||
<div class="chat-users">
|
||||
<div class="editable-username">
|
||||
<input id="username" value="{{ username }}" />
|
||||
<button id="update-username">Save</button>
|
||||
<button id="update-username" disabled>Save</button>
|
||||
</div>
|
||||
<ul id="user-list">
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user