From e00f9f3dcba651d279cf1bdf2b3be11c00ed46cb Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 18 May 2017 05:06:57 -0700 Subject: [PATCH] Split out Organization Permissions page. --- frontend_tests/casper_tests/10-admin.js | 5 + .../casper_tests/12-toggle-message-editing.js | 9 + static/js/admin.js | 2 + static/js/admin_sections.js | 1 + static/js/settings.js | 1 + static/js/settings_org.js | 7 +- static/templates/admin_tab.handlebars | 1 + .../organization-permissions-admin.handlebars | 180 ++++++++++++++++++ .../organization-settings-admin.handlebars | 152 --------------- templates/zerver/settings_overlay.html | 4 + 10 files changed, 205 insertions(+), 157 deletions(-) create mode 100644 static/templates/settings/organization-permissions-admin.handlebars diff --git a/frontend_tests/casper_tests/10-admin.js b/frontend_tests/casper_tests/10-admin.js index ac1c44e34a..3fb303bdd2 100644 --- a/frontend_tests/casper_tests/10-admin.js +++ b/frontend_tests/casper_tests/10-admin.js @@ -19,6 +19,11 @@ casper.waitForSelector('#settings_overlay_container.show', function () { casper.test.assertUrlMatch(/^http:\/\/[^/]+\/#organization/, 'URL suggests we are on organization page'); }); +// Test permissions setting +casper.then(function () { + casper.click("li[data-section='organization-permissions']"); +}); + // Test setting limiting stream creation to administrators casper.then(function () { casper.click('#id_realm_create_stream_by_admins_only + span'); diff --git a/frontend_tests/casper_tests/12-toggle-message-editing.js b/frontend_tests/casper_tests/12-toggle-message-editing.js index fb7c78e9b7..467edf92d4 100644 --- a/frontend_tests/casper_tests/12-toggle-message-editing.js +++ b/frontend_tests/casper_tests/12-toggle-message-editing.js @@ -79,6 +79,15 @@ casper.then(function () { casper.click('a[href^="#organization"]'); }); +casper.waitForSelector('#settings_overlay_container.show', function () { + casper.test.info('Organization page is active'); + casper.test.assertUrlMatch(/^http:\/\/[^/]+\/#organization/, 'URL suggests we are on organization page'); +}); + +casper.then(function () { + casper.click("li[data-section='organization-permissions']"); +}); + // deactivate "allow message editing" casper.waitUntilVisible('input[type="checkbox"][id="id_realm_allow_message_editing"] + span', function () { casper.click('input[type="checkbox"][id="id_realm_allow_message_editing"] + span'); diff --git a/static/js/admin.js b/static/js/admin.js index 47982f1fbd..f40761b5fe 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -10,6 +10,8 @@ exports.show_or_hide_menu_item = function () { item.find("span").text(i18n.t("Organization settings")); $(".organization-box [data-name='organization-settings']") .find("input, textarea, button, select").attr("disabled", true); + $(".organization-box [data-name='organization-permissions']") + .find("input, textarea, button, select").attr("disabled", true); $(".organization-box [data-name='auth-methods']") .find("input, button, select, checked").attr("disabled", true); $(".organization-box [data-name='default-streams-list']") diff --git a/static/js/admin_sections.js b/static/js/admin_sections.js index 604af221d2..4fa42cc501 100644 --- a/static/js/admin_sections.js +++ b/static/js/admin_sections.js @@ -9,6 +9,7 @@ exports.load_admin_section = function (name) { switch (name) { case 'organization-settings': + case 'organization-permissions': case 'auth-methods': section = 'org'; break; diff --git a/static/js/settings.js b/static/js/settings.js index fc91752d18..7ecdf2a479 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -59,6 +59,7 @@ function _setup_page() { "muted-topics": i18n.t("Muted topics"), "zulip-labs": i18n.t("Zulip labs"), "organization-settings": i18n.t("Organization settings"), + "organization-permissions": i18n.t("Organization permissions"), "emoji-settings": i18n.t("Emoji settings"), "auth-methods": i18n.t("Authorization methods"), "user-list-admin": i18n.t("Active users"), diff --git a/static/js/settings_org.js b/static/js/settings_org.js index 2b68bef2b1..dfcde9bdbe 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -135,11 +135,8 @@ exports.set_up = function () { }); $(".organization").on("submit", "form.admin-realm-form", function (e) { - // TODO: We actually have two forms named admin-realm-form. We really - // should break out a separate endpoint to update the realm's - // auth backends, and then we can make our code more modular by - // having two different form classes, two different click handlers, - // and a separate JS module for handling auth backends. + // TODO: We actually have three forms named admin-realm-form. We really + // should break out three separate forms. var name_status = $("#admin-realm-name-status").expectOne(); var description_status = $("#admin-realm-description-status").expectOne(); diff --git a/static/templates/admin_tab.handlebars b/static/templates/admin_tab.handlebars index 386aaa3d68..139fa5017b 100644 --- a/static/templates/admin_tab.handlebars +++ b/static/templates/admin_tab.handlebars @@ -5,6 +5,7 @@ {{ partial "realm-domains-modal" }} {{ partial "organization-settings-admin" }} +{{ partial "organization-permissions-admin" }} {{ partial "emoji-settings-admin" }} diff --git a/static/templates/settings/organization-permissions-admin.handlebars b/static/templates/settings/organization-permissions-admin.handlebars new file mode 100644 index 0000000000..92543fe0d2 --- /dev/null +++ b/static/templates/settings/organization-permissions-admin.handlebars @@ -0,0 +1,180 @@ +
+
+

{{t "Organization permissions" }}

+ +
+
+
+
+
+
+
+
+
+
+ +
+
+ + + {{#if is_admin }} + {{t "[Add or Change]" }} + {{/if}} +
+ +
+ + +
+ +
+ + +
+ + {{#if server_inline_image_preview}} +
+ + +
+ {{/if}} + + {{#if server_inline_url_embed_preview}} +
+ + +
+ {{/if}} + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + {{#if false}} +
+ + +
+ {{/if}} + + {{#if is_admin }} +
+ +
+ {{/if}} +
+
+
diff --git a/static/templates/settings/organization-settings-admin.handlebars b/static/templates/settings/organization-settings-admin.handlebars index 2ac4f03611..7347799708 100644 --- a/static/templates/settings/organization-settings-admin.handlebars +++ b/static/templates/settings/organization-settings-admin.handlebars @@ -4,18 +4,8 @@
-
-
-
-
-
-
-
-
-
-
@@ -28,148 +18,6 @@
-
- - - {{#if is_admin }} - {{t "[Add or Change]" }} - {{/if}} -
-
- - -
-
- - -
- {{#if server_inline_image_preview}} -
- - -
- {{/if}} - {{#if server_inline_url_embed_preview}} -
- - -
- {{/if}} -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- {{#if false}} -
- - -
- {{/if}}