diff --git a/lib/channel-new.js b/lib/channel-new.js index f4417eac..b696aa43 100644 --- a/lib/channel-new.js +++ b/lib/channel-new.js @@ -2329,7 +2329,7 @@ Channel.prototype.handleMoveFilter = function (user, data) { /** * Handles a user message to change the channel permissions */ -Channel.prototype.handleUpdatePermissions = function (user, perms) { +Channel.prototype.handleSetPermissions = function (user, perms) { if (user.rank < 3) { user.kick("Attempted setPermissions as a non-admin"); return; diff --git a/templates/channel.jade b/templates/channel.jade index 90c8af6e..08fe7d5a 100644 --- a/templates/channel.jade +++ b/templates/channel.jade @@ -177,6 +177,7 @@ html(lang="en") li: a(href="#cs-motdeditor", data-toggle="tab", tabindex="-1") Edit MOTD li: a(href="#cs-csseditor", data-toggle="tab", tabindex="-1") Edit CSS li: a(href="#cs-jseditor", data-toggle="tab", tabindex="-1") Edit Javascript + li: a(href="#cs-permedit", data-toggle="tab", tabindex="-1") Edit Permissions li: a(href="#cs-chanranks", data-toggle="tab", tabindex="-1", onclick="javascript:socket.emit('requestChannelRanks')") Edit moderators li: a(href="#cs-banlist", data-toggle="tab", tabindex="-1", onclick="javascript:socket.emit('requestBanlist')") Ban list .modal-body @@ -192,6 +193,7 @@ html(lang="en") mixin chanranks() mixin chatfilters() mixin chanlog() + mixin permeditor() .modal-footer button.btn.btn-default(type="button", data-dismiss="modal") Close include footer diff --git a/templates/channeloptions.jade b/templates/channeloptions.jade index 98dea0ff..6089753f 100644 --- a/templates/channeloptions.jade +++ b/templates/channeloptions.jade @@ -162,3 +162,6 @@ mixin chanlog input#filter_joinquit(type="checkbox") pre#chanlog_contents(style="max-height: 400px; overflow-y: scroll") button.btn.btn-default#chanlog_refresh Refresh + +mixin permeditor + #cs-permedit.tab-pane diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 555f22e5..b1dcb8eb 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -300,8 +300,7 @@ Callbacks = { setPermissions: function(perms) { CHANNEL.perms = perms; - if(CLIENT.rank >= Rank.Admin) - genPermissionsEditor(); + genPermissionsEditor(); handlePermissionChange(); }, diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 668e27eb..10117bbc 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -1370,33 +1370,36 @@ function chatOnly() { // TODO fix function genPermissionsEditor() { - $("#permedit").html(""); + $("#cs-permedit").html(""); var form = $("
").addClass("form-horizontal") .attr("action", "javascript:void(0)") - .appendTo($("#permedit")); - var fs = $("").appendTo(form); + .appendTo($("#cs-permedit")); function makeOption(text, key, permset, defval) { - var group = $("").addClass("control-group") - .appendTo(fs); - $("").addClass("control-label") + var group = $("").addClass("form-group") + .appendTo(form); + $("").addClass("control-label col-sm-4") .text(text) .appendTo(group); - var controls = $("").addClass("controls") + var controls = $("").addClass("col-sm-8") .appendTo(group); - var select = $("").appendTo(controls); - select.data("key", key); - for(var i = 0; i < permset.length; i++) { + var select = $("").addClass("form-control") + .appendTo(controls) + .data("key", key); + + for (var i = 0; i < permset.length; i++) { $("").attr("value", permset[i][1]) .text(permset[i][0]) - .attr("selected", defval == permset[i][1]) + .attr("selected", defval === permset[i][1]) .appendTo(select); } } - function addDivider(text) { - $("