Revamping profile pages

This commit is contained in:
Víðir Valberg Guðmundsson 2016-02-20 23:39:02 +01:00
parent 9f2ce9d7c5
commit fd64742b17
18 changed files with 180 additions and 91 deletions

View file

@ -21,12 +21,12 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'django.contrib.sites',
'profiles',
'camps',
'allauth',
'allauth.account',
'bootstrap3',
'profiles',
'camps',
]
STATIC_URL = '/static/'

View file

@ -1,32 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% load account %}
{% block content %}
<div class="cover center">
<h1>{% trans "Confirm E-mail Address" %}</h1>
{% if confirmation %}
{% user_display confirmation.email_address.user as user_display %}
<p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<button type="submit" class="btn btn-lg btn-primary">
{% trans 'Confirm' %}
</button>
</form>
{% else %}
{% url 'account_email' as email_url %}
<p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p>
{% endif %}
</div>
{% endblock %}

View file

@ -1,18 +0,0 @@
{% extends 'base.html' %}
{% block content %}
<div class="cover center">
<p class="lead">
Sure you want to logout?
</p>
<form method="post">
{% csrf_token %}
<button type="submit"
class="btn btn-danger btn-lg">
Logout
</button>
</form>
</div>
{% endblock %}

View file

@ -16,36 +16,16 @@ urlpatterns = [
TemplateView.as_view(template_name='frontpage.html'),
name='frontpage'
),
#url(
#r'^login/$',
#LoginView.as_view(),
#name='account_login',
#),
url(
r'^login/$',
LoginView.as_view(),
name='account_login',
),
url(
r'^logout/$',
LogoutView.as_view(),
name='account_logout',
),
#url(
#r'^confirm/(?P<key>\S+)$',
#ConfirmEmailView.as_view(),
#name='account_confirm_email',
#),
#url(
#r'^signup/done/$',
#EmailVerificationSentView.as_view(),
#name='account_email_verification_sent',
#),
#url(
#r'^signup/$',
#SignupView.as_view(),
#name='account_signup',
#),
#url(
#r'^reset-password/$',
#PasswordResetView.as_view(),
#name='account_reset_password',
#),
url(
r'^profile/',
include('profiles.urls', namespace='profiles')

View file

@ -0,0 +1,85 @@
{% extends 'profiles/profile_base.html' %}
{% load i18n %}
{% load bootstrap3 %}
{% block head_title %}{% trans "Account" %}{% endblock %}
{% block profile_content %}
<div class="row">
<div class="col-md-12">
<h1>{% trans "E-mail Addresses" %}</h1>
{% if user.emailaddress_set.all %}
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<fieldset class="blockLabels">
{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
<input
id="email_radio_{{forloop.counter}}"
type="radio"
name="email"
value="{{emailaddress.email}}"
{% if emailaddress.primary or user.emailaddress_set.count == 1 %}
checked="checked"
{%endif %}
/>
{{ emailaddress.email }}
{% if emailaddress.verified %}
<span class="verified">{% trans "Verified" %}</span>
{% else %}
<span class="unverified">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
{% endfor %}
<div class="buttonHolder">
<button class="btn btn-black" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="btn btn-black" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="btn btn-black" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>
</fieldset>
</form>
{% else %}
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
{% endif %}
<h2>{% trans "Add E-mail Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{% bootstrap_form form %}
<button name="action_add" class="btn btn-black" type="submit">{% trans "Add E-mail" %}</button>
</form>
</div>
</div>
<script type="text/javascript">
(function() {
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock %}

View file

@ -0,0 +1,34 @@
{% extends 'profile_base.html' %}
{% load i18n %}
{% load account %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>{% trans "Confirm E-mail Address" %}</h1>
{% if confirmation %}
{% user_display confirmation.email_address.user as user_display %}
<p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<button type="submit" class="btn btn-black">
{% trans 'Confirm' %}
</button>
</form>
{% else %}
{% url 'account_email' as email_url %}
<p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,19 @@
{% extends 'base.html' %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<p class="lead">
Sure you want to logout?
</p>
<form method="post">
{% csrf_token %}
<button type="submit"
class="btn btn-black form-control">
Logout
</button>
</form>
</div>
</div>
{% endblock %}

View file

@ -1,13 +1,13 @@
{% extends "base.html" %}
{% extends 'profiles/profile_base.html' %}
{% load account %}
{% load bootstrap3 %}
{% block content %}
{% block profile_content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Edit profile</h1>
<div class="col-md-12">
<h1>Change password</h1>
<form class="login" method="POST">
{% csrf_token %}

View file

@ -0,0 +1,24 @@
{% extends 'base.html' %}
{% load account %}
{% load bootstrap3 %}
{% block content %}
<div class="row">
<div class="col-md-12">
<p>
<a href="{% url 'account_change_password' %}" class="btn btn-black">
Change password
</a>
<a href="{% url 'account_email' %}" class="btn btn-black">
Manage email
</a>
</p>
<hr />
</div>
</div>
{% block profile_content %}{% endblock %}
{% endblock %}

View file

@ -1,14 +1,11 @@
{% extends 'base.html' %}
{% extends 'profiles/profile_base.html' %}
{% block content %}
<div class="cover">
<p class="lead">
Yeah! You now have a BornHack user!
</p>
{% block profile_content %}
<div class="row" >
<div class="col-md-12">
<p>
<a href="{% url 'profiles:update' %}">
Edit your profile
</a>
Not much going on here yet.
</p>
</div>
</div>
{% endblock %}