Skip to content

Commit

Permalink
Merge pull request thedjpetersen#293 from hermansc/close-confirmation…
Browse files Browse the repository at this point in the history
…-dialog

Adds confirmation dialog and help text to server and channel close.
  • Loading branch information
thedjpetersen committed Feb 16, 2014
2 parents a2b76b1 + 64b1b38 commit 1517895
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 @@ -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');
}
});
},

Expand Down
4 changes: 2 additions & 2 deletions views/templates.jade
Expand Up @@ -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}}
Expand All @@ -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}}

Expand Down

0 comments on commit 1517895

Please sign in to comment.