Commit 180056f8 authored by Oliver Falk's avatar Oliver Falk
Browse files

New design and cropping fixes/JCrop update

parent 516b2e8a
......@@ -19,7 +19,7 @@ Authors and contributors
Lead developer/Owner: Oliver Falk (aka ofalk or falko) - https://git.linux-kernel.at/oliver
Operations: Michal Novotny (aka clime)
QA: Tristan Le Guern (aka tleguern)
Frontend developer: Niklas Poslovski (aka nipos)
Frontend developer: Lukas Schönsgibl (aka hybridpicker), Niklas Poslovski (aka nipos)
Organisation/Meeting moderation: Lars Kruse (aka sumpfralle)
Initial developer: François Marier - https://fmarier.org/
......@@ -52,7 +52,7 @@ OPENID_CREATE_USERS = True
OPENID_UPDATE_DETAILS_FROM_SREG = True
SITE_NAME = os.environ.get('SITE_NAME', 'libravatar')
IVATAR_VERSION = '1.1'
IVATAR_VERSION = '1.2'
SECURE_BASE_URL = os.environ.get('SECURE_BASE_URL', 'https://avatars.linux-kernel.at/avatar/')
BASE_URL = os.environ.get('BASE_URL', 'http://avatars.linux-kernel.at/avatar/')
......
......@@ -32,7 +32,7 @@
{% endfor %}
</div>
<p>
<button type="submit" class="btn btn-default">{% trans 'Import' %}</button>
<button type="submit" class="button">{% trans 'Import' %}</button>
</p>
</form>
{% endif %}
......
......@@ -25,7 +25,7 @@
<label for="id_email">{% trans 'Email' %}:</label>
<input type="text" name="email" autofocus required class="form-control" id="id_email">
</div>
<button type="submit" class="btn btn-default">{% trans 'Add' %}</button>
<button type="submit" class="button">{% trans 'Add' %}</button>
</form>
</div>
......
......@@ -20,7 +20,7 @@
<label for="id_openid">{% trans 'OpenID' %}:</label>
<input type="url" name="openid" value="https://" maxlength="255" minlength="11" required id="id_openid" autofocus class="form-control">
</div>
<button type="submit" class="btn btn-default">{% trans 'Add' %}</button>
<button type="submit" class="button">{% trans 'Add' %}</button>
</form>
</div>
......
......@@ -22,7 +22,7 @@ outline: inherit;
{% url 'upload_photo' as upload_url %}
<h4>{% blocktrans %}You need to <a href="{{ upload_url }}">upload some photos</a> first!{% endblocktrans %}</h4>
<p><a href="{% url 'profile' %}" class="btn btn-default">{% trans 'Back to your profile' %}</a></p>
<p><a href="{% url 'profile' %}" class="button">{% trans 'Back to your profile' %}</a></p>
{% else %}
......@@ -61,8 +61,8 @@ outline: inherit;
</form>
</div>
<div style="height:8px"></div>
<a href="{% url 'upload_photo' %}" class="btn btn-default">{% blocktrans %}Upload a new one{% endblocktrans %}</a>&nbsp;&nbsp;
<a href="{% url 'import_photo' email.pk %}" class="btn btn-default">{% blocktrans %}Import from other services{% endblocktrans %}</a>
<a href="{% url 'upload_photo' %}" class="button">{% blocktrans %}Upload a new one{% endblocktrans %}</a>&nbsp;&nbsp;
<a href="{% url 'import_photo' email.pk %}" class="button">{% blocktrans %}Import from other services{% endblocktrans %}</a>
{% endif %}
<div style="height:40px"></div>
{% endblock content %}
......@@ -22,7 +22,7 @@ outline: inherit;
{% url 'upload_photo' as upload_url %}
<h3>{% blocktrans %}You need to <a href="{{ upload_url }}">upload some photos</a> first!{% endblocktrans %}</h3>
<p><a href="{% url 'profile' %}" class="btn btn-default">{% trans 'Back to your profile' %}</a></p>
<p><a href="{% url 'profile' %}" class="button">{% trans 'Back to your profile' %}</a></p>
{% else %}
......@@ -61,7 +61,7 @@ outline: inherit;
</form>
</div>
<div style="height:8px"></div>
<a href="{% url 'upload_photo' %}" class="btn btn-default">{% blocktrans %}upload a new one{% endblocktrans %}</a>
<a href="{% url 'upload_photo' %}" class="button">{% blocktrans %}upload a new one{% endblocktrans %}</a>
{% endif %}
<div style="height:40px"></div>
......
......@@ -48,7 +48,7 @@ input[type=checkbox].image:checked + label:before {letter-spacing: 3px}
</div>
{% endif %}
<p>
<button type="submit" class="btn btn-default">{% trans 'Upload' %}</button>
<button type="submit" class="button">{% trans 'Upload' %}</button>
</p>
</form>
<div style="height:40px"></div>
......
......@@ -24,7 +24,9 @@
<input type='hidden' id='w' name='w' value='0'/>
<input type='hidden' id='h' name='h' value='0'/>
<div class="form-group">
<button type="submit" class="btn btn-default" onsubmit="return checkCoords();">{% trans 'Crop' %}</button>
<button type="submit" class="button" onsubmit="return checkCoords();">{% trans 'Crop' %}</button>
&nbsp;
<a href="{% url 'profile' %}" class="button" title="{% trans 'May lead to wrong aspect ratio!' %}">{% trans 'Skip cropping' %}</a>
</div>
</form>
......
......@@ -27,7 +27,7 @@
<button type="submit" class="btn btn-danger">{% trans 'Yes, delete all of my stuff' %}</button>
&nbsp;
<button type="cancel" class="btn btn-default" href="{% url 'profile' %}">{% trans 'Cancel' %}</button>
<button type="cancel" class="button" href="{% url 'profile' %}">{% trans 'Cancel' %}</button>
</form>
......
......@@ -25,7 +25,7 @@ input[type=checkbox]:checked + label:before {letter-spacing: 3px}
<input type="text" name="check_email_addr" class="form-control" value="{{ email_addr }}">
</div>
<div class="form-group">
<button type="submit" class="btn btn-default">{% trans 'Check' %}</button>
<button type="submit" class="button">{% trans 'Check' %}</button>
</div>
</form>
<script>
......
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans 'Login to yourivatar account' %}{% endblock title %}
......@@ -29,13 +29,13 @@
<label for="id_password">{% trans 'Password' %}:</label>
<input type="password" name="password" class="form-control" required id="id_password">
</div>
<button type="submit" class="btn btn-default">{% trans 'Login' %}</button>
<button type="submit" class="button">{% trans 'Login' %}</button>
&nbsp;
<a href="{% url 'openid-login' %}" class="btn btn-default">{% trans 'Login with OpenID' %}</a>
<a href="{% url 'openid-login' %}" class="button">{% trans 'Login with OpenID' %}</a>
&nbsp;
<a href="{% url 'new_account' %}" class="btn btn-default">{% trans 'Create new user' %}</a>
<a href="{% url 'new_account' %}" class="button">{% trans 'Create new user' %}</a>
&nbsp;
<a href="{% url 'password_reset' %}" class="btn btn-default">{% trans 'Password reset' %}</a>
<a href="{% url 'password_reset' %}" class="button">{% trans 'Password reset' %}</a>
</form>
</div>
<div style="height:40px"></div>
......
......@@ -31,7 +31,7 @@
<label for="id_password2">{% trans 'Password confirmation' %}:</label>
<input type="password" name="password2" class="form-control" required id="id_password2">
</div>
<button type="submit" class="btn btn-default">{% trans 'Create account' %}</button> or <a href="/accounts/login/" class="btn btn-default">{% trans 'Login' %}</a>
<button type="submit" class="button">{% trans 'Create account' %}</button> or <a href="/accounts/login/" class="button">{% trans 'Login' %}</a>
</form>
</div>
<div style="height:40px"></div>
......
......@@ -32,7 +32,7 @@
<label for="id_new_password2">{% trans 'New password confirmation' %}:</label>
<input type="password" name="new_password2" class="form-control" required id="id_new_password2">
</div>
<button type="submit" class="btn btn-default">{% trans 'Change my password' %}</button>
<button type="submit" class="button">{% trans 'Change my password' %}</button>
</form>
</div>
{% else %}
......
......@@ -17,8 +17,8 @@
<input type="text" name="email" autofocus required class="form-control" id="id_email">
</div>
<button type="submit" class="btn btn-default">{% trans 'Reset my password' %}</button>&nbsp;
<button type="cancel" class="btn btn-default" href="{% url 'profile' %}">{% trans 'Cancel' %}</button>
<button type="submit" class="button">{% trans 'Reset my password' %}</button>&nbsp;
<button type="cancel" class="button" href="{% url 'profile' %}">{% trans 'Cancel' %}</button>
</form>
</div>
......
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
......@@ -7,26 +7,6 @@
{% block content %}
<h1>{% trans 'Account settings' %}</h1>
<h2>{% trans 'Theme' %}</h2>
<p>
<form method="post" action="{% url 'user_preference' %}">{% csrf_token %}
<div class="form-group">
{% for theme in THEMES %}
<div class="radio">
<input type="radio" name="theme" value="{{ theme.0 }}"
id="theme-{{ theme.0 }}"
{% if user.userpreference.theme == theme.0 %}checked{% endif %}
{% if THEMES|first == theme %}{% if not user.userpreference.theme %}checked{% endif %}{% endif %}
>
<label for="theme-{{ theme.0 }}">{{ theme.1 }}</label>
</div>
{% endfor %}
<br/>
<button type="submit" class="btn btn-default">{% trans 'Save' %}</button>
</div>
</form>
</p>
<!-- TODO: Language stuff not yet fully implemented; Esp. translations are only half-way there
<h2>{% trans 'Language' %}</h2>
......@@ -43,15 +23,15 @@
{% endfor %}
</div>
<br/>
<button type="submit" class="btn btn-default">{% trans 'Save' %}</button>
<button type="submit" class="button">{% trans 'Save' %}</button>
</form>
-->
<div style="height:40px"></div>
<!-- <p><a href="{% url 'export' %}" class="btn btn-default">{% trans 'Export your data' %}</a></p> -->
<!-- <p><a href="{% url 'export' %}" class="button">{% trans 'Export your data' %}</a></p> -->
<p><a href="{% url 'delete' %}" class="btn btn-default">{% trans 'Permanently delete your account' %}</a></p>
<div style="height:40px"></div>
<p><a href="{% url 'delete' %}" class="button">{% trans 'Permanently delete your account' %}</a></p>
<div style="height:2rem"></div>
{% endblock content %}
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load bootstrap4 %}
......@@ -8,7 +8,7 @@
{% block content %}
<h1>
{% trans 'Your Profile' %} -
{% trans 'Your Profile' %} -
{% if user.first_name and user.last_name %}
{{ user.first_name }} {{ user.last_name }}
{% else %}
......@@ -39,6 +39,33 @@ font: inherit;
cursor: pointer;
outline: inherit;
}
.button {
margin-bottom: 1.5rem;
margin-right: 1rem;
}
.container{
display: grid;
}
.btn-group{
display: inline-flex;
}
.input-group-addon{
width: auto;
height: 3rem;
margin-top: 0.2rem;
}
@media only screen and (max-width: 470px) {
.button {
margin-bottom: 1.5rem;
margin-right: 1rem;
}
.unconfirmed-mail-form{
margin-bottom: 2rem;
}
.btn-group{
display: contents;
}
}
</style>
{% if user.confirmedemail_set.count or user.confirmedopenid_set.count %}
......@@ -47,7 +74,7 @@ outline: inherit;
{% for email in user.confirmedemail_set.all %}
<form action="{% url 'remove_confirmed_email' email.id %}" method="post">
{% csrf_token %}
<div class="panel panel-tortin" style="width:172px;margin-left:20px;float:left">
<div class="panel" style="width:172px;margin-left:20px;float:left">
<div class="panel-heading" style="padding-right:0">
<h3 class="panel-title" title="{{ email.email }}" style="display:inline-flex"><a href="{% url 'assign_photo_email' email.id %}"><i class="fa fa-edit"></i></a>&nbsp;
<button type="submit" class="nobutton" onclick="return confirm('{% trans 'Are you sure that you want to delete this email address?' %}')"><i class="fa fa-trash"></i></button>&nbsp;
......@@ -63,7 +90,7 @@ outline: inherit;
{% endfor %}
{% for openid in user.confirmedopenid_set.all %}
<form action="{% url 'remove_confirmed_openid' openid.id %}" method="post">{% csrf_token %}
<div class="panel panel-tortin" style="width:172px;margin-left:20px;float:left">
<div class="panel" style="width:172px;margin-left:20px;float:left">
<div class="panel-heading" style="padding-right:0">
<h3 class="panel-title" title="{{ openid.openid }}" style="display:inline-flex"><a href="{% url 'assign_photo_openid' openid.pk %}"><i class="fa fa-edit"></i></a>&nbsp;
<button type="submit" class="nobutton" onclick="return confirm('{% trans 'Are you sure that you want to delete this OpenID?' %}')"><i class="fa fa-trash"></i></button>&nbsp;
......@@ -83,12 +110,12 @@ outline: inherit;
{% if user.unconfirmedemail_set.count or user.unconfirmedopenid_set.count %}
<h3>{% trans 'You have the following unconfirmed email addresses and OpenIDs:' %}</h3>
{% for email in user.unconfirmedemail_set.all %}
<form action="{% url 'remove_unconfirmed_email' email.id %}" method="post">
<form class="unconfirmed-mail-form" action="{% url 'remove_unconfirmed_email' email.id %}" method="post">
{% csrf_token %}
<div class="btn-group form-group" role="group">
<button type="submit" class="btn btn-default" onclick="return confirm('{% trans 'Are you sure that you want to delete this email address?' %}')"><i class="fa fa-trash"></i></button>
<a href="{% url 'resend_confirmation_mail' email.pk %}" class="btn btn-default"><i class="fa fa-envelope"></i></a>
<span class="input-group-addon">{{ email.email }}</span>
<button type="submit" class="button" onclick="return confirm('{% trans 'Are you sure that you want to delete this email address?' %}')"><i class="fa fa-trash"></i></button>
<a href="{% url 'resend_confirmation_mail' email.pk %}" class="button"><i class="fa fa-envelope"></i></a>
<span class="input-group-addon" style="width: auto;">{{ email.email }}</span>
</div>
</form>
{# TODO: (expires in xx hours) #}
......@@ -97,7 +124,7 @@ outline: inherit;
<form action="{% url 'remove_unconfirmed_openid' openid.id %}" method="post">
{% csrf_token %}
<div class="btn-group form-group" role="group">
<button type="submit" class="btn btn-default" onclick="return confirm('{% trans 'Are you sure that you want to delete this OpenID?' %}')"><i class="fa fa-trash"></i></button>
<button type="submit" class="button" onclick="return confirm('{% trans 'Are you sure that you want to delete this OpenID?' %}')"><i class="fa fa-trash"></i></button>
<span class="input-group-addon">{{ openid.openid }}</span>
</div>
</form>
......@@ -106,8 +133,8 @@ outline: inherit;
{% endif %}
<p>
{% if not max_emails %}<a href="{% url 'add_email' %}" class="btn btn-default">{% trans 'Add a new email address' %}</a>&nbsp;{% endif %}
<a href="{% url 'add_openid' %}" class="btn btn-default">{% trans 'Add a new OpenID' %}</a></p>
{% if not max_emails %}<a href="{% url 'add_email' %}" class="button" >{% trans 'Add a new email address' %}</a>&nbsp;{% endif %}
<a href="{% url 'add_openid' %}" class="button">{% trans 'Add a new OpenID' %}</a></p>
</p>
{% if user.photo_set.count %}
<h3>{% trans 'Here are the photos you have uploaded/imported:' %}</h3>
......@@ -129,8 +156,8 @@ outline: inherit;
{% if not max_photos %}
<p>
<a href="{% url 'upload_photo' %}" class="btn btn-default">{% trans 'Upload a new photo' %}</a>&nbsp;
<a href="{% url 'import_photo' %}" class="btn btn-default">{% trans 'Import photo from other services' %}</a>
<a href="{% url 'upload_photo' %}" class="button">{% trans 'Upload a new photo' %}</a>&nbsp;
<a href="{% url 'import_photo' %}" class="button">{% trans 'Import photo from other services' %}</a>
</p>
{% endif %}
<div style="height:40px"></div>
......
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
......@@ -11,8 +11,9 @@
{% csrf_token %}
<div class="form-group">
<label for="id_export_file">{% trans 'Export file' %}</label>
<span class="btn btn-default uploadbtn" style="display:flex;width:120px;padding:0;height:36px;position:relative;align-items:center">
<input type="file" name="export_file" required id="id_export_file" style="opacity:0;width:100%;height:100%;float:left">
<span class="button" style="display:flex;width:120px;padding:0;height:36px;position:relative;align-items:center">
<input type="file" name="export_file" required id="id_export_file"/>
<label for="id_export_file">{% trans 'Select File' %}</label>
</span>
</div>
<div class="form-group">
......@@ -27,7 +28,7 @@
<label for="id_can_distribute">{% trans 'can be freely copied' %}</label>
</div>
</div>
<button type="submit" class="btn btn-default">{% trans 'Upload' %}</button>
<button type="submit" class="button">{% trans 'Upload' %}</button>
</form>
<div style="height:40px"></div>
{% endblock content %}
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
......@@ -19,8 +19,9 @@
{% endif %}
<div class="form-group">
<label for="id_photo">{% trans 'Photo' %}:</label>
<span class="btn btn-default uploadbtn" style="display:flex;width:120px;padding:0;height:36px;position:relative;align-items:center">
<span class="button uploadbtn" style="display:flex;width:14rem;padding:0;height:36px;position:relative;align-items:center">
<input type="file" name="photo" required id="id_photo" accept="image/*" style="opacity:0;width:100%;height:100%;float:left">
<label for="id_photo">{% trans 'Select Photo' %}</label>
</span>
</div>
{% blocktrans with max_file_size|filesizeformat as max_size %}Maximum file size of {{ max_size }}.{% endblocktrans %}</p>
......@@ -37,7 +38,7 @@
<label for="id_can_distribute"><b>{% trans 'required' %}</b>; {% trans 'can be freely copied' %}</label>
</div>
</div>
<button type="submit" class="btn btn-default">{% trans 'Upload' %}</button>
<button type="submit" class="button">{% trans 'Upload' %}</button>
</form>
<div style="height:40px"></div>
{% endblock content %}
......@@ -266,17 +266,6 @@ class AssignPhotoOpenIDView(SuccessMessageMixin, TemplateView):
Handle post - assign photo to openid
'''
photo = None
if 'photo_id' not in request.POST:
messages.error(request,
_('Invalid request [photo_id] missing'))
return HttpResponseRedirect(reverse_lazy('profile'))
try:
photo = self.model.objects.get( # pylint: disable=no-member
id=request.POST['photo_id'], user=request.user)
except self.model.DoesNotExist: # pylint: disable=no-member
messages.error(request, _('Photo does not exist'))
return HttpResponseRedirect(reverse_lazy('profile'))
try:
openid = ConfirmedOpenId.objects.get( # pylint: disable=no-member
......@@ -285,7 +274,21 @@ class AssignPhotoOpenIDView(SuccessMessageMixin, TemplateView):
messages.error(request, _('Invalid request'))
return HttpResponseRedirect(reverse_lazy('profile'))
openid.photo = photo
if 'photoNone' in request.POST:
openid.photo = None
else:
if 'photo_id' not in request.POST:
messages.error(request,
_('Invalid request [photo_id] missing'))
return HttpResponseRedirect(reverse_lazy('profile'))
try:
photo = self.model.objects.get( # pylint: disable=no-member
id=request.POST['photo_id'], user=request.user)
except self.model.DoesNotExist: # pylint: disable=no-member
messages.error(request, _('Photo does not exist'))
return HttpResponseRedirect(reverse_lazy('profile'))
openid.photo = photo
openid.save()
messages.success(request, _('Successfully changed photo'))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment