urls: Show sponsorship page on a new URL.

Fixes #27377

Replaced #sponsorship links with sponsorship/ links and in other
places liking gear menu.
This commit is contained in:
Aman Agrawal 2023-11-02 08:36:27 +00:00 committed by Tim Abbott
parent 3ba0fe4349
commit 00df9c6c18
11 changed files with 43 additions and 72 deletions

View File

@ -4,7 +4,7 @@ from django.conf.urls import include
from django.urls import path from django.urls import path
from django.views.generic import RedirectView, TemplateView 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.event_status import event_status, event_status_page
from corporate.views.portico import ( from corporate.views.portico import (
app_download_link_redirect, app_download_link_redirect,
@ -32,6 +32,7 @@ i18n_urlpatterns: Any = [
path("jobs/", TemplateView.as_view(template_name="corporate/jobs.html")), path("jobs/", TemplateView.as_view(template_name="corporate/jobs.html")),
# Billing # Billing
path("billing/", billing_home, name="billing_home"), path("billing/", billing_home, name="billing_home"),
path("sponsorship/", sponsorship_request, name="sponsorship_request"),
path("upgrade/", initial_upgrade, name="initial_upgrade"), path("upgrade/", initial_upgrade, name="initial_upgrade"),
path("support/", support_request), path("support/", support_request),
path("billing/event_status/", event_status_page, name="event_status_page"), path("billing/event_status/", event_status_page, name="event_status_page"),

View File

@ -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 @zulip_login_required
@has_request_variables @has_request_variables
def billing_home( def billing_home(

View File

@ -52,7 +52,7 @@ def plans_view(request: HttpRequest) -> HttpResponse:
realm = get_realm_from_request(request) realm = get_realm_from_request(request)
free_trial_days = settings.FREE_TRIAL_DAYS free_trial_days = settings.FREE_TRIAL_DAYS
sponsorship_pending = False sponsorship_pending = False
sponsorship_url = "/upgrade/#sponsorship" sponsorship_url = "/sponsorship/"
if is_subdomain_root_or_alias(request): if is_subdomain_root_or_alias(request):
# If we're on the root domain, we make this link first ask you which organization. # 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})}" sponsorship_url = f"/accounts/go/?{urlencode({'next': sponsorship_url})}"

View File

@ -50,8 +50,7 @@
<div class="plans_faq_questions"> <div class="plans_faq_questions">
<p> <p>
Zulip sponsors free Zulip Cloud Standard for hundreds of worthy Zulip sponsors free Zulip Cloud Standard for hundreds of worthy
organizations. Request sponsorship from your organization's organizations. <a href="{{ sponsorship_url }}">Request sponsorship</a>.
<a href="{{ sponsorship_url }}">billing page</a>.
</p> </p>
</div> </div>
<br /> <br />

View File

@ -1,3 +1,6 @@
{% extends "zerver/portico_signup.html" %}
{% block portico_content %}
<div class="tab-pane" id="sponsorship"> <div class="tab-pane" id="sponsorship">
<div id="sponsorship-error" class="alert alert-danger"></div> <div id="sponsorship-error" class="alert alert-danger"></div>
<div id="sponsorship-input-section"> <div id="sponsorship-input-section">
@ -49,3 +52,4 @@
Request received! The page will now reload. Request received! The page will now reload.
</div> </div>
</div> </div>
{% endblock %}

View File

@ -0,0 +1,11 @@
import $ from "jquery";
import * as helpers from "./helpers";
export function initialize(): void {
helpers.set_sponsorship_form();
}
$(() => {
initialize();
});

View File

@ -342,7 +342,6 @@ input[name="licenses"] {
#license-manual-section, #license-manual-section,
#licensechange-input-section, #licensechange-input-section,
#sponsorship-form,
#invoice-form { #invoice-form {
& input { & input {
padding: 4px 6px; 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 { #confirm-licenses-modal .dialog_submit_button:active {
/* This is needed to avoid button background changing /* This is needed to avoid button background changing
when clicking on it due to "button:active" CSS in when clicking on it due to "button:active" CSS in

View File

@ -36,7 +36,7 @@
</li> </li>
{{else if (not is_business_org) }} {{else if (not is_business_org) }}
<li class="org-upgrade navbar-dropdown-menu-inner-list-item"> <li class="org-upgrade navbar-dropdown-menu-inner-list-item">
<a href="/upgrade/" target="_blank" rel="noopener noreferrer" class="navigate-link-on-enter navbar-dropdown-menu-link">{{t 'Request sponsorship' }}</a> <a href="/sponsorship/" target="_blank" rel="noopener noreferrer" class="navigate-link-on-enter navbar-dropdown-menu-link">{{t 'Request sponsorship' }}</a>
</li> </li>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -9,7 +9,7 @@
{{#tr}} {{#tr}}
Available on Zulip Cloud Standard. <z-link-upgrade>Upgrade</z-link-upgrade> or <z-link-sponsorship>request sponsorship</z-link-sponsorship> to access. Available on Zulip Cloud Standard. <z-link-upgrade>Upgrade</z-link-upgrade> or <z-link-sponsorship>request sponsorship</z-link-sponsorship> to access.
{{#*inline "z-link-upgrade"}}<a href="/upgrade/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}} {{#*inline "z-link-upgrade"}}<a href="/upgrade/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
{{#*inline "z-link-sponsorship"}}<a href="/upgrade/#sponsorship" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}} {{#*inline "z-link-sponsorship"}}<a href="/sponsorship/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
{{/tr}} {{/tr}}
</div> </div>
{{/if}} {{/if}}

View File

@ -16,6 +16,14 @@
"./src/loading", "./src/loading",
"./styles/portico/billing.css" "./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": [ "upgrade": [
"./src/billing/page_params", "./src/billing/page_params",
"./src/bundles/portico", "./src/bundles/portico",

View File

@ -502,8 +502,8 @@ class PlansPageTest(ZulipTestCase):
root_domain = "" root_domain = ""
result = self.client_get("/plans/", subdomain=root_domain) result = self.client_get("/plans/", subdomain=root_domain)
self.assert_in_success_response(["Self-host Zulip"], result) self.assert_in_success_response(["Self-host Zulip"], result)
self.assert_not_in_success_response(["/upgrade/#sponsorship"], result) self.assert_not_in_success_response(["/sponsorship/"], result)
self.assert_in_success_response(["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result) self.assert_in_success_response(["/accounts/go/?next=%2Fsponsorship%2F"], result)
non_existent_domain = "moo" non_existent_domain = "moo"
result = self.client_get("/plans/", subdomain=non_existent_domain) result = self.client_get("/plans/", subdomain=non_existent_domain)
@ -526,10 +526,8 @@ class PlansPageTest(ZulipTestCase):
self.login(organization_member) self.login(organization_member)
result = self.client_get("/plans/", subdomain="zulip") result = self.client_get("/plans/", subdomain="zulip")
self.assert_in_success_response(["Current plan"], result) self.assert_in_success_response(["Current plan"], result)
self.assert_in_success_response(["/upgrade/#sponsorship"], result) self.assert_in_success_response(["/sponsorship/"], result)
self.assert_not_in_success_response( self.assert_not_in_success_response(["/accounts/go/?next=%2Fsponsorship%2F"], result)
["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result
)
# Test root domain, with login on different domain # Test root domain, with login on different domain
result = self.client_get("/plans/", subdomain="") result = self.client_get("/plans/", subdomain="")