Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A summary of changes made to the codebase, grouped per deployment.
### New features

- The apply button in the English header, which previously read "søk verv", has now been translated to English ("apply to MAKE")
- Added a page where users can request access to the 3D-printing room after having attended a 3D-printing course. The page also lets users update their EM number if they got a new card, or lost access to the 3D-printing room.

### Improvements

Expand Down
Binary file modified src/locale/nb/LC_MESSAGES/django.mo
Binary file not shown.
76 changes: 61 additions & 15 deletions src/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: MAKE NTNU website\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-05 18:43+0200\n"
"POT-Creation-Date: 2023-12-05 19:22+0100\n"
"PO-Revision-Date: 2018-10-09 14:05+0200\n"
"Last-Translator: Sindre Stephansen <sindre@sindrestephansen.com>\n"
"Language-Team: Norwegian Bokmål <dev@makentnu.no>\n"
Expand Down Expand Up @@ -133,7 +133,7 @@ msgstr "Legg til kunngjøring"
#: src/make_queue/templates/make_queue/course/printer_3d_course_list.html:18
#: src/make_queue/templates/make_queue/machine_list.html:21
#: src/make_queue/views/machine.py:178 src/make_queue/views/quota.py:88
#: src/make_queue/views/reservation_rule.py:74 src/makerspace/views.py:54
#: src/make_queue/views/reservation_rule.py:74 src/makerspace/views.py:59
#: src/news/views/article.py:88 src/news/views/event.py:237
#: src/news/views/event.py:324
msgid "Add"
Expand Down Expand Up @@ -435,6 +435,7 @@ msgstr "sist endret"
#: src/make_queue/templates/make_queue/reservation_list.html:66
#: src/make_queue/templates/make_queue/reservation_list.html:126
#: src/make_queue/templates/make_queue/reservation_list.html:202
#: src/makerspace/templates/makerspace/card_registration/card_registration.html:21
#: src/makerspace/templates/makerspace/equipment/equipment_detail.html:34
#: src/news/templates/news/article/admin_article_list.html:53
#: src/news/templates/news/article/article_detail.html:41
Expand Down Expand Up @@ -806,7 +807,7 @@ msgstr ""
#: src/make_queue/models/reservation.py:31 src/news/admin.py:306
#: src/news/models.py:250
#: src/news/templates/admin/news/event/change_form_ticket_table.html:16
#: src/web/templates/web/header.html:90
#: src/web/templates/web/header.html:95
msgid "user"
msgstr "bruker"

Expand Down Expand Up @@ -1015,7 +1016,7 @@ msgid "“{quote}” —{quoted}"
msgstr "«{quote}» —{quoted}"

#: src/internal/templates/internal/base.html:6
#: src/web/templates/web/header.html:94
#: src/web/templates/web/header.html:99
msgid "Internal pages"
msgstr "Internsider"

Expand Down Expand Up @@ -1056,12 +1057,12 @@ msgid "Public pages"
msgstr "Offentlige sider"

#: src/internal/templates/internal/header.html:43
#: src/web/templates/web/header.html:104
#: src/web/templates/web/header.html:109
msgid "Django admin"
msgstr "Django-admin"

#: src/internal/templates/internal/header.html:48
#: src/web/templates/web/header.html:116
#: src/web/templates/web/header.html:121
msgid "Log out"
msgstr "Logg ut"

Expand Down Expand Up @@ -2268,12 +2269,53 @@ msgstr "Endre regel for {machine_type}"
msgid "Image of {equipment}."
msgstr "Bilde av {equipment}."

#: src/makerspace/forms.py:20
msgid "I want to register my card after having attended the 3D-printing course"
msgstr "Jeg har deltatt på 3D-printerkurs, og vil registrere kortet mitt"

#: src/makerspace/forms.py:21
msgid "I want to register a new access card"
msgstr "Jeg vil registrere et nytt adgangskort"

#: src/makerspace/forms.py:22
msgid "I lost my access to the 3D-printing room, and I want to get it back"
msgstr ""
"Jeg har mistet tilgangen til 3D-printerrommet, og vil gjerne ha den tilbake"

#: src/makerspace/forms.py:27
msgid "Choose the situation that applies to you"
msgstr "Velg situasjonen som gjelder deg"

#: src/makerspace/forms.py:34
msgid "EM number"
msgstr "EM-nummer"

#: src/makerspace/models.py:31
msgid "If specified, the equipment is sorted ascending by this value."
msgstr "Hvis spesifisert, sorteres utstyret stigende på denne verdien."

#: src/makerspace/templates/makerspace/card_registration/card_registration.html:7
msgid "Register student or employee card"
msgstr "Registrer student- eller ansattkort"

#: src/makerspace/templates/makerspace/card_registration/card_registration.html:43
msgid "Update card information"
msgstr "Oppdater kortinformasjon"

#: src/makerspace/templates/makerspace/card_registration/card_registration.html:49
msgid ""
"Thank you for updating your card information. You should get access to the "
"3D-printing room in about two weeks."
msgstr ""
"Takk for at du oppdaterte kortinformasjonen din. Du vil få tilgang til 3D-"
"printerrommet om rundt to uker."

#: src/makerspace/templates/makerspace/card_registration/card_registration.html:52
msgid "Accept all cookies"
msgstr "Godta alle cookies"

#: src/makerspace/templates/makerspace/equipment/admin_equipment_list.html:15
#: src/makerspace/views.py:57
#: src/makerspace/views.py:62
msgid "Add equipment"
msgstr "Legg til utstyr"

Expand Down Expand Up @@ -2311,11 +2353,11 @@ msgstr "Regler"
msgid "you must follow these to be allowed to use the workshop"
msgstr "du må følge disse for å få tillatelse til å bruke verkstedet"

#: src/makerspace/views.py:48
#: src/makerspace/views.py:53
msgid "Admin page for equipment"
msgstr "Administrasjonsside for utstyr"

#: src/makerspace/views.py:63
#: src/makerspace/views.py:68
msgid "Change Equipment"
msgstr "Endre utstyr"

Expand Down Expand Up @@ -2892,7 +2934,7 @@ msgid "This ticket is registered to another account. Please"
msgstr "Denne billetten er knyttet til en annen bruker. Vennligst"

#: src/news/templates/news/event/ticket/event_ticket_detail.html:33
#: src/web/templates/web/header.html:124
#: src/web/templates/web/header.html:129
#: src/web/templates/web/login.html:12 src/web/templates/web/login.html:32
msgid "log in"
msgstr "logg inn"
Expand All @@ -2903,7 +2945,7 @@ msgstr "til den riktige brukeren for å se billetten din."

#: src/news/templates/news/event/ticket/event_ticket_my_list.html:6
#: src/news/templates/news/event/ticket/event_ticket_my_list.html:14
#: src/web/templates/web/header.html:112
#: src/web/templates/web/header.html:117
msgid "My tickets"
msgstr "Mine billetter"

Expand Down Expand Up @@ -3262,19 +3304,23 @@ msgstr "Makerverkstedet"
msgid "About"
msgstr "Om"

#: src/web/templates/web/header.html:70
#: src/web/templates/web/header.html:68
msgid "Printing room access"
msgstr "Tilgang til printerrommet"

#: src/web/templates/web/header.html:75
msgid "About us"
msgstr "Om oss"

#: src/web/templates/web/header.html:76
#: src/web/templates/web/header.html:81
msgid "Apply to MAKE"
msgstr "Søk verv"

#: src/web/templates/web/header.html:99
#: src/web/templates/web/header.html:104
msgid "Administration"
msgstr "Administrasjon"

#: src/web/templates/web/header.html:109
#: src/web/templates/web/header.html:114
msgid "Profile"
msgstr "Profil"

Expand Down
22 changes: 22 additions & 0 deletions src/makerspace/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django import forms
from django.utils.translation import gettext_lazy as _

from web.widgets import SemanticFileInput
from .models import Equipment
from users.models import User


class EquipmentForm(forms.ModelForm):
Expand All @@ -11,3 +13,23 @@ class Meta:
widgets = {
'image': SemanticFileInput(),
}


class CardNumberUpdateForm(forms.ModelForm):
access_options = [
('1', _("I want to register my card after having attended the 3D-printing course")),
('2', _("I want to register a new access card")),
('3', _("I lost my access to the 3D-printing room, and I want to get it back")),
]
action = forms.ChoiceField(
widget=forms.RadioSelect,
choices=access_options,
label=_("Choose the situation that applies to you")
)

class Meta:
model = User
fields = ['card_number']
labels = {
'card_number': _("EM number"),
}
51 changes: 51 additions & 0 deletions src/makerspace/static/makerspace/css/card_registration.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.card-registration-infotext {
text-align: justify;
}

#card-registration-form label {
font-weight: bold;
display: block;
margin: 2em 0;
}

#card-registration-form .radio label {
font-weight: normal;
margin: 0.5em 0;
}

#card-registration-form button {
display: block !important;
margin-top: 3em !important;
}

.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
position: absolute;
top: 50%;
left: 50%;
width: 35%;
transform: translate(-50%, -50%);
background-color: white;
padding: 30px;
border-radius: 10px;
}

@media screen and (max-width: 450px) {
.contentbox {
margin-left: unset !important;
margin-right: unset !important;
}

.modal-content {
width: 90%;
}
}
8 changes: 8 additions & 0 deletions src/makerspace/static/makerspace/js/card_registration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$(document).ready(function() {
if (window.location.search.includes('success=true')) {
$('#success-modal').fadeIn();
}
$('.card-registration-modal-button').on('click', function() {
$('#success-modal').fadeOut();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% extends 'web/base.html' %}
{% load static %}
{% load i18n %}
{% load thumbnail %}
{% load css_tags %}

{% block title %}{% translate "Register student or employee card" %}{% endblock title %}

{% block extra_head %}
<link rel="stylesheet" href="{% static 'contentbox/css/content_box_detail.css' %}"/>
<link rel="stylesheet" href="{% static 'makerspace/css/card_registration.css' %}"/>
{% include 'ckeditor/mathjax_render.html' %}
<script src="{% static 'makerspace/js/card_registration.js' %}"></script>
{% endblock extra_head %}

{% block padding_top %}
<div class="ui container">
<a class="{% if not perms.change_contentbox %}hidden{% endif %} edit-button ui make-bg-yellow button"
{% if perms.change_contentbox %}href="{% url 'content_box_update' contentbox.pk %}"{% endif %}
>
<i class="edit icon"></i>{% translate "Change" %}
</a>
</div>
{% endblock padding_top %}

{% block body %}
<div class="ui text container">
<h1>{{ contentbox.title }}</h1>
<div class="contentbox ui container">
<div class="word-breaking hyphenated card-registration-infotext">
{{ contentbox.content|safe }}
</div>
</div>
<form method="POST" id="card-registration-form">
{% csrf_token %}
{{ form.action.label_tag }}
<div class="radio">
{{ form.action }}
</div>
{{ form.card_number.label_tag }}
{{ form.card_number }}
<button type="submit" class="ui make-bg-yellow submit button">
{% translate "Update card information" %}
</button>
</form>
</div>
<div id="success-modal" class="modal">
<div class="modal-content">
<p>{% translate "Thank you for updating your card information. You should get access to the 3D-printing room in about two weeks." %}</p>
<form action="/">
<button type="submit" class="card-registration-modal-button ui right floated green submit button">
{% translate "Accept all cookies" %}{#Hilsen Maya#}
</button>
</form>
</div>
</div>
{% endblock body %}
2 changes: 1 addition & 1 deletion src/makerspace/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
path("", views.EquipmentListView.as_view(), name='equipment_list'),
path("<int:pk>/", views.EquipmentDetailView.as_view(), name='equipment_detail'),
]

urlpatterns = [
path("", views.MakerspaceView.as_view(url_name='makerspace'), name='makerspace'),
path("card-registration/", views.CardRegistrationView.as_view(), name='card_registration'),
path("equipment/", include(equipment_urlpatterns)),
ContentBoxDetailView.get_path('rules'),
]
Expand Down
Loading