Skip to content

Project refactor home #1388

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

Open
wants to merge 18 commits into
base: project
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ rdmo/core/static/core/js/base.js
rdmo/core/static/core/js/base.js.LICENSE.txt
rdmo/core/static/core/js/base-bs53.js
rdmo/core/static/core/js/base-bs53.js.LICENSE.txt
rdmo/core/static/core/js/bootstrap-bs53.js
rdmo/core/static/core/js/bootstrap-bs53.js.LICENSE.txt
rdmo/core/static/core/css/base.css
rdmo/core/static/core/css/base-bs53.css
rdmo/core/static/core/css/bootstrap.css
rdmo/core/static/core/css/bootstrap-bs53.css
rdmo/core/static/core/fonts

rdmo/projects/static/projects/css/interview.css
Expand Down
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"dependencies": {
"@codemirror/lang-html": "^6.4.2",
"@codemirror/lang-javascript": "^6.2.2",
"@fontsource/open-sans": "^5.2.6",
"@fontsource/roboto-slab": "^5.2.6",
"@uiw/react-codemirror": "^4.23.0",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,4 @@ default.extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # for .py files
"(?Rm)^.*<!-- spellchecker:disable-line -->$", # for .html files
]
files.extend-exclude = ["rdmo/core/templates/core/bs53/home.html"]
4 changes: 4 additions & 0 deletions rdmo/accounts/account.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.conf import settings
from django.contrib.auth.models import Group
from django.forms import BooleanField
from django.urls import reverse

from allauth.account.adapter import DefaultAccountAdapter
from allauth.account.forms import LoginForm as AllauthLoginForm
Expand All @@ -24,6 +25,9 @@ def save_user(self, request, user, form, commit=True):

return user

def get_password_change_redirect_url(self, request):
return reverse('projects')


class LoginForm(AllauthLoginForm):

Expand Down
10 changes: 4 additions & 6 deletions rdmo/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,17 @@ def _save_additional_values(self, user=None):
class RemoveForm(forms.Form):

def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request')
kwargs.setdefault('label_suffix', '')
self.user = kwargs.pop('user')

super().__init__(*args, **kwargs)
if not self.request.user.has_usable_password():
if not self.user.has_usable_password():
self.fields.pop('password')

email = forms.CharField(widget=forms.TextInput(attrs={'required': 'false'}))
email = forms.CharField(required=False, widget=forms.TextInput())
email.label = _('E-mail')
email.widget.attrs = {'class': 'form-control', 'placeholder': email.label}

password = forms.CharField(widget=forms.PasswordInput)
password.label = _('Password')
password.widget.attrs = {'class': 'form-control', 'placeholder': password.label}

consent = forms.BooleanField(required=True)
consent.label = _("I confirm that I want my profile to be completely removed. This can not be undone!")
Expand Down
Binary file added rdmo/accounts/static/accounts/img/orcid-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed rdmo/accounts/static/accounts/img/orcid-signin.png
Binary file not shown.
Binary file removed rdmo/accounts/static/accounts/img/orcid_16x16.png
Binary file not shown.
7 changes: 5 additions & 2 deletions rdmo/accounts/templates/account/account_token.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page.html' %}
{% extends 'core/bs53/page.html' %}
{% load i18n %}

{% block page %}
Expand All @@ -9,7 +9,10 @@ <h1>{% trans "API token" %}</h1>

<form method="post" action="{% url 'account_token' %}" novalidate>
{% csrf_token %}
<input type="submit" name="regenerate" value="{% trans 'Regenerate token' %}" class="btn btn-default" />

<button type="submit" name="regenerate" class="btn btn-default">
{% trans 'Regenerate token' %}
</button>
</form>

<p>
Expand Down
134 changes: 87 additions & 47 deletions rdmo/accounts/templates/account/email.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page.html' %}
{% extends 'core/bs53/page.html' %}
{% load i18n %}

{% block page %}
Expand All @@ -9,74 +9,114 @@ <h1>{% trans "E-mail Addresses" %}</h1>

<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>

<form class="email-form" action="{% url 'account_email' %}" class="email_list" method="post">
<form action="{% url 'account_email' %}" method="post" class="mb-5">
{% csrf_token %}

<fieldset>
{% for emailaddress in user.emailaddress_set.all %}

{% for emailaddress in user.emailaddress_set.all %}
{% if forloop.first %}
<hr />
{% endif%}

<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
<div class="d-flex align-items-center gap-2 mb-3">
<div class="form-check flex-grow-1">
<input type="radio" name="email" id="email_radio_{{ forloop.counter }}"
class="form-check-input" value="{{ emailaddress.email }}"
{% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %}
aria-describedby="{{ form.consent.id_for_label }}-help">

{{ emailaddress.email }}

<div class="pull-right">
{% if emailaddress.primary %}
<span class="label label-primary">{% trans "Primary" %}</span>
{% endif %}
<label class="form-check-label" for="email_radio_{{ forloop.counter }}">
{{ emailaddress.email }}
</label>
</div>

{% if emailaddress.verified %}
<span class="label label-success">{% trans "Verified" %}</span>
{% else %}
<span class="label label-warning">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}
<div class="badge text-bg-primary">{% trans "Primary" %}</div>
{% endif %}

{% if emailaddress.verified %}
<div class="badge text-bg-success">{% trans "Verified" %}</div>
{% else %}
<div class="badge text-bg-secondary">{% trans "Unverified" %}</div>
{% endif %}
</div>

<hr />

{% endfor %}

<div class="d-flex gap-2 mb-3">
<button type="submit" class="btn btn-sm btn-outline-primary" name="action_primary">
{% trans 'Make Primary' %}
</button>
<button type="submit" class="btn btn-sm btn-outline-secondary" name="action_send">
{% trans 'Re-send Verification' %}
</button>
<button type="button" class="btn btn-sm btn-outline-danger" data-bs-toggle="modal" data-bs-target="#remove-modal">
{% trans 'Remove' %}
</button>
</div>

<div class="modal" id="remove-modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{% trans 'Do you really want to remove the selected e-mail address?' %}
</div>
<div class="modal-footer">
<button class="btn btn-danger" type="submit" name="action_remove">
{% trans 'Remove' %}
</button>

<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</label>

{% endfor %}

<div class="email-form-buttons">
<button class="btn btn-default" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="btn btn-default" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="btn btn-primary" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>

</fieldset>
</div>
</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." %}
<strong>{% trans 'Warning:'%}</strong>
{% blocktrans trimmed %}
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.
{% endblocktrans %}
</p>

{% endif %}

<h2>{% trans "Add E-mail Address" %}</h2>

<form method="post" action="{% url 'account_email' %}" class="add_email">
<form method="post" action="{% url 'account_email' %}" class="d-flex align-items-start gap-2 mb-4">
{% csrf_token %}

{% include 'core/bootstrap_form_fields.html' %}
<div class="flex-grow-1">
<label for="{{ form.email.id_for_label }}" class="visually-hidden">{{ form.email.label }}</label>

<button class="btn btn-default" name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form>
{% if field.help_text %}
<p id="{{ form.email.id_for_label }}-help" class="form-text text-muted mt-0 mb-1">
{{ field.help_text }}
</p>
{% endif %}

{% endblock %}
<input type="email" name="{{ form.email.name }}"
class="form-control {% if form.email.errors %}is-invalid{% endif %}" id="{{ form.email.id_for_label }}"
aria-describedby="{{ form.email.id_for_label }}-help" placeholder="{{ form.email.label }}">

{% for error in form.email.errors %}
<div class="invalid-feedback">{{ error }}</div>
{% endfor %}
</div>

<button class="d-block btn btn-outline-primary" name="action_add" type="submit">
{% trans "Add E-mail" %}
</button>
</form>

{% block extra_body %}
<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 %}
9 changes: 6 additions & 3 deletions rdmo/accounts/templates/account/email_confirm.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page.html' %}
{% extends 'core/bs53/page.html' %}
{% load i18n %}
{% load account %}

Expand All @@ -18,7 +18,10 @@ <h1>{% trans "Confirm E-mail Address" %}</h1>

<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<input type="submit" class="btn btn-primary" value="{% trans 'Confirm' %}" />

<button type="submit" class="btn btn-primary">
{% trans 'Confirm' %}
</button>
</form>

{% else %}
Expand All @@ -33,4 +36,4 @@ <h1>{% trans "Confirm E-mail Address" %}</h1>

{% endif %}

{% endblock %}
{% endblock %}
18 changes: 16 additions & 2 deletions rdmo/accounts/templates/account/login.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
{% extends 'core/page.html' %}
{% extends 'core/bs53/page.html' %}
{% load i18n %}

{% block page %}

<h1>{% trans "Login" %}</h1>

{% include 'account/login_form.html'%}
<div class="d-flex flex-column gap-4">
{% if settings.LOGIN_FORM %}
{% include 'account/login_form.html' %}
{% endif %}

{% if settings.SHIBBOLETH %}
{% include 'account/login_shibboleth.html' %}
{% endif %}

{% if settings.SOCIALACCOUNT %}
<div class="d-flex flex-wrap align-items-start gap-2">
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</div>
{% endif %}
</div>

{% endblock %}
Loading
Loading