Skip to content

Commit 2b8011f

Browse files
authored
Merge pull request #11400 from akramcodez/fix/native-newsletter-checkbox
fix: migrate registration newsletter to native HTML checkbox
2 parents 8193d72 + 42eee21 commit 2b8011f

File tree

4 files changed

+18
-49
lines changed

4 files changed

+18
-49
lines changed

openlibrary/i18n/messages.pot

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,20 +1479,6 @@ msgstr ""
14791479
msgid "Public and cannot be changed later."
14801480
msgstr ""
14811481

1482-
#: openlibrary/plugins/upstream/forms.py
1483-
msgid ""
1484-
"I want to receive news, announcements, and resources from the <a "
1485-
"href=\"https://archive.org/\">Internet Archive</a>, the non-profit that "
1486-
"runs Open Library."
1487-
msgstr ""
1488-
1489-
#: openlibrary/plugins/upstream/forms.py
1490-
msgid ""
1491-
"I want to apply* for <a href=\"https://help.archive.org/help/program-"
1492-
"overview/\" target=\"_blank\">special print disability access</a> through"
1493-
" a qualifying program."
1494-
msgstr ""
1495-
14961482
#: openlibrary/plugins/upstream/forms.py
14971483
msgid "Invalid password"
14981484
msgstr ""
@@ -2507,6 +2493,20 @@ msgstr ""
25072493
msgid "screenname"
25082494
msgstr ""
25092495

2496+
#: account/create.html
2497+
msgid ""
2498+
"I want to receive news, announcements, and resources from the <a "
2499+
"href=\"https://archive.org/\">Internet Archive</a>, the non-profit that "
2500+
"runs Open Library."
2501+
msgstr ""
2502+
2503+
#: account/create.html
2504+
msgid ""
2505+
"I want to apply* for <a href=\"https://help.archive.org/help/program-"
2506+
"overview/\" target=\"_blank\">special print disability access</a> through"
2507+
" a qualifying program."
2508+
msgstr ""
2509+
25102510
#: account/create.html
25112511
msgid "Select qualifying program"
25122512
msgstr ""

openlibrary/plugins/upstream/forms.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from openlibrary.accounts import InternetArchiveAccount
77
from openlibrary.i18n import lgettext as _
88
from openlibrary.utils.form import (
9-
Checkbox,
109
Email,
1110
Form,
1211
Hidden,
@@ -112,21 +111,6 @@ class RegisterForm(Form):
112111
maxlength="20",
113112
required="true",
114113
),
115-
Checkbox(
116-
'ia_newsletter',
117-
description=_(
118-
'I want to receive news, announcements, and resources from the '
119-
'<a href="https://archive.org/">Internet Archive</a>, the non-profit '
120-
'that runs Open Library.'
121-
),
122-
),
123-
Checkbox(
124-
"pd_request",
125-
description=_(
126-
'I want to apply* for <a href="https://help.archive.org/help/program-overview/" target="_blank">'
127-
'special print disability access</a> through a qualifying program.'
128-
),
129-
),
130114
)
131115

132116
def __init__(self):

openlibrary/templates/account/create.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ <h1 class="ol-signup-hero__title">$_("Sign Up")</h1>
7676
$:field(form.password)
7777

7878
<div class="ol-signup-form__checkbox">
79-
$:form.ia_newsletter.render() <label for="ia_newsletter">$:form.ia_newsletter.description</label>
79+
<input type="checkbox" id="ia_newsletter" name="ia_newsletter"/>
80+
<label for="ia_newsletter">$:_('I want to receive news, announcements, and resources from the <a href="https://archive.org/">Internet Archive</a>, the non-profit that runs Open Library.')</label>
8081
</div>
8182
<div id="rpd-checkbox" class="ol-signup-form__checkbox">
82-
$:form.pd_request.render() <label for="pd_request">$:form.pd_request.description</label>
83+
<input type="checkbox" id="pd_request" name="pd_request"/>
84+
<label for="pd_request">$:_('I want to apply* for <a href="https://help.archive.org/help/program-overview/" target="_blank">special print disability access</a> through a qualifying program.')</label>
8385
</div>
8486
<div id="pda-selector" class="ol-signup-form__select hidden">
8587
<div class="ol-signup-form__error" id="pd_programMessage"></div>

openlibrary/utils/form.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,6 @@ def get_type(self):
109109
return "email"
110110

111111

112-
class Checkbox(Input):
113-
"""Checkbox input."""
114-
115-
@property
116-
def checked(self):
117-
return self.value is not None
118-
119-
def get_type(self):
120-
return "checkbox"
121-
122-
def render(self):
123-
if self.value is not None:
124-
self.attrs['checked'] = ''
125-
126-
return Input.render(self)
127-
128-
129112
class Hidden(Input):
130113
"""Hidden input."""
131114

0 commit comments

Comments
 (0)