Permalink
Browse files

Merge pull request #293 from hermansc/close-confirmation-dialog

Adds confirmation dialog and help text to server and channel close.
  • Loading branch information...
2 parents a2b76b1 + 64b1b38 commit 15178957b6038a2a733629cb4ea4bb809923905d @thedjpetersen committed Feb 16, 2014
Showing with 14 additions and 6 deletions.
  1. +8 −3 assets/js/views/channel_tab.js
  2. +4 −1 assets/js/views/chat_application.js
  3. +2 −2 views/templates.jade
@@ -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() {
@@ -79,7 +79,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');
+ }
});
},
View
@@ -168,7 +168,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}}
@@ -178,7 +178,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}}

0 comments on commit 1517895

Please sign in to comment.