Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: version 1.4.0 pushed #406

Merged
merged 13 commits into from
Oct 18, 2024
Binary file modified locale/en/LC_MESSAGES/django.mo
Binary file not shown.
487 changes: 267 additions & 220 deletions locale/en/LC_MESSAGES/django.po

Large diffs are not rendered by default.

Binary file modified locale/es/LC_MESSAGES/django.mo
Binary file not shown.
2,455 changes: 972 additions & 1,483 deletions locale/es/LC_MESSAGES/django.po

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions sefaria/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class SefariaNewUserForm(EmailUserCreationForm):
# Add the select field
user_type = forms.ChoiceField(
choices=CHOICES,
widget=forms.Select(attrs={
'class': 'custom-select-large-margin'})
label="User Type"
)

captcha_lang = "iw" if get_language() == 'he' else "en"
Expand Down
2 changes: 1 addition & 1 deletion sefaria/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
}

}
DATA_UPLOAD_MAX_MEMORY_SIZE = 24000000
DATA_UPLOAD_MAX_MEMORY_SIZE = 240000000

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

Expand Down
10 changes: 7 additions & 3 deletions sefaria/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from urllib.parse import urlparse
from collections import defaultdict
from random import choice
from account.models import UserType

from django.utils.translation import ugettext as _
from django.conf import settings
Expand Down Expand Up @@ -80,12 +81,14 @@ def process_register_form(request, auth_method='session'):
from PIL import Image
form = SefariaNewUserForm(request.POST) if auth_method == 'session' else SefariaNewUserFormAPI(request.POST)
token_dict = None

if form.is_valid():
with transaction.atomic():
form.save()
user = authenticate(email=form.cleaned_data['email'],
password=form.cleaned_data['password1'])
profile = UserProfile(id=user.id, user_registration=True)
user_type = form.cleaned_data['user_type']
# add analytics
add_signup_info(email=profile.email,first_name=profile.first_name,last_name=profile.last_name)
profile.assign_slug()
Expand Down Expand Up @@ -118,9 +121,12 @@ def process_register_form(request, auth_method='session'):
auth_login(request, user)
elif auth_method == 'jwt':
token_dict = TokenObtainPairSerializer().validate({"username": form.cleaned_data['email'], "password": form.cleaned_data['password1']})
else:
print(">>>>>>>>>>>>>>>>>>>>>>>>>> not value>>>>>>>>>>>>>>>>>>>>>>>>>", form.errors)
return {
k: v[0] if len(v) > 0 else str(v) for k, v in list(form.errors.items())
}, token_dict, form



@api_view(["POST"])
Expand All @@ -140,6 +146,7 @@ def register(request):

if request.method == 'POST':
errors, _, form = process_register_form(request)
print("form >>>>>>>>>>>>>>>>>", form)
if len(errors) == 0:
if "noredirect" in request.POST:
return HttpResponse("ok")
Expand All @@ -154,9 +161,6 @@ def register(request):
next += "?welcome=to-sefaria"
return HttpResponseRedirect(next)
else:
if request.GET.get('educator', ''):
form = SefariaNewUserForm(initial={'subscribe_educator': True})
else:
form = SefariaNewUserForm()

return render_template(request, "registration/register.html", None, {'form': form, 'next': next})
Expand Down
27 changes: 11 additions & 16 deletions static/css/s2.css
Original file line number Diff line number Diff line change
Expand Up @@ -11034,8 +11034,8 @@ body #keyboardInputMaster tbody tr td table tbody tr td.pressed {
}

.pwa-install-button {
padding: 2px 10px;
font-size: 16px;
padding: 5px 10px;
font-size: 12px;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
background-color: #b84045;
color: white;
Expand All @@ -11050,21 +11050,7 @@ body #keyboardInputMaster tbody tr td table tbody tr td.pressed {
display: none; /* Initially hidden */
}

/* Slide-in animation */
.pwa-install-button.show {
display: inline-block;
animation: slide-in 0.10s forwards; /* Trigger the slide-in animation */
}

/* Keyframes for sliding in the button from the right */
@keyframes slide-in {
from {
transform: translateX(100px); /* Start off-screen */
}
to {
transform: translateX(-50%); /* Slide in to the centered position */
}
}

.pwa-install-button:hover {
background-color: #a7353b;
Expand All @@ -11075,6 +11061,14 @@ body #keyboardInputMaster tbody tr td table tbody tr td.pressed {
background-color: #8b2c30;
transform: translateX(-50%) scale(0.98); /* Keep centering on active state */
}

#pwa_install_svg {
position: fixed;
}

#pwa_download_label {
--is-hebrew: ;
}


#footer .section {
Expand Down Expand Up @@ -12002,6 +11996,7 @@ span.purim-emoji img {
}

.addInterfaceInput select.suggestionBox {
overflow: scroll;
font-size: 22px;
}

Expand Down
93 changes: 63 additions & 30 deletions static/css/static.css
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,7 @@
width: 100%;
box-sizing: border-box;
}
.registrationContent select option {
padding: 12px 20px;
height: initial;
margin: 1% 0px;
cursor: pointer;
width: 100%;
box-sizing: border-box;
}

.registrationContent input::placeholder { /* eventual spec? */
font-family: "Heebo", "Roboto", "Helvetica Neue", "Helvetica", sans-serif;
}
Expand Down Expand Up @@ -590,20 +583,14 @@
padding-top: 10px;
padding-bottom: 10px;
}
.registrationContent #register-form p:nth-of-type(6){
padding-top: 10px;
}
/* Style the select element */
.registrationContent #register-form .custom-select-large-margin option {
padding: 12px;
font-size: 16px;
height: 2.5em; /* Ensures sufficient space */
}
/* Style the individual options within the select */
.registrationContent #register-form .custom-select-large-margin option {
padding: 15px 20px; /* Increase padding inside each option to simulate margin */
color:rgba(0, 0, 0, 0.572);

.registrationContent #register-form .custom-select-large-margin {
width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

input#id_email::placeholder {
text-align: left;
}
Expand All @@ -617,20 +604,66 @@ input#id_email{
.registrationContent a {
display: block;
}
.registrationContent a.registration-links, .registrationContent p.registration-links{
margin-top: 20px;


/* Dropdown Styles */
.registrationContent .dropdown {
position: relative;
width: 100%;
}

.registrationContent .dropdown #uset_type {
padding: 12px 20px;
height: initial;
margin: 1% 0px;
cursor: pointer;
width: 100%;
box-sizing: border-box;
}

/* Dropdown Content */
.registrationContent .dropdown .dropdown-content {
display: none;
position: absolute;
background-color: #ffffff;
border: 1px solid #ccc;
width: 100%;
z-index: 1;
border-radius: 4px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Dropdown Item Styles */
.registrationContent .dropdown .dropdown-content .dropdown-item {
padding: 10px;
cursor: pointer;
transition: background-color 0.2s;
}

/* Hover Effect for Dropdown Items */
.registrationContent .dropdown .dropdown-content .dropdown-item:hover {
background-color: #f1f1f1;
}

/* Show Class for Dropdown */
.registrationContent .dropdown .dropdown-content.show {
display: block;
text-align: center;
color: #999;
font-size: 14px;
font-style: normal;
text-decoration: none;
}
.registrationContent a.registration-links:hover{
color: #666;

.registrationContent .dropdown .dropdown-arrow {
position: absolute;
right: 10px; /* Adjust as needed */
top: 50%; /* Center vertically */
transform: translateY(-50%);
pointer-events: none; /* Prevent click events on the icon */
color: #333; /* Icon color */
}






p.registration-links a{
color: #999;
text-decoration: none;
Expand Down
22 changes: 16 additions & 6 deletions static/js/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,23 @@ class Footer extends Component {
if (!Sefaria._siteSettings.TORAH_SPECIFIC) { return null; }

return (
<div id='version_number'>
<InterfaceText>Version: 1.3.0</InterfaceText>
<div id="version_number" className="flex flex-col items-center">
<InterfaceText>website.pecha.version</InterfaceText>
{/* Install PWA Button */}
<button id="install-pwa-button" className="pwa-install-button" style={{ marginLeft: "10px", display: 'none' }}>
Install pecha App
</button>
</div>
<button id="install-pwa-button" className="pwa-install-button flex items-center">
<InterfaceText className={"pwa_download_label"}>pwa.download_button.label</InterfaceText>
<div className="flex items-center" style={{ marginLeft: "5px" }}>
<svg
fill="#FFFFFF"
width="15px"
height="15px"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path d="M19.059 10.898l-3.171-7.927A1.543 1.543 0 0 0 14.454 2H12.02l.38 4.065h2.7L10 10.293 4.9 6.065h2.7L7.98 2H5.546c-.632 0-1.2.384-1.434.971L.941 10.898a4.25 4.25 0 0 0-.246 2.272l.59 3.539A1.544 1.544 0 0 0 2.808 18h14.383c.755 0 1.399-.546 1.523-1.291l.59-3.539a4.22 4.22 0 0 0-.245-2.272zm-2.1 4.347a.902.902 0 0 1-.891.755H3.932a.902.902 0 0 1-.891-.755l-.365-2.193A.902.902 0 0 1 3.567 12h12.867c.558 0 .983.501.891 1.052l-.366 2.193z"/>
</svg>
</div>
</button>
</div>
);
}
}
Expand Down
2 changes: 2 additions & 0 deletions static/js/sefaria/localizationLanguage/chinese.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pwa.download_button.label":"安装 PECHA 应用",
"text.reader_option_menu.layout": "布局",
"common.loading": "加载中...",
"website.pecha.version": "版本: 1.4.0",
"common.version": "版本",
"common.log_in": "登录",
"common.sign_up": "注册",
Expand Down
2 changes: 2 additions & 0 deletions static/js/sefaria/localizationLanguage/english.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pwa.download_button.label":"INSTALL PECHA APP",
"text.reader_option_menu.layout": "Layout",
"common.loading": "Loading...",
"website.pecha.version": "Version: 1.4.0",
"common.version": "Version",
"common.log_in": "Log in",
"common.sign_up": "Sign up",
Expand Down
2 changes: 2 additions & 0 deletions static/js/sefaria/localizationLanguage/tibetan.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pwa.download_button.label":"དཔེ་ཆ་མརྙན་ཆས་ཕབ་ལེན་བྱོས།",
"text.reader_option_menu.layout": "ཁྱད་ཆོས།",
"common.loading": "ལེན་བཞིན་པ་་་",
"website.pecha.version": "ཐོན་རིམ།: ༡་༤་༠",
"common.version": "འགྱུར་མའམ་དཔེ་རྒྱུན།",
"common.log_in": "ནང་འཛུལ།",
"common.sign_up": "ཐོ་འགོད་གྱིས།",
Expand Down
30 changes: 30 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<meta name="author" content="Pecha.org">
<meta name="robots" content="index, follow">
<meta name="revisit-after" content="7 days">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" crossorigin="anonymous">


{% if noindex or DEBUG %}
<meta name="robots" content="index, follow">
Expand Down Expand Up @@ -370,7 +372,35 @@
// Add click event listener to the container
document.getElementById('crossImage').addEventListener('click', loadFeedbucket);
</script>
<script>
const userTypeInput = document.getElementById('user_type');
const userTypeDisplay = document.getElementById('user_type_display');
const dropdownContent = document.getElementById('dropdownContent');

// Toggle dropdown visibility
userTypeDisplay.addEventListener('click', function() {

dropdownContent.classList.toggle('show');
});

// Set value when an option is selected
document.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function() {
userTypeDisplay.value = this.textContent;
userTypeInput.value = `${item.getAttribute('data-value')}`;
console.log("value : ", userTypeInput.value)
dropdownContent.classList.remove('show');
});
});


// Close dropdown if clicked outside
window.addEventListener('click', function(event) {
if (!event.target.matches('#user_type_display')) {
dropdownContent.classList.remove('show');
}
});
</script>

<script type="text/javascript">window.$crisp=[];window.CRISP_WEBSITE_ID="b5a8d317-af7b-4b83-8801-84e6658f1f6e";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.chat/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();</script>

Expand Down
17 changes: 17 additions & 0 deletions templates/registration/custom_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<div class="dropdown">
<input type="text" id="dropdownInput" placeholder={% trans "Select an option" %} readonly required>
<span id="dropdownArrow" class="dropdown-arrow">
<i class="fas fa-chevron-down"></i> <!-- Down arrow icon initially -->
</span>
<div class="dropdown-content" id="dropdownContent">
<div class="dropdown-item" data-value="Monastic">{% trans "Monastic" %}</div>
<div class="dropdown-item" data-value="Teacher">{% trans "Teacher" %}</div>
<div class="dropdown-item" data-value="Student">{% trans "Student" %}</div>
<div class="dropdown-item" data-value="Educated* /Dr / Prof">{% trans "Educated* /Dr / Prof" %}</div>
<div class="dropdown-item" data-value="regular user">{% trans "regular user" %}</div>
</div>
</div>
{% endblock %}
Loading
Loading