Skip to content

Commit

Permalink
Add base due date display to required report name for admins and libr…
Browse files Browse the repository at this point in the history
…ary reviewers
  • Loading branch information
Steven-Vargas committed Aug 9, 2024
1 parent 9482e1d commit a490afd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/concerns/hyrax/works_controller_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def create
def show
@user_collections = user_collections

if user_signed_in? && (current_user.admin? || current_user.library_reviewers?) && @presenter.required_report_name.first != 'Not Required'
@required_report_base_due_date = RequiredReportDueDate.find_by(submission_id: @presenter.id)&.base_due_date.to_s
end

respond_to do |wants|
wants.html { presenter && parent_presenter }
wants.json do
Expand Down
13 changes: 13 additions & 0 deletions app/views/hyrax/base/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,16 @@
</div>
</div>
</div>
<% if @required_report_base_due_date.present? %>
<script>
$(document).ready(function () {
let baseDueDate = "<%= @required_report_base_due_date %>";

// Find required_report_name element and append the base due date
$('.attribute-required_report_name').each(function() {
let originalText = $(this).text();
$(this).html(originalText + ' (Due Date: ' + baseDueDate + ')');
});
});
</script>
<% end %>

0 comments on commit a490afd

Please sign in to comment.