settings: Fix live-update of text on the bots admin page.

We did not live-update the text on the top of admin bots page
correctly when changing the bot creation policy. This commit
fixes it.
This commit is contained in:
Sahil Batra 2023-10-11 19:31:46 +05:30 committed by Tim Abbott
parent 4b23ac2743
commit 1080da08f0
2 changed files with 11 additions and 5 deletions

View File

@ -176,10 +176,15 @@ export function update_bot_settings_tip($tip_container, for_org_settings) {
function update_add_bot_button() {
if (can_create_new_bots()) {
$("#bot-settings .add-a-new-bot").show();
$("#admin-bot-list .add-a-new-bot").show();
$("#admin-bot-list .add-new-bots").show();
$("#admin-bot-list .manage-your-bots").hide();
} else {
$("#bot-settings .add-a-new-bot").hide();
$("#admin-bot-list .add-a-new-bot").hide();
$("#admin-bot-list .add-new-bots").hide();
if (bot_data.get_all_bots_for_current_user().length > 0) {
$("#admin-bot-list .manage-your-bots").show();
}
}
}

View File

@ -4,18 +4,19 @@
<div class="clear-float"></div>
<div>
{{t "You are viewing all the bots in this organization." }}
{{#if can_create_new_bots}}
<span class="add-new-bots" {{#unless can_create_new_bots}}style="display: none;"{{/unless}}>
{{#tr}}
You can <z-link-new-bot>add a new bot</z-link-new-bot> or <z-link-manage-bot>manage</z-link-manage-bot> your own bots.
{{#*inline "z-link-new-bot"}}<a class="add-a-new-bot">{{> @partial-block}}</a>{{/inline}}
{{#*inline "z-link-manage-bot"}}<a href="/#settings/your-bots">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
{{else if has_bots}}
</span>
<span class="manage-your-bots" {{#unless (and (not can_create_new_bots) has_bots)}}style="display: none;"{{/unless}}>
{{#tr}}
You can <z-link>manage</z-link> your own bots.
{{#*inline "z-link"}}<a href="/#settings/your-bots">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
{{/if}}
</span>
</div>
<div class="settings_panel_list_header">
<h3>{{t "Bots"}}</h3>