forked from maccman/holla
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.js
More file actions
58 lines (43 loc) · 1.28 KB
/
Copy pathsettings.js
File metadata and controls
58 lines (43 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//= require <jquery.editable>
(function($){
jQuery(function(){
$("input.copy").live("click", function(){
$(this).select();
});
});
var state = App.state.add("settings");
state.setup(function(){
this.channels.delegate("a.disconnect", "click", function(){
var channel = $(this).parents(".connect-item").item();
$.confirm("Are you sure you want to remove this channel?", function(){
channel.disconnect();
});
});
this.channels.delegate("a.share", "click", function(){
$(this).parents("tr").next(".share").toggleDisplay();
});
this.channels.delegate("td.name", "value.edit", function(e, name){
var channel = $(this).item();
channel.name = name;
channel.save();
channel.updateRemote();
});
this.channels.delegate("td.name", "click", function(e){
$(this).startEditable();
});
this.channelConnector = this.channels.connect(Channel);
this.channelConnector.render();
this.create.submit(this.proxy(function(e){
e.preventDefault();
var input = this.create.find("input");
if (input.val() == "") return;
var channel = new Channel;
channel.name = input.val();
channel.save();
channel.createRemote();
input.val("");
input.select();
}));
});
state.hasView = true;
})(jQuery);