mirror of https://github.com/zulip/zulip.git
Allow admins to change the realm's name in the UI.
(imported from commit 2873f872069a41c91beb87728f64fa526dd8a326)
This commit is contained in:
parent
8266ac3cf9
commit
eea8c0d1d5
|
@ -163,6 +163,30 @@ exports.setup_page = function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".administration").on("submit", "form.admin-realm-name", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
var new_name = $("input.admin-realm-name").val();
|
||||||
|
|
||||||
|
var url = "/json/realm";
|
||||||
|
var data = {
|
||||||
|
name: JSON.stringify(new_name)
|
||||||
|
};
|
||||||
|
var status = $(".admin-realm-name .admin-realm-name-status").expectOne();
|
||||||
|
|
||||||
|
channel.patch({
|
||||||
|
url: url,
|
||||||
|
data: data,
|
||||||
|
success: function () {
|
||||||
|
ui.report_success("Name changed!", status);
|
||||||
|
},
|
||||||
|
error: function (xhr, error) {
|
||||||
|
ui.report_error("Failed!", xhr, status);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$(".admin_user_table").on("click", ".make-admin", function (e) {
|
$(".admin_user_table").on("click", ".make-admin", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -72,6 +72,12 @@ function get_events_success(events) {
|
||||||
case 'update_message':
|
case 'update_message':
|
||||||
messages_to_update.push(event);
|
messages_to_update.push(event);
|
||||||
break;
|
break;
|
||||||
|
case 'realm':
|
||||||
|
if (event.op === 'update' && event.property === 'name') {
|
||||||
|
page_params.realm_name = event.value;
|
||||||
|
notifications.redraw_title();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'realm_user':
|
case 'realm_user':
|
||||||
if (event.op === 'add') {
|
if (event.op === 'add') {
|
||||||
people.add_in_realm(event.person);
|
people.add_in_realm(event.person);
|
||||||
|
|
|
@ -3783,6 +3783,10 @@ div.edit_bot {
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-realm-name-status {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
li.show-more-topics a {
|
li.show-more-topics a {
|
||||||
font-size: 75%;
|
font-size: 75%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,24 @@
|
||||||
<div class="administration">
|
<div class="administration">
|
||||||
<div class="alert" id="administration-status"></div>
|
<div class="alert" id="administration-status"></div>
|
||||||
<h1>Administration</h1>
|
<h1>Administration</h1>
|
||||||
|
|
||||||
|
<form class="admin-realm-name form-horizontal">
|
||||||
|
<div class="control-group admin-realm-name">
|
||||||
|
<div class="alert admin-realm-name-status"></div>
|
||||||
|
<label for="realm_name" class="control-label">Realm name</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" name="realm_name" class="admin-realm-name"
|
||||||
|
value="{{ realm_name }}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<input type="submit" class="btn" value="Save" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<h2>Users</h2>
|
<h2>Users</h2>
|
||||||
<table class="table table-condensed table-striped">
|
<table class="table table-condensed table-striped">
|
||||||
<tbody id="admin_users_table" class="admin_user_table">
|
<tbody id="admin_users_table" class="admin_user_table">
|
||||||
|
|
|
@ -64,12 +64,16 @@ function render(template_name, args) {
|
||||||
}());
|
}());
|
||||||
|
|
||||||
(function admin_tab() {
|
(function admin_tab() {
|
||||||
var html = render('admin_tab');
|
var args = {
|
||||||
|
realm_name: 'Zulip'
|
||||||
|
};
|
||||||
|
var html = render('admin_tab', args);
|
||||||
var admin_features = ["admin_users_table", "admin_bots_table",
|
var admin_features = ["admin_users_table", "admin_bots_table",
|
||||||
"admin_streams_table", "admin_deactivated_users_table"];
|
"admin_streams_table", "admin_deactivated_users_table"];
|
||||||
_.each(admin_features, function (admin_feature) {
|
_.each(admin_features, function (admin_feature) {
|
||||||
assert.notEqual($(html).find("#" + admin_feature).length, 0);
|
assert.notEqual($(html).find("#" + admin_feature).length, 0);
|
||||||
});
|
});
|
||||||
|
assert.equal($(html).find("input.admin-realm-name").val(), 'Zulip');
|
||||||
global.write_test_output("admin_tab.handlebars", html);
|
global.write_test_output("admin_tab.handlebars", html);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue