Skip to content

Commit

Permalink
Merge 0bb87a9 into 69aaae6
Browse files Browse the repository at this point in the history
  • Loading branch information
MyPyDavid committed Nov 23, 2023
2 parents 69aaae6 + 0bb87a9 commit 630f1c2
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 71 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,35 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-wheel:
name: Build python wheel
needs: test
runs-on: ubuntu-22.04
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm install
- run: npm run build:prod
- uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: pip
- run: python -m pip install --upgrade build pip setuptools wheel
- run: python -m build --wheel
- run: |
PR_NUMBER=${{ github.event.pull_request.number }}
WHL_FILE=$(ls dist/*.whl)
NEW_NAME="${WHL_FILE/-py3-none-any/dev${PR_NUMBER}-py3-none-any}"
mv "$WHL_FILE" "$NEW_NAME"
- uses: actions/upload-artifact@v3
with:
name: wheel
path: dist/*.whl

dev-setup:
# Ref: structlog (MIT licensed) <https://github.com/hynek/structlog/blob/main/.github/workflows/ci.yml>
name: "Test dev setup on ${{ matrix.os }}"
Expand Down Expand Up @@ -170,6 +199,7 @@ jobs:
- lint
- test
- coveralls
- build-wheel
- dev-setup
- optional-dependencies
runs-on: ubuntu-22.04
Expand Down
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
1 change: 1 addition & 0 deletions rdmo/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
('radio', _('Radio buttons'), 'rdmo.projects.widgets.RadioWidget'),
('select', _('Select drop-down'), 'rdmo.projects.widgets.SelectWidget'),
('autocomplete', _('Autocomplete'), 'rdmo.projects.widgets.AutocompleteWidget'),
('freeautocomplete', _('Free autocomplete'), 'rdmo.projects.widgets.FreeAutocompleteWidget'),
('range', _('Range slider'), 'rdmo.projects.widgets.RangeWidget'),
('date', _('Date picker'), 'rdmo.projects.widgets.DateWidget'),
('file', _('File upload'), 'rdmo.projects.widgets.FileWidget')
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 <jklar@aip.de>\n"
"Language-Team: RDMO <rdmo-team@listserv.dfn.de>\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
75 changes: 64 additions & 11 deletions rdmo/projects/static/projects/js/project_questions/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ angular.module('project_questions')
}
}
} else {
console.log('next');
service.next();
}
} else {
Expand Down Expand Up @@ -1394,12 +1393,22 @@ angular.module('project_questions')

// unset the searching flag
value.searching = false;

// activate the first item
if (question.widget_type == 'autocomplete' && angular.isDefined(value.items[0])) {
value.items[0].active = true;
}
});
}
} else {
// if no search was performed, do the searching on the client
value.autocomplete_search = false;
value.items = question.options_fuse.search(value.autocomplete_input);

// activate the first item
if (question.widget_type == 'autocomplete' && angular.isDefined(value.items[0])) {
value.items[0].active = true;
}
}
} else {
value.items = [];
Expand Down Expand Up @@ -1442,8 +1451,19 @@ angular.module('project_questions')
value.autocomplete_input = next.text;
}
} else if ($event.code == 'Enter' || $event.code == 'NumpadEnter') {
if (angular.isDefined(active)) {
if (value.autocomplete_input == '') {
service.resetAutocomplete(value);
} else if (angular.isDefined(active)) {
service.selectAutocomplete(value, value.items[active]);
} else if (question.widget_type == 'freeautocomplete') {
var matchingOptions = $filter('filter')(value.items, function(item) {
return item.text.toLowerCase() == value.autocomplete_input.toLowerCase();
})
if (matchingOptions.length > 0) {
service.selectAutocomplete(value, matchingOptions[0]);
} else {
service.selectAutocomplete(value, null);
}
}
} else if ($event.code == 'Escape') {
if (value.selected === '') {
Expand All @@ -1459,24 +1479,57 @@ angular.module('project_questions')
// called when the user clicks on an option of the autocomplete field
service.selectAutocomplete = function(value, option) {
value.autocomplete_locked = true;
value.selected = option.id.toString();
value.autocomplete_text = option.text;

if (option === null) {
value.text = value.autocomplete_input;
value.selected = '';
value.autocomplete_text = value.text;
} else {
value.text = '';
value.selected = option.id.toString();
value.autocomplete_text = option.text;
value.autocomplete_input = option.text;
}

service.changed(value, true);
}

// called when the user clicks outside the autocomplete field
service.blurAutocomplete = function(value) {
if (value.selected === '') {
value.autocomplete_input = '';
value.autocomplete_text = '';
value.items = null;
service.blurAutocomplete = function(question, value) {
if (question.widget_type == 'freeautocomplete') {
if (value.autocomplete_input == '') {
service.resetAutocomplete(value);
} else {
var matchingOptions = $filter('filter')(value.items, function(item) {
return item.text.toLowerCase() == value.autocomplete_input.toLowerCase();
})
if (matchingOptions.length > 0) {
service.selectAutocomplete(value, matchingOptions[0]);
} else {
service.selectAutocomplete(value, null);
}
}
} else {
value.autocomplete_locked = true;
value.autocomplete_input = value.autocomplete_text;
if (value.selected === '') {
service.resetAutocomplete(value);
} else {
value.autocomplete_locked = true;
value.autocomplete_input = value.autocomplete_text;
}
}
}

// called when an empty string is entered in the autocomplete field
service.resetAutocomplete = function(value) {
value.text = '';
value.selected = '';
value.autocomplete_input = '';
value.autocomplete_text = '';
value.items = null;

service.changed(value, true);
}

// called when the user clicks in the autocomplete field
service.unlockAutocomplete = function(question, value, set_prefix, set_index, index) {
value.autocomplete_locked = false;
Expand Down
Loading

0 comments on commit 630f1c2

Please sign in to comment.