Skip to content

Commit

Permalink
Merge pull request #5061 from dodona-edu/enhancement/right-request
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere authored Oct 23, 2023
2 parents 21db4c0 + b298b58 commit 927894a
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 54 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/components/card.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ a.card-title-link:hover {
margin: 0;
font-weight: normal;
line-height: 1.1;

a {
color: var(--d-on-primary);
}
}

.card-title.card-subtitle {
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/rights_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def create

def approve
@rights_request.approve
@requests = policy_scope(RightsRequest.all)
respond_to do |format|
format.html { redirect_to rights_requests_path, notice: I18n.t('rights_requests.approve.approved') }
format.js
Expand All @@ -39,7 +38,6 @@ def approve

def reject
@rights_request.reject
@requests = policy_scope(RightsRequest.all)
respond_to do |format|
format.html { redirect_to rights_requests_path, notice: I18n.t('rights_requests.reject.rejected') }
format.js
Expand Down
40 changes: 0 additions & 40 deletions app/views/rights_requests/_requests_table.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/rights_requests/approve.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dodona.setHTMLExecuteScripts(document.querySelector("#requests-table-wrapper"), "<%= escape_javascript(render partial: 'requests_table', locals: { requests: @requests }) %>");
document.querySelector("#request_<%= @rights_request.id %> .card-actions").innerHTML = '<button class="btn btn-filled d-btn-success" disabled><%= t("rights_requests.index.approved") %></button>'
44 changes: 36 additions & 8 deletions app/views/rights_requests/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
<div class="row">
<div class="offset-md-1 col-md-10 col-12">
<div class="card">
<div class="card-title card-title-colored">
<h2 class="card-title-text"><%= t ".title" %></h2>
</div>
<div class="card-supporting-text" id="requests-table-wrapper">
<%= render partial: 'requests_table', locals: { requests: @requests } %>
<div class="page-subtitle justify-content-between">
<h3><%= @title %></h3>
</div>

<% @requests.each do |request| %>
<div class="col-lg-4 col-md-6 col-12">
<div class="card" id="request_<%= request.id %>">
<div class="card-title card-title-colored">
<h2 class="card-title-text">
<%= link_to request.user.full_name, request.user, target: "_blank", title: request.user.full_name, class: 'ellipsis-overflow' %>
</h2>
<h3 class="card-subtitle-text">
<%= link_to request.user.institution do %>
<% if request.institution_name.present? %>
<%= request.institution_name %>
<% elsif request.user.institution.generated_name %>
<i class="mdi mdi-alert colored-warning mdi-18"></i>
<%= t('.no_institution_provided') %>
<% else %>
<%= request.user.institution.name %>
<% end %>
<% end %>
</h3>
</div>
<div class="card-supporting-text" >
<%= request.context %>
</div>
<div class="card-actions card-border">
<%= link_to approve_rights_request_path(request), remote: true, method: :post, class: "btn btn-icon btn-icon-filled d-btn-success", title: t(".approve") do %>
<i class="mdi mdi-check"></i>
<% end %>
<%= link_to reject_rights_request_path(request), remote: true, method: :post, class: "btn btn-icon btn-icon-filled d-btn-danger", title: t(".reject"), data: {confirm: t("general.are_you_sure")} do %>
<i class="mdi mdi-close"></i>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
2 changes: 1 addition & 1 deletion app/views/rights_requests/reject.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dodona.setHTMLExecuteScripts(document.querySelector("#requests-table-wrapper"), "<%= escape_javascript(render partial: 'requests_table', locals: { requests: @requests }) %>");
document.querySelector("#request_<%= @rights_request.id %> .card-actions").innerHTML = '<button class="btn btn-filled d-btn-danger" disabled><%= t("rights_requests.index.rejected") %></button>'
3 changes: 2 additions & 1 deletion config/locales/views/rights_requests/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ en:
context_explanation: Some information about why you need these rights should go here...
index:
title: Teacher rights requests
requests_table:
approve: Approve
reject: Reject
no_institution_provided: Not provided
approved: Approved
rejected: Rejected
create:
created: Request for teacher rights successfully sent.
approve:
Expand Down
3 changes: 2 additions & 1 deletion config/locales/views/rights_requests/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ nl:
context_explanation: Schrijf hier wat info over waarom je deze rechten nodig hebt...
index:
title: Aanvragen voor lesgeversrechten
requests_table:
approve: Goedkeuren
reject: Afkeuren
no_institution_provided: Niet opgegeven
approved: Goedgekeurd
rejected: Afgekeurd
create:
created: Je aanvraag voor lesgeversrechten werd successvol verzonden.
approve:
Expand Down

0 comments on commit 927894a

Please sign in to comment.