diff --git a/app/index.html b/app/index.html index 10be665..048ffd3 100644 --- a/app/index.html +++ b/app/index.html @@ -78,6 +78,22 @@ + +
+
+ Add channel +
+
+ + + + + +
Channel
+ +
+
+
@@ -413,7 +429,7 @@ class="join"> Join Channel -
  • Add
  • @@ -421,7 +437,7 @@ class="edit"> Edit -
  • Remove
  • diff --git a/app/index.js b/app/index.js index f3f8029..dfb3e23 100644 --- a/app/index.js +++ b/app/index.js @@ -88,6 +88,20 @@ function ContextMenu () { self.target = ko.observable() } +function AddChannelDialog () { + var self = this; + self.channelName = ko.observable('') + self.parentID = 0; + self.visible = ko.observable(false); + self.show = self.visible.bind(self.visible, true) + self.hide = self.visible.bind(self.visible, false) + + self.addchannel = function() { + self.hide(); + ui.addchannel(self.channelName()); + } +} + function ConnectDialog () { var self = this self.address = ko.observable('') @@ -327,6 +341,7 @@ class GlobalBindings { this.userContextMenu = new ContextMenu() this.channelContextMenu = new ContextMenu() this.connectDialog = new ConnectDialog() + this.addChannelDialog = new AddChannelDialog() this.connectErrorDialog = new ConnectErrorDialog(this.connectDialog) this.connectionInfo = new ConnectionInfo(this) this.commentDialog = new CommentDialog() @@ -372,6 +387,32 @@ class GlobalBindings { this.settingsDialog(new SettingsDialog(this.settings)) } + this.openAddChannel = (user, channel) => { + this.addChannelDialog.parentID = channel.model._id; + this.addChannelDialog.show() + } + + this.addchannel = (channelName) => { + var msg = { + name: 'ChannelState', + payload: { + parent: this.addChannelDialog.parentID || 0, + name: channelName + } + } + this.client._send(msg); + } + + this.ChannelRemove = (user, channel) => { + var msg = { + name: 'ChannelRemove', + payload: { + channel_id: channel.model._id + } + } + this.client._send(msg); + } + this.applySettings = () => { const settingsDialog = this.settingsDialog() @@ -689,13 +730,13 @@ class GlobalBindings { return true // TODO check for perms } ui.canAdd = () => { - return false // TODO check for perms and implement + return true // TODO check for perms } ui.canEdit = () => { return false // TODO check for perms and implement } ui.canRemove = () => { - return false // TODO check for perms and implement + return true // TODO check for perms } ui.canLink = () => { return false // TODO check for perms and implement diff --git a/app/worker-client.js b/app/worker-client.js index def8d64..c3ee400 100644 --- a/app/worker-client.js +++ b/app/worker-client.js @@ -138,6 +138,7 @@ class WorkerBasedMumbleClient extends EventEmitter { connector._addCall(this, 'setSelfMute', id) connector._addCall(this, 'setSelfTexture', id) connector._addCall(this, 'setAudioQuality', id) + connector._addCall(this, '_send', id) connector._addCall(this, 'disconnect', id) let _disconnect = this.disconnect