Skip to content

Commit

Permalink
disable fields for non rvt leader users
Browse files Browse the repository at this point in the history
  • Loading branch information
SepsiLaszlo committed Dec 26, 2024
1 parent 11ab6d1 commit 2499971
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/controllers/entry_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def update

def review
authorize :entry_request, :review?
@rvt_leader = current_user.roles.rvt_leader?
@resorts = Group.where(id: Group::RESORTS).order(:name)
@entry_requests = EntryRequest.joins(:evaluation).includes(:group, :user).where('evaluations.semester': SystemAttribute.semester.to_s)
.where("entry_requests.entry_type != 'KDO' OR entry_requests.justification != NULL")
Expand Down
7 changes: 4 additions & 3 deletions app/views/entry_requests/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@
<div class="uk-form-row">
<%= form.label :entry_type, "Belépő", class: "uk-form-label uk-text-bold" %>
<%= form.select :entry_type, Rails.configuration.x.entry_types.map { |k, v| [v, k] }, {},
id: "entry-request-#{entry_request.id}-entry-type" %>
id: "entry-request-#{entry_request.id}-entry-type",
disabled: !@rvt_leader %>
<%= form.label :entry_type, "Végleges", class: "uk-form-label uk-text-bold uk-margin-left" %>
<%= form.check_box :finalized, id: "entry-request-#{entry_request.id}-finalized" %>
<%= form.check_box :finalized, id: "entry-request-#{entry_request.id}-finalized", disabled: !@rvt_leader %>
</div>
<div class="uk-form-row uk-form-stacked">
<%= form.label :justification, "Indoklás", class: "uk-form-label" %>
<%= form.text_area :justification, id: "entry-request-#{entry_request.id}-justification", class: "uk-width-1-1", style: "field-sizing: content;",
data: { id: entry_request.id, type: 'entry-request-justification' } %>
disabled: !@rvt_leader, data: { id: entry_request.id, type: 'entry-request-justification' } %>
</div>
<% end %>
<% end %>
Expand Down

0 comments on commit 2499971

Please sign in to comment.