mirror of https://github.com/zulip/zulip.git
portico: Change buttons on /plans to reflect current plan.
This commit is contained in:
parent
9489ce0efc
commit
c913eafdf4
|
@ -183,6 +183,13 @@ button.green {
|
|||
border: 1px solid hsl(169, 45%, 43%);
|
||||
}
|
||||
|
||||
button.black-disabled {
|
||||
cursor: default;
|
||||
color: #333;
|
||||
background-color: transparent;
|
||||
border: 1px solid #888;
|
||||
}
|
||||
|
||||
button.button.grey-transparent {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
</div>
|
||||
<div class="bottom">
|
||||
<div class="text-content">
|
||||
{% if realm_plan_type == 0 %}
|
||||
<div class="pricing-details">
|
||||
Free
|
||||
</div>
|
||||
|
@ -46,6 +47,12 @@
|
|||
Sign up now
|
||||
</button>
|
||||
</a>
|
||||
{% elif realm_plan_type == 2 %}
|
||||
<div class="pricing-details"></div>
|
||||
<button class="black-disabled" type="button">
|
||||
Current plan
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,11 +83,23 @@
|
|||
$8/month billed monthly
|
||||
</div>
|
||||
</div>
|
||||
<a href="/new/">
|
||||
{% if realm_plan_type in [3, 4] %}
|
||||
<button class="black-disabled" type="button">
|
||||
Current plan
|
||||
</button>
|
||||
{% elif realm_plan_type == 2 %}
|
||||
<a href="/upgrade">
|
||||
<button class="green" type="button">
|
||||
Try it free
|
||||
Buy Premium
|
||||
</button>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="/new">
|
||||
<button class="green" type="button">
|
||||
Buy Premium
|
||||
</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -56,6 +56,7 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
|
|||
realm_icon = None
|
||||
realm_description = None
|
||||
realm_invite_required = False
|
||||
realm_plan_type = 0
|
||||
else:
|
||||
realm_uri = realm.uri
|
||||
realm_name = realm.name
|
||||
|
@ -63,6 +64,7 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
|
|||
realm_description_raw = realm.description or "The coolest place in the universe."
|
||||
realm_description = convert(realm_description_raw, message_realm=realm)
|
||||
realm_invite_required = realm.invite_required
|
||||
realm_plan_type = realm.plan_type
|
||||
|
||||
register_link_disabled = settings.REGISTER_LINK_DISABLED
|
||||
login_link_disabled = settings.LOGIN_LINK_DISABLED
|
||||
|
@ -114,6 +116,7 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
|
|||
'realm_name': realm_name,
|
||||
'realm_icon': realm_icon,
|
||||
'realm_description': realm_description,
|
||||
'realm_plan_type': realm_plan_type,
|
||||
'root_domain_uri': settings.ROOT_DOMAIN_URI,
|
||||
'apps_page_url': apps_page_url,
|
||||
'open_realm_creation': settings.OPEN_REALM_CREATION,
|
||||
|
|
|
@ -323,9 +323,40 @@ class PlansPageTest(ZulipTestCase):
|
|||
realm.plan_type = Realm.PREMIUM_FREE
|
||||
realm.save(update_fields=["plan_type"])
|
||||
result = self.client_get("/plans/", subdomain="zulip")
|
||||
self.assert_in_success_response(["Sign up now"], result)
|
||||
self.assert_in_success_response(["Current plan"], result)
|
||||
# Test root domain, with login on different domain
|
||||
result = self.client_get("/plans/", subdomain="")
|
||||
# TODO: works in manual testing, but I suspect something is funny in
|
||||
# the test environment
|
||||
# self.assert_in_success_response(["Sign up now"], result)
|
||||
|
||||
def test_CTA_text_by_plan_type(self) -> None:
|
||||
sign_up_now = "Sign up now"
|
||||
buy_premium = "Buy Premium"
|
||||
current_plan = "Current plan"
|
||||
|
||||
# Root domain
|
||||
result = self.client_get("/plans/", subdomain="")
|
||||
self.assert_in_success_response([sign_up_now, buy_premium], result)
|
||||
self.assert_not_in_success_response([current_plan], result)
|
||||
|
||||
self.login(self.example_email("iago"))
|
||||
realm = get_realm("zulip")
|
||||
|
||||
realm.plan_type = Realm.LIMITED
|
||||
realm.save(update_fields=["plan_type"])
|
||||
result = self.client_get("/plans/", subdomain="zulip")
|
||||
self.assert_in_success_response([current_plan, buy_premium], result)
|
||||
self.assert_not_in_success_response([sign_up_now], result)
|
||||
|
||||
realm.plan_type = Realm.PREMIUM_FREE
|
||||
realm.save(update_fields=["plan_type"])
|
||||
result = self.client_get("/plans/", subdomain="zulip")
|
||||
self.assert_in_success_response([current_plan], result)
|
||||
self.assert_not_in_success_response([sign_up_now, buy_premium], result)
|
||||
|
||||
realm.plan_type = Realm.PREMIUM
|
||||
realm.save(update_fields=["plan_type"])
|
||||
result = self.client_get("/plans/", subdomain="zulip")
|
||||
self.assert_in_success_response([current_plan], result)
|
||||
self.assert_not_in_success_response([sign_up_now, buy_premium], result)
|
||||
|
|
Loading…
Reference in New Issue