diff --git a/corporate/urls.py b/corporate/urls.py index 2b3822afc7..772e9805a8 100644 --- a/corporate/urls.py +++ b/corporate/urls.py @@ -4,7 +4,7 @@ from django.conf.urls import include from django.urls import path from django.views.generic import RedirectView, TemplateView -from corporate.views.billing_page import billing_home, update_plan +from corporate.views.billing_page import billing_home, sponsorship_request, update_plan from corporate.views.event_status import event_status, event_status_page from corporate.views.portico import ( app_download_link_redirect, @@ -32,6 +32,7 @@ i18n_urlpatterns: Any = [ path("jobs/", TemplateView.as_view(template_name="corporate/jobs.html")), # Billing path("billing/", billing_home, name="billing_home"), + path("sponsorship/", sponsorship_request, name="sponsorship_request"), path("upgrade/", initial_upgrade, name="initial_upgrade"), path("support/", support_request), path("billing/event_status/", event_status_page, name="event_status_page"), diff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.py index 01f8215eb0..1c1c71f165 100644 --- a/corporate/views/billing_page.py +++ b/corporate/views/billing_page.py @@ -75,6 +75,16 @@ def add_sponsorship_info_to_context(context: Dict[str, Any], user_profile: UserP ) +@zulip_login_required +@has_request_variables +def sponsorship_request(request: HttpRequest) -> HttpResponse: + user = request.user + assert user.is_authenticated + context: Dict[str, Any] = {} + add_sponsorship_info_to_context(context, user) + return render(request, "corporate/sponsorship.html", context=context) + + @zulip_login_required @has_request_variables def billing_home( diff --git a/corporate/views/portico.py b/corporate/views/portico.py index dfff11d004..b1c03e9b57 100644 --- a/corporate/views/portico.py +++ b/corporate/views/portico.py @@ -52,7 +52,7 @@ def plans_view(request: HttpRequest) -> HttpResponse: realm = get_realm_from_request(request) free_trial_days = settings.FREE_TRIAL_DAYS sponsorship_pending = False - sponsorship_url = "/upgrade/#sponsorship" + sponsorship_url = "/sponsorship/" if is_subdomain_root_or_alias(request): # If we're on the root domain, we make this link first ask you which organization. sponsorship_url = f"/accounts/go/?{urlencode({'next': sponsorship_url})}" diff --git a/templates/corporate/plans.html b/templates/corporate/plans.html index 099be18d8e..a34a3153ec 100644 --- a/templates/corporate/plans.html +++ b/templates/corporate/plans.html @@ -50,8 +50,7 @@

Zulip sponsors free Zulip Cloud Standard for hundreds of worthy - organizations. Request sponsorship from your organization's - billing page. + organizations. Request sponsorship.


diff --git a/templates/corporate/sponsorship.html b/templates/corporate/sponsorship.html index 2568e44951..80373cc47e 100644 --- a/templates/corporate/sponsorship.html +++ b/templates/corporate/sponsorship.html @@ -1,3 +1,6 @@ +{% extends "zerver/portico_signup.html" %} + +{% block portico_content %}
@@ -49,3 +52,4 @@ Request received! The page will now reload.
+{% endblock %} diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts new file mode 100644 index 0000000000..79f3e48456 --- /dev/null +++ b/web/src/billing/sponsorship.ts @@ -0,0 +1,11 @@ +import $ from "jquery"; + +import * as helpers from "./helpers"; + +export function initialize(): void { + helpers.set_sponsorship_form(); +} + +$(() => { + initialize(); +}); diff --git a/web/styles/portico/billing.css b/web/styles/portico/billing.css index eb00d1eb99..6285fd5e0d 100644 --- a/web/styles/portico/billing.css +++ b/web/styles/portico/billing.css @@ -342,7 +342,6 @@ input[name="licenses"] { #license-manual-section, #licensechange-input-section, -#sponsorship-form, #invoice-form { & input { padding: 4px 6px; @@ -365,65 +364,6 @@ input[name="licenses"] { } } -#sponsorship-form { - & input { - box-sizing: border-box; - } - - & textarea { - box-sizing: border-box; - color: hsl(0deg 0% 33%); - background-color: hsl(0deg 0% 100%); - border-radius: 4px; - vertical-align: middle; - border: 1px solid hsl(0deg 0% 80%); - padding: 4px 6px; - margin-bottom: 10px; - line-height: 20px; - - box-shadow: inset 0 1px 1px hsl(0deg 0% 0% / 7.5%); - transition: - border linear 0.2s, - box-shadow linear 0.2s; - - &:focus { - border-color: hsl(206.5deg 80% 62% / 80%); - outline: 0; - - box-shadow: - inset 0 1px 1px hsl(0deg 0% 0% / 7.5%), - 0 0 8px hsl(206.5deg 80% 62% / 60%); - - &:invalid { - border-color: hsl(2deg 81% 55%); - box-shadow: 0 0 6px hsl(2deg 82% 85%); - color: hsl(1deg 45% 50%); - } - } - } - - & select { - height: 30px; - width: 100%; - padding: 0 6px; - font-size: 14px; - color: hsl(0deg 0% 33%); - border-radius: 4px; - border: 1px solid hsl(0deg 0% 80%); - margin-bottom: 10px; - cursor: pointer; - background-color: hsl(0deg 0% 100%); - } - - & input[name="website"] { - width: 100%; - } - - & textarea[name="description"] { - width: 100%; - } -} - #confirm-licenses-modal .dialog_submit_button:active { /* This is needed to avoid button background changing when clicking on it due to "button:active" CSS in diff --git a/web/templates/gear_menu_popover.hbs b/web/templates/gear_menu_popover.hbs index c1834eddfe..0a68cb85f9 100644 --- a/web/templates/gear_menu_popover.hbs +++ b/web/templates/gear_menu_popover.hbs @@ -36,7 +36,7 @@ {{else if (not is_business_org) }} {{/if}} {{/if}} diff --git a/web/templates/settings/upgrade_tip_widget.hbs b/web/templates/settings/upgrade_tip_widget.hbs index 1b3cb65666..f92aa955dc 100644 --- a/web/templates/settings/upgrade_tip_widget.hbs +++ b/web/templates/settings/upgrade_tip_widget.hbs @@ -9,7 +9,7 @@ {{#tr}} Available on Zulip Cloud Standard. Upgrade or request sponsorship to access. {{#*inline "z-link-upgrade"}}{{> @partial-block}}{{/inline}} - {{#*inline "z-link-sponsorship"}}{{> @partial-block}}{{/inline}} + {{#*inline "z-link-sponsorship"}}{{> @partial-block}}{{/inline}} {{/tr}} {{/if}} diff --git a/web/webpack.assets.json b/web/webpack.assets.json index 9480ce4d99..40537c4c8d 100644 --- a/web/webpack.assets.json +++ b/web/webpack.assets.json @@ -16,6 +16,14 @@ "./src/loading", "./styles/portico/billing.css" ], + "sponsorship": [ + "./src/billing/page_params", + "./src/bundles/portico", + "jquery-validation", + "./src/portico/signup", + "./src/billing/sponsorship", + "./styles/portico/billing.css" + ], "upgrade": [ "./src/billing/page_params", "./src/bundles/portico", diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py index c594bef07b..5f0d78945f 100644 --- a/zerver/tests/test_docs.py +++ b/zerver/tests/test_docs.py @@ -502,8 +502,8 @@ class PlansPageTest(ZulipTestCase): root_domain = "" result = self.client_get("/plans/", subdomain=root_domain) self.assert_in_success_response(["Self-host Zulip"], result) - self.assert_not_in_success_response(["/upgrade/#sponsorship"], result) - self.assert_in_success_response(["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result) + self.assert_not_in_success_response(["/sponsorship/"], result) + self.assert_in_success_response(["/accounts/go/?next=%2Fsponsorship%2F"], result) non_existent_domain = "moo" result = self.client_get("/plans/", subdomain=non_existent_domain) @@ -526,10 +526,8 @@ class PlansPageTest(ZulipTestCase): self.login(organization_member) result = self.client_get("/plans/", subdomain="zulip") self.assert_in_success_response(["Current plan"], result) - self.assert_in_success_response(["/upgrade/#sponsorship"], result) - self.assert_not_in_success_response( - ["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result - ) + self.assert_in_success_response(["/sponsorship/"], result) + self.assert_not_in_success_response(["/accounts/go/?next=%2Fsponsorship%2F"], result) # Test root domain, with login on different domain result = self.client_get("/plans/", subdomain="")