Skip to content

Commit

Permalink
Merge 15ca62a into 567ae17
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrindt authored Sep 1, 2023
2 parents 567ae17 + 15ca62a commit a45f5f0
Show file tree
Hide file tree
Showing 68 changed files with 853 additions and 828 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
poetry run pip install -U pip
poetry install
poetry install --with=dev
- name: check format with black
run: |
poetry run black --version
Expand All @@ -36,6 +36,15 @@ jobs:
run: |
poetry run pylint --version
poetry run pylint ephios
- name: Run djhtml
run: poetry run djhtml -c ephios/
- name: Make sure we always use trimmed translation strings
run: "! git grep ' blocktranslate ' | grep -v trimmed"
- name: No use of the {% translate %} tag
run: "! git grep '{% translate ' | grep -v 'run: git grep'"
- name: There shouldn't be a showbrowser call in the code
run: "! git grep '.showbrowser()' | grep -v 'run: git grep'"


test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -64,7 +73,7 @@ jobs:
run: |
sudo apt-get install gettext
poetry run pip install -U pip
poetry install --all-extras
poetry install --all-extras --with=dev
poetry run pip install git+https://github.com/ephios-dev/ephios-testplugin
- name: Prepare files for test run
run: |
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ repos:
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/rtts/djhtml
rev: 3.0.6
hooks:
- id: djhtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ <h3 class="block-center-heading">
<div class="control-group">
<div class="controls">
<a class="btn btn-secondary btn-large"
href="{% url "api:settings-oauth-app-list" %}">{% trans "Cancel" %}</a>
<input type="submit" class="btn btn-large btn-danger" name="allow" value="{% trans 'Delete' %}"/>
href="{% url "api:settings-oauth-app-list" %}">{% translate "Cancel" %}</a>
<input type="submit" class="btn btn-large btn-danger" name="allow" value="{% translate 'Delete' %}"/>
</div>
</div>
</form>
Expand Down
22 changes: 11 additions & 11 deletions ephios/api/templates/oauth2_provider/application_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="block-center">
<h3 class="block-center-heading">{{ application.name }}</h3>
<div class="mb-3">
<label for="client_id" class="form-label">{% trans "Client id" %}</label>
<label for="client_id" class="form-label">{% translate "Client id" %}</label>
<div class="input-group">
<input id="client_id" class="form-control" type="text" value="{{ application.client_id }}"
readonly>
Expand All @@ -17,7 +17,7 @@ <h3 class="block-center-heading">{{ application.name }}</h3>
</div>
</div>
<div class="mb-3">
<label for="client_secret" class="form-label">{% trans "Client secret" %}</label>
<label for="client_secret" class="form-label">{% translate "Client secret" %}</label>
<div class="input-group">
<input id="client_secret" class="form-control" type="text" value="{{ application.client_secret }}"
readonly>
Expand All @@ -27,45 +27,45 @@ <h3 class="block-center-heading">{{ application.name }}</h3>
</div>
</div>
<div class="mb-3">
<label for="client_type" class="form-label">{% trans "Client type" %}</label>
<label for="client_type" class="form-label">{% translate "Client type" %}</label>
<input id="client_type" class="form-control" type="text" value="{{ application.client_type }}"
readonly>
</div>
<div class="mb-3">
<label for="authorization_grant_type" class="form-label">{% trans "Authorization Grant Type" %}</label>
<label for="authorization_grant_type" class="form-label">{% translate "Authorization Grant Type" %}</label>
<input id="authorization_grant_type" class="form-control" type="text"
value="{{ application.authorization_grant_type }}"
readonly>
</div>
<div class="mb-3">
<label for="redirect_uris" class="form-label">{% trans "Redirect URIs" %}</label>
<label for="redirect_uris" class="form-label">{% translate "Redirect URIs" %}</label>
<textarea id="redirect_uris" class="form-control" type="text"
readonly>{{ application.redirect_uris }}</textarea>
</div>
<div class="mb-3">
<label for="created" class="form-label">{% trans "Created" %}</label>
<label for="created" class="form-label">{% translate "Created" %}</label>
<input id="created" class="form-control" type="text"
value="{{ application.created }}"
readonly>
</div>
<div class="mb-3">
<label for="updated" class="form-label">{% trans "Updated" %}</label>
<label for="updated" class="form-label">{% translate "Updated" %}</label>
<input id="updated" class="form-control" type="text"
value="{{ application.updated }}"
readonly>
</div>
<div class="mb-3">
<label for="user" class="form-label">{% trans "User" %}</label>
<label for="user" class="form-label">{% translate "User" %}</label>
<input id="user" class="form-control" type="text"
value="{{ application.user }}"
readonly>
</div>
<div class="btn-toolbar">
<a class="btn btn-secondary me-1" href="{% url "api:settings-oauth-app-list" %}">{% trans "Back" %}</a>
<a class="btn btn-secondary me-1" href="{% url "api:settings-oauth-app-list" %}">{% translate "Back" %}</a>
<a class="btn btn-primary me-1"
href="{% url "api:settings-oauth-app-update" application.id %}">{% trans "Edit" %}</a>
href="{% url "api:settings-oauth-app-update" application.id %}">{% translate "Edit" %}</a>
<a class="btn btn-danger me-1"
href="{% url "api:settings-oauth-app-delete" application.id %}">{% trans "Delete" %}</a>
href="{% url "api:settings-oauth-app-delete" application.id %}">{% translate "Delete" %}</a>
</div>
</div>
{% endblock %}
Expand Down
6 changes: 3 additions & 3 deletions ephios/api/templates/oauth2_provider/application_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<form class="form-horizontal" method="post" action="{% block app-form-action-url %}{% url 'api:settings-oauth-app-update' application.id %}{% endblock app-form-action-url %}">
<h3 class="block-center-heading">
{% block app-form-title %}
{% trans "Edit application" %} {{ application.name }}
{% translate "Edit application" %} {{ application.name }}
{% endblock app-form-title %}
</h3>
{% csrf_token %}
Expand All @@ -22,9 +22,9 @@ <h3 class="block-center-heading">
<div class="control-group">
<div class="controls">
<a class="btn btn-secondary" href="{% block app-form-back-url %}{% url "api:settings-oauth-app-detail" application.id %}{% endblock app-form-back-url %}">
{% trans "Back" %}
{% translate "Back" %}
</a>
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
<button type="submit" class="btn btn-primary">{% translate "Save" %}</button>
</div>
</div>
</form>
Expand Down
72 changes: 36 additions & 36 deletions ephios/api/templates/oauth2_provider/application_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,50 @@ <h3 class="block-center-heading">{% translate "App integrations" %}</h3>
{% endblocktranslate %}
</p>
<h4>{% translate "OAuth2 applications" %}</h4>
<a class="btn btn-primary" href="{% url "api:settings-oauth-app-register" %}">{% trans "New Application" %}</a>
<a class="btn btn-primary" href="{% url "api:settings-oauth-app-register" %}">{% translate "New Application" %}</a>
{% if applications %}
<table id="userprofile_table" class="table table-striped display">
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "User" %}</th>
<th>{% trans "Created" %}</th>
<th>{% trans "Action" %}</th>
</tr>
</thead>
<tbody>
{% for application in applications %}
<tr>
<td>{{ application.name }}</td>
<td>
{{ application.user }}
</td>
<td>{{ application.created }}</td>
<td class="d-flex">
<div>
<a class="btn btn-secondary"
href="{{ application.get_absolute_url }}">
<span class="fa fa-eye"></span>
<span class="d-none d-lg-inline">{% translate "View" %}</span>
</a>
<a class="btn btn-secondary ms-1"
href="{% url "api:settings-oauth-app-update" application.id %}">
<span class="fa fa-edit"></span>
<span class="d-none d-lg-inline">{% translate "Edit" %}</span>
</a>
<a class="btn btn-secondary ms-1"
href="{% url "api:settings-oauth-app-delete" application.id %}">
<span class="fa fa-trash-alt"></span>
<span class="d-none d-lg-inline">{% trans "Delete" %}</span>
</a>
</div>
</td>
<th>{% translate "Name" %}</th>
<th>{% translate "User" %}</th>
<th>{% translate "Created" %}</th>
<th>{% translate "Action" %}</th>
</tr>
{% endfor %}
</thead>
<tbody>
{% for application in applications %}
<tr>
<td>{{ application.name }}</td>
<td>
{{ application.user }}
</td>
<td>{{ application.created }}</td>
<td class="d-flex">
<div>
<a class="btn btn-secondary"
href="{{ application.get_absolute_url }}">
<span class="fa fa-eye"></span>
<span class="d-none d-lg-inline">{% translate "View" %}</span>
</a>
<a class="btn btn-secondary ms-1"
href="{% url "api:settings-oauth-app-update" application.id %}">
<span class="fa fa-edit"></span>
<span class="d-none d-lg-inline">{% translate "Edit" %}</span>
</a>
<a class="btn btn-secondary ms-1"
href="{% url "api:settings-oauth-app-delete" application.id %}">
<span class="fa fa-trash-alt"></span>
<span class="d-none d-lg-inline">{% translate "Delete" %}</span>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No applications defined" %}.</p>
<p>{% translate "No applications defined" %}.</p>
{% endif %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% load i18n %}

{% block app-form-title %}{% trans "Register a new application" %}{% endblock app-form-title %}
{% block app-form-title %}{% translate "Register a new application" %}{% endblock app-form-title %}

{% block app-form-action-url %}{% url 'api:settings-oauth-app-register' %}{% endblock app-form-action-url %}

Expand Down
44 changes: 22 additions & 22 deletions ephios/api/templates/oauth2_provider/authorize.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@

{% block content %}
{% if not error %}
<form id="authorizationForm" method="post">
<h3 class="block-center-heading">{% trans "Authorize" %} {{ application.name }}?</h3>
{% csrf_token %}
<form id="authorizationForm" method="post">
<h3 class="block-center-heading">{% translate "Authorize" %} {{ application.name }}?</h3>
{% csrf_token %}

{# pass query params through the submit process for saving #}
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% endif %}
{% endfor %}
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% endif %}
{% endfor %}

<p>{% trans "The application requires the following permissions:" %}</p>
<ul>
{% for scope in scopes_descriptions %}
<li>{{ scope }}</li>
{% endfor %}
</ul>
<p>{% translate "The application requires the following permissions:" %}</p>
<ul>
{% for scope in scopes_descriptions %}
<li>{{ scope }}</li>
{% endfor %}
</ul>

{{ form.errors }}
{{ form.non_field_errors }}
{{ form.errors }}
{{ form.non_field_errors }}

<div class="control-group">
<div class="controls">
<input type="submit" class="btn btn-large btn-secondary" value="{% translate "Cancel" %}"/>
<input type="submit" class="btn btn-large btn-primary" name="allow" value="{% translate "Authorize" %}"/>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" class="btn btn-large btn-secondary" value="{% translate "Cancel" %}"/>
<input type="submit" class="btn btn-large btn-primary" name="allow" value="{% translate "Authorize" %}"/>
</div>
</form>
</div>
</form>

{% else %}
<h2>Error: {{ error.error }}</h2>
Expand Down
4 changes: 2 additions & 2 deletions ephios/core/templates/core/disposition/disposition.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h3 class="subtitle text-body-secondary">
<div class="card border-secondary mb-3">
<div class="card-body d-flex flex-column">
<h5 class="card-title d-flex align-items-center">
{% trans "Add others" %}
{% translate "Add others" %}
</h5>
<div class="form-group">
{{ add_user_form.user }}
Expand Down Expand Up @@ -121,7 +121,7 @@ <h5 class="card-title">{{ states.USER_DECLINED.label|capfirst }}</h5>
</div>
</div>
<div class="form-group">
<a role="button" class="btn btn-secondary" href="{{ shift.event.get_absolute_url }}">{% trans "Cancel" %}</a>
<a role="button" class="btn btn-secondary" href="{{ shift.event.get_absolute_url }}">{% translate "Cancel" %}</a>
<button type="submit" class="btn btn-primary float-end">{% translate "Save" %}</button>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ <h6 class="d-inline">
<span class="fa fa-exclamation-triangle text-danger"
data-bs-toggle="tooltip"
title="{% blocktranslate trimmed with participant=form.instance.participant conflicts=conflicts|join:", " %}
{{ participant }} already participates in {{ conflicts }} at the same time.
{% endblocktranslate %}"></span>
{{ participant }} already participates in {{ conflicts }} at the same time.
{% endblocktranslate %}"></span>
{% endif %}
{% endwith %}

{% if form.instance.participant.is_minor %}
<span class="badge bg-warning">{% trans "Minor" %}</span>
<span class="badge bg-warning">{% translate "Minor" %}</span>
{% endif %}
{% for abbreviation in form.instance.participant.qualifications|qualifications_to_essential_abbreviations %}
<span class='badge bg-secondary text-dark'>{{ abbreviation }}</span>
<span class='badge bg-secondary text-dark'>{{ abbreviation }}</span>
{% endfor %}

{% block participation_detail %}
Expand All @@ -37,10 +37,10 @@ <h6 class="d-inline">
<button class="btn" type="button" data-bs-toggle="collapse"
data-bs-target="#participation-collapse-{{ form.instance.id }}" aria-expanded="false"
aria-controls="collapseExample">
<span class="{% if form.instance.has_customized_signup %}text-dark{% else %}text-secondary{% endif %}">
<i class="fas fa-cog"></i>
<i class="fas fa-exclamation{% if not form.instance.has_customized_signup %} invisible{% endif %}"></i>
</span>
<span class="{% if form.instance.has_customized_signup %}text-dark{% else %}text-secondary{% endif %}">
<i class="fas fa-cog"></i>
<i class="fas fa-exclamation{% if not form.instance.has_customized_signup %} invisible{% endif %}"></i>
</span>
<span class="visually-hidden">{% translate "Customize" %}</span>
</button>
{% if form.can_delete %}
Expand Down
4 changes: 2 additions & 2 deletions ephios/core/templates/core/event_bulk_delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>{% translate "Delete events" %}</h1>
{% endfor %}
</ul>
<a role="button" class="btn btn-secondary"
href="{% url "core:event_list" %}">{% trans "Back" %}</a>
<button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
href="{% url "core:event_list" %}">{% translate "Back" %}</a>
<button type="submit" class="btn btn-danger">{% translate "Delete" %}</button>
</form>
{% endblock %}
8 changes: 4 additions & 4 deletions ephios/core/templates/core/event_confirm_delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
{% load static %}

{% block title %}
{% trans "Delete event" %}
{% translate "Delete event" %}
{% endblock %}

{% block content %}
<div class="page-header">
<h1>{% trans "Delete event" %}</h1>
<h1>{% translate "Delete event" %}</h1>
</div>

<form method="post">{% csrf_token %}
<p>{% blocktrans %}Are you sure you want to delete the event "{{ object }}"?{% endblocktrans %}</p>
<a role="button" class="btn btn-secondary" href="{{ object.get_absolute_url }}">{% trans "Back" %}</a>
<button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
<a role="button" class="btn btn-secondary" href="{{ object.get_absolute_url }}">{% translate "Back" %}</a>
<button type="submit" class="btn btn-danger">{% translate "Delete" %}</button>
</form>

{% endblock %}
Loading

0 comments on commit a45f5f0

Please sign in to comment.