Skip to content

Commit

Permalink
Differentiate between different cases of editor voucher redemption
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Aug 17, 2024
1 parent 2538684 commit 0e728d4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
16 changes: 9 additions & 7 deletions app/views/vouchers/_redeem_editor_voucher.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<%= t('profile.become_editor', lecture: voucher.lecture.title) %>
<%= link_to redeem_voucher_path(params: { secure_hash: voucher.secure_hash }),
class: 'btn btn-primary',
method: :post,
remote: true do %>
<%= t('profile.redeem_voucher') %>
<% if current_user == voucher.lecture.teacher %>
<%= t('profile.teacher_cant_become_editor') %>
<% elsif current_user.in?(voucher.lecture.editors_by_redemption) %>
<%= t('profile.already_editor_by_redemption') %>
<% else %>
<%= redeem_voucher_button(voucher) %>
<% end %>
<%= link_to t('buttons.cancel'), cancel_voucher_path,
class: "btn btn-secondary ms-2", remote: true %>
<%= cancel_voucher_button %>
10 changes: 8 additions & 2 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2213,8 +2213,14 @@ de:
already_tutor_by_redemption: >
Du hast bereits einen Gutschein eingelöst, um TutorInnenstatus zu erhalten.
become_editor: >
Mit diesem Gutschein kannst Du EditorInnenrechte für die Veranstaltung
%{lecture} übernehmen.
Mit diesem Gutschein erhältst Du EditorInnenstatus für die Veranstaltung
%{lecture}.
already_editor_by_redemption: >
Du hast bereits einen Gutschein eingelöst, um EditorInnenstatus zu
erhalten.
teacher_cant_become_editor: >
Du kannst nicht zusätzlich EditorInnenstatus in einer Veranstaltung
erhalten, in der Du bereits DozentIn bist.
mampf_news:
title: 'MaMpf-News'
check_notifications: 'Alle erledigen'
Expand Down
9 changes: 7 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ en:
We have received your request and will send you your data as soon as possible.
redeem_voucher: Redeeem Voucher
become_tutor: >
With this voucher, you can obatin tutor status for the %{lecture}.
With this voucher, you can obtain tutor status for %{lecture}.
With that, editors for the event series can assign you tutorials.
If applicable, you can select the tutorials you will be responsible for
right here.
Expand All @@ -2085,7 +2085,12 @@ en:
already_tutor_by_redemption: >
You have already redeemed a tutor voucher for this event series.
become_editor: >
With this voucher, you can become an editor in the event series %{lecture}.
With this voucher, you can obtain editor status for %{lecture}.
already_editor_by_redemption: >
You have already redeemed an editor voucher for this event series.
teacher_cant_become_editor: >
You are already a teacher for this event series. Therefore, you cannot
redeem an editor voucher.
mampf_news:
title: 'MaMpf News'
check_notifications: 'Clear all'
Expand Down

0 comments on commit 0e728d4

Please sign in to comment.