Skip to content

Commit

Permalink
Adds confirmation dialog and help text to server and channel close.
Browse files Browse the repository at this point in the history
In order to improve the UX this commit adds a confirmation dialog when
closing the connection to the server. It also adds a 'title'-tag over
the close-icon (an 'x') informing the user that pressing this button
will result in either leaving network or channel.
  • Loading branch information
hermansc committed Feb 15, 2014
1 parent 2b151f1 commit 64b1b38
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
11 changes: 8 additions & 3 deletions assets/js/views/channel_tab.js
Expand Up @@ -57,11 +57,16 @@ var ChannelTabView = Backbone.View.extend({

close: function(e) {
e.stopPropagation();
if (this.model.get('type') === 'channel')
irc.socket.emit('part', this.model.get('name'));
else
if (this.model.get('type') === 'channel') {
var response = confirm("Are you sure you want to leave " + this.model.get('name') + "?");
if (response) {
irc.socket.emit('part', this.model.get('name'));
}
}
else {
irc.socket.emit('part_pm', this.model.get('name'));
this.model.destroy();
}
},

switchAndRemove: function() {
Expand Down
5 changes: 4 additions & 1 deletion assets/js/views/chat_application.js
Expand Up @@ -69,7 +69,10 @@ var ChatApplicationView = Backbone.View.extend({

// disconnect server handler
$('#user-box .close-button').click(function() {
irc.socket.emit('logout');
var response = confirm("Are you sure you want to leave this network?");
if (response) {
irc.socket.emit('logout');
}
});
},

Expand Down
4 changes: 2 additions & 2 deletions views/templates.jade
Expand Up @@ -156,7 +156,7 @@ script(id="chat", type="text/html")
script(id="channel", type="text/html")
span(class="channel-name") {{name}}
{{#notStatus}}
.close-button ×
.close-button(title="Leave {{name}}") ×
span(class="unread", title="Unread Messages") {{unread}}
span(class="unread-mentions", title="Mentions in channel") {{unread_mentions}}
{{/notStatus}}
Expand All @@ -166,7 +166,7 @@ script(id="user_box", type="text/html")
i(class="icon-user icon-white spacing-right")
{{nick}}
div.user_box_element
.close-button ×
.close-button(title="Close connection to {{server}}") ×
i(class="icon-asterisk icon-white spacing-right")
{{server}}

Expand Down

0 comments on commit 64b1b38

Please sign in to comment.