Skip to content

Commit

Permalink
Merge pull request #785 from rdmorganiser/minor_fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
jochenklar authored Nov 23, 2023
2 parents 9578643 + adbd6fb commit 0bb87a9
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 39 deletions.
5 changes: 4 additions & 1 deletion rdmo/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RoleAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'user__email')
list_filter = ('member', 'manager', 'editor', 'reviewer')

list_display = ('user', 'members', 'managers', 'editors', 'reviewers')
list_display = ('user', 'email', 'members', 'managers', 'editors', 'reviewers')

def get_queryset(self, request):
return Role.objects.prefetch_related(
Expand All @@ -43,6 +43,9 @@ def render_all_sites_or_join(obj, field_name: str) -> str:
return 'all Sites'
return ', '.join([site.domain for site in getattr(obj, field_name).all()])

def email(self, obj):
return obj.user.email

def members(self, obj):
return self.render_all_sites_or_join(obj, 'member')

Expand Down
2 changes: 1 addition & 1 deletion rdmo/core/templates/core/upload_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<input type="hidden" name="method" value="upload_file" />

<div class="upload-form-field">
<input type="file" name="uploaded_file" />
<input type="file" name="uploaded_file" {% if upload_accept %}accept="{{ upload_accept }}"{% endif %}/>
<p>{% trans "Select file" %}</p>
</div>

Expand Down
Binary file modified rdmo/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
70 changes: 35 additions & 35 deletions rdmo/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ msgstr ""
"Project-Id-Version: RDMO\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-22 12:31+0200\n"
"PO-Revision-Date: 2023-09-22 12:31+0200\n"
"PO-Revision-Date: 2023-10-16 13:11+0200\n"
"Last-Translator: Jochen Klar <[email protected]>\n"
"Language-Team: RDMO <[email protected]>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.2.2\n"
"X-Generator: Poedit 2.4.2\n"

#: accounts/apps.py:7
msgid "Accounts"
Expand Down Expand Up @@ -359,11 +359,11 @@ msgstr "Bestätigen"
#: accounts/templates/account/email_confirm.html:29
#, python-format
msgid ""
"This e-mail confirmation link expired or is invalid. Please <a "
"href=\"%(email_url)s\">issue a new e-mail confirmation request</a>."
"This e-mail confirmation link expired or is invalid. Please <a href="
"\"%(email_url)s\">issue a new e-mail confirmation request</a>."
msgstr ""
"Dieser Bestätigungs-Link ist abgelaufen oder ungültig. Bitte <a "
"href=\"%(email_url)s\">fordern sie eine neue Betätigungs-E-Mail an</a>."
"Dieser Bestätigungs-Link ist abgelaufen oder ungültig. Bitte <a href="
"\"%(email_url)s\">fordern sie eine neue Betätigungs-E-Mail an</a>."

#: accounts/templates/account/login.html:6
#: accounts/templates/account/login_form.html:23
Expand All @@ -380,17 +380,17 @@ msgstr "Mit Shibboleth einloggen"
#: accounts/templates/account/login_form_account.html:7
#, python-format
msgid ""
"If you have not created an account yet, then please <a "
"href=\"%(signup_url)s\">sign up</a> first."
"If you have not created an account yet, then please <a href=\"%(signup_url)s"
"\">sign up</a> first."
msgstr ""
"Falls Sie noch kein Benutzerkonto haben, <a "
"href=\"%(signup_url)s\">registrieren</a> Sie sich bitte zunächst."
"Falls Sie noch kein Benutzerkonto haben, <a href=\"%(signup_url)s"
"\">registrieren</a> Sie sich bitte zunächst."

#: accounts/templates/account/login_form_account.html:14
#, python-format
msgid ""
"If you forgot your password and want to reset it, click <a "
"href=\"%(reset_url)s\">here</a>."
"If you forgot your password and want to reset it, click <a href="
"\"%(reset_url)s\">here</a>."
msgstr ""
"Falls Sie Ihr Passwort vergessen haben und es zurücksetzen wollen, klicken "
"Sie bitte <a href=\"%(reset_url)s\">hier</a>."
Expand Down Expand Up @@ -520,8 +520,8 @@ msgstr "Neues Benutzerkonto erstellen"
msgid ""
"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>."
msgstr ""
"Falls Sie schon eine Benutzerkonto haben können Sie sich <a "
"href=\"%(login_url)s\">hier</a> anmelden."
"Falls Sie schon eine Benutzerkonto haben können Sie sich <a href="
"\"%(login_url)s\">hier</a> anmelden."

#: accounts/templates/account/signup.html:34
#: accounts/templates/socialaccount/signup.html:33
Expand Down Expand Up @@ -601,8 +601,8 @@ msgid ""
"<strong>Note:</strong> you can still <a href=\"%(email_url)s\">change your e-"
"mail address</a>."
msgstr ""
"<strong>Hinweis:</strong> Sie können immer noch Ihre <a "
"href=\"%(email_url)s\">E-Mail Adresse ändern</a>."
"<strong>Hinweis:</strong> Sie können immer noch Ihre <a href=\"%(email_url)s"
"\">E-Mail Adresse ändern</a>."

#: accounts/templates/profile/profile_remove_closed.html:6
#: accounts/templates/profile/profile_remove_failed.html:6
Expand Down Expand Up @@ -728,12 +728,12 @@ msgstr "Anmeldung abgebrochen"
#, python-format
msgid ""
"You decided to cancel logging in to our site using one of your existing "
"accounts. If this was a mistake, please proceed to <a "
"href=\"%(login_url)s\">sign in</a>."
"accounts. If this was a mistake, please proceed to <a href=\"%(login_url)s"
"\">sign in</a>."
msgstr ""
"Sie haben sich entschieden, die Anmeldung mit einem externen Konto "
"abzubrechen. Falls dies versehentlich geschehen ist, könne Sie <a "
"href=\"%(login_url)s\">hier</a> fortsetzen."
"abzubrechen. Falls dies versehentlich geschehen ist, könne Sie <a href="
"\"%(login_url)s\">hier</a> fortsetzen."

#: accounts/templates/socialaccount/signup.html:9
#, python-format
Expand Down Expand Up @@ -2337,11 +2337,11 @@ msgstr "Sehr geehrte Damen und Herren,"
#: projects/templates/projects/issue_send_message.txt:3
#, python-format
msgid ""
"The following task was identified in the project \"%(project_title)s\" "
"<%(project_url)s>:"
"The following task was identified in the project \"%(project_title)s\" <"
"%(project_url)s>:"
msgstr ""
"Die folgende Aufgabe wurde im Projekt \"%(project_title)s\" "
"<%(project_url)s> identifiziert:"
"Die folgende Aufgabe wurde im Projekt \"%(project_title)s\" <"
"%(project_url)s> identifiziert:"

#: projects/templates/projects/issue_send_message.txt:13
#, python-format
Expand All @@ -2366,8 +2366,8 @@ msgid ""
"You are about to remove the user <strong>%(user)s</strong> from the project "
"<strong>%(title)s</strong>."
msgstr ""
"Sie sind dabei den User <strong>%(user)s</strong> aus dem Projekt "
"<strong>%(title)s</strong> zu entfernen."
"Sie sind dabei den User <strong>%(user)s</strong> aus dem Projekt <strong>"
"%(title)s</strong> zu entfernen."

#: projects/templates/projects/membership_form.html:9
#: projects/templates/projects/membership_form.html:11
Expand Down Expand Up @@ -2614,14 +2614,14 @@ msgstr "Antworten anzeigen"
#: projects/templates/projects/project_detail_sidebar.html:57
#: projects/templates/projects/project_form.html:23
msgid "Update project tasks"
msgstr "Projekt Aufgaben bearbeiten"
msgstr "Projektaufgaben bearbeiten"

#: projects/templates/projects/project_detail_sidebar.html:62
#: projects/templates/projects/project_detail_views.html:23
#: projects/templates/projects/project_detail_views.html:50
#: projects/templates/projects/project_form.html:31
msgid "Update project views"
msgstr "Projekt Ansichten bearbeiten"
msgstr "Projektansichten bearbeiten"

#: projects/templates/projects/project_detail_sidebar.html:87
#: projects/templates/projects/project_detail_snapshots.html:25
Expand Down Expand Up @@ -2958,11 +2958,11 @@ msgstr ""

#: projects/templates/projects/project_questions_navigation_help.html:14
msgid ""
"Entries with <i class=\"fa fa-question-circle-o small\" aria-"
"hidden=\"true\"></i> might be skipped based on your input."
"Entries with <i class=\"fa fa-question-circle-o small\" aria-hidden=\"true"
"\"></i> might be skipped based on your input."
msgstr ""
"Einträge mit <i class=\"fa fa-question-circle-o small\" aria-"
"hidden=\"true\"></i> können aufgrund Ihrer Eingabe übersprungen werden."
"Einträge mit <i class=\"fa fa-question-circle-o small\" aria-hidden=\"true"
"\"></i> können aufgrund Ihrer Eingabe übersprungen werden."

#: projects/templates/projects/project_questions_overview.html:14
#: projects/templates/projects/site_projects.html:52
Expand All @@ -2987,9 +2987,9 @@ msgid ""
msgstr ""
"Warnung: In der Datenbank sind mehrere Antworten vorhanden. Dies kann "
"aufgrund eines technischen Problems in der Vergangenheit geschehen. Sie "
"können unerwünschte Antworten über das Feld \"Eintrag entfernen\" (<i "
"class=\"fa fa-times\"></i>) entfernen. Bitte kontaktieren Sie den Support, "
"wenn das Problem weiterhin besteht."
"können unerwünschte Antworten über das Feld \"Eintrag entfernen\" (<i class="
"\"fa fa-times\"></i>) entfernen. Bitte kontaktieren Sie den Support, wenn "
"das Problem weiterhin besteht."

#: projects/templates/projects/project_questions_questionset_head.html:34
#, python-format
Expand Down
2 changes: 1 addition & 1 deletion rdmo/management/assets/js/components/common/Forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const UploadForm = ({ onSubmit }) => {
return (
<form className="upload-form sidebar-form" onSubmit={handleSubmit}>
<div className="upload-form-field">
<input type="file" name="uploaded_file" onChange={event => setFile(event.target.files[0])} />
<input type="file" name="uploaded_file" onChange={event => setFile(event.target.files[0])} accept=".xml"/>
<p>{file ? file.name : gettext('Select file')}</p>
</div>

Expand Down
3 changes: 3 additions & 0 deletions rdmo/projects/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

class Import(Plugin):

accept = None
upload = True

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -88,6 +89,8 @@ def get_view(self, view_uri):

class RDMOXMLImport(Import):

accept = '.xml'

def check(self):
file_type, encoding = mimetypes.guess_type(self.file_name)
if file_type == 'application/xml' or file_type == 'text/xml':
Expand Down
11 changes: 11 additions & 0 deletions rdmo/projects/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.urls import reverse

from rdmo.core.mail import send_mail
from rdmo.core.plugins import get_plugins

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -173,3 +174,13 @@ def set_context_querystring_with_filter_and_page(context: dict) -> dict:
del querystring['page']
context['querystring'] = querystring.urlencode()
return context


def get_upload_accept():
accept = set()
for import_plugin in get_plugins('PROJECT_IMPORTS').values():
if import_plugin.accept:
accept.add(import_plugin.accept)
else:
return None
return ','.join(accept)
4 changes: 3 additions & 1 deletion rdmo/projects/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from ..filters import ProjectFilter
from ..models import Integration, Invite, Membership, Project, Value
from ..utils import set_context_querystring_with_filter_and_page
from ..utils import get_upload_accept, set_context_querystring_with_filter_and_page

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -71,6 +71,7 @@ def get_context_data(self, **kwargs):
context['invites'] = Invite.objects.filter(user=self.request.user)
context['is_site_manager'] = is_site_manager(self.request.user)
context['number_of_filtered_projects'] = context["filter"].qs.count()
context['upload_accept'] = get_upload_accept()
context = set_context_querystring_with_filter_and_page(context)
return context

Expand Down Expand Up @@ -161,6 +162,7 @@ def get_context_data(self, **kwargs):
context['snapshots'] = project.snapshots.all()
context['invites'] = project.invites.all()
context['membership'] = Membership.objects.filter(project=project, user=self.request.user).first()
context['upload_accept'] = get_upload_accept()
return context


Expand Down

0 comments on commit 0bb87a9

Please sign in to comment.