Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

plans_page: Add JS toggle for showing cloud or self-hosted plans.

Karl Stolleyc9f33344e213
diff --git a/templates/corporate/plans.html b/templates/corporate/plans.html
index 9d88bfa0f32..54fc7713873 100644
--- a/templates/corporate/plans.html
+++ b/templates/corporate/plans.html
@@ -13,7 +13,7 @@
{% include 'zerver/landing_nav.html' %}
-<div class="portico-pricing plans">
+<div class="portico-pricing plans showing-cloud">
<div class="main">
{% include "corporate/pricing_model.html" %}
</div>
diff --git a/templates/corporate/pricing_model.html b/templates/corporate/pricing_model.html
index 60e62873960..98372dea55f 100644
--- a/templates/corporate/pricing_model.html
+++ b/templates/corporate/pricing_model.html
@@ -10,7 +10,7 @@
</a> tools.
</div>
<div class="pricing-container">
- <div class="cloud-plan-title pricing-tab">
+ <div id="cloud" class="cloud-plan-title pricing-tab">
<h2>Cloud</h2>
<p>
Always updated to the latest version of Zulip.
@@ -104,7 +104,7 @@
</div>
</div>
- <div class="self-hosted-plan-title pricing-tab">
+ <div id="self-hosted" class="self-hosted-plan-title pricing-tab">
<h2>Self-hosted</h2>
<p>
Retain full control over your data and simplify compliance by self-hosting.
diff --git a/web/src/portico/landing-page.js b/web/src/portico/landing-page.js
index 6f7577ec8d4..bf516b51c6e 100644
--- a/web/src/portico/landing-page.js
+++ b/web/src/portico/landing-page.js
@@ -135,6 +135,14 @@ $(() => {
delete page_params.contributors;
render_tabs(contributors);
}
+
+ if (window.location.pathname === "/plans/" && window.location.hash === "#self-hosted") {
+ // Don't scroll to the target element
+ window.scroll({top: 0});
+ const $pricing_wrapper = $(".portico-pricing");
+ $pricing_wrapper.removeClass("showing-cloud");
+ $pricing_wrapper.addClass("showing-self-hosted");
+ }
});
// Scroll to anchor link when clicked. Note that help.js has a similar
@@ -143,3 +151,11 @@ $(() => {
$(document).on("click", ".markdown h1, .markdown h2, .markdown h3", function () {
window.location.hash = $(this).attr("id");
});
+
+$(document).on("click", ".pricing-tab", function () {
+ const id = $(this).attr("id");
+ const $pricing_wrapper = $(".portico-pricing");
+ $pricing_wrapper.removeClass("showing-cloud showing-self-hosted");
+ $pricing_wrapper.addClass(`showing-${id}`);
+ history.pushState(null, null, `#${id}`);
+});
diff --git a/web/styles/portico/hello.css b/web/styles/portico/hello.css
index 420bddeb018..8de582adafe 100644
--- a/web/styles/portico/hello.css
+++ b/web/styles/portico/hello.css
@@ -1133,6 +1133,8 @@ ul {
}
.pricing-tab {
+ cursor: pointer;
+
h2 {
font-family: var(--font-ops);
font-weight: 550;
@@ -1253,4 +1255,16 @@ ul {
font-size: 14px;
}
}
+
+ &.showing-cloud {
+ .self-hosted-plan-pricing {
+ display: none;
+ }
+ }
+
+ &.showing-self-hosted {
+ .cloud-plan-pricing {
+ display: none;
+ }
+ }
}