Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings_playground: Add UI to delete a playground.
Sumanth V Raoc21a40d823bd
diff --git a/static/js/settings_playgrounds.js b/static/js/settings_playgrounds.jsindex eeb744e2845..f37741be3fd 100644--- a/static/js/settings_playgrounds.js+++ b/static/js/settings_playgrounds.js@@ -54,7 +54,9 @@ export function populate_playgrounds(playgrounds_data) {playground_name: playground.name,pygments_language: playground.pygments_language,url_prefix: playground.url_prefix,+ id: playground.id,},+ can_modify: page_params.is_admin,});},filter: {@@ -88,6 +90,21 @@ function build_page() {meta.loaded = true;populate_playgrounds(page_params.realm_playgrounds);+ $(".admin_playgrounds_table").on("click", ".delete", function (e) {+ e.preventDefault();+ e.stopPropagation();+ const btn = $(this);++ channel.del({+ url: "/json/realm/playgrounds/" + encodeURIComponent(btn.attr("data-playground-id")),+ error(xhr) {+ ui_report.generic_row_button_error(xhr, btn);+ },+ // There is no need for an on-success action here since the row is removed by the+ // `realm_playgrounds` events handler which builds the playground list again.+ });+ });+$(".organization form.admin-playground-form").off("submit").on("submit", function (e) {diff --git a/static/templates/settings/admin_playground_list.hbs b/static/templates/settings/admin_playground_list.hbsindex c9496975ab4..4579ee8e6f7 100644--- a/static/templates/settings/admin_playground_list.hbs+++ b/static/templates/settings/admin_playground_list.hbs@@ -9,5 +9,12 @@<td><span>{{url_prefix}}</span></td>+ {{#if ../can_modify}}+ <td class="no-select actions">+ <button class="button small delete btn-danger tippy-zulip-tooltip" data-playground-id="{{id}}" data-tippy-content="{{t 'Delete' }} {{ playground_name }}" aria-label="{{t 'Delete' }} {{ playground_name }}">+ <i class="fa fa-trash-o"></i>+ </button>+ </td>+ {{/if}}</tr>{{/with}}diff --git a/static/templates/settings/playground_settings_admin.hbs b/static/templates/settings/playground_settings_admin.hbsindex 0b0db9d6e01..a571c8890cb 100644--- a/static/templates/settings/playground_settings_admin.hbs+++ b/static/templates/settings/playground_settings_admin.hbs@@ -55,6 +55,9 @@<th class="active" data-sort="pygments_language">{{t "Language" }}</th><th data-sort="playground_name">{{t "Name" }}</th><th data-sort="url">{{t "URL prefix" }}</th>+ {{#if is_admin}}+ <th class="actions">{{t "Actions" }}</th>+ {{/if}}</thead><tbody id="admin_playgrounds_table" class="required-text" data-empty="{{t 'No playgrounds configured.' }}"></tbody></table>