UNC-Libraries/hy-c

View on GitHub
app/views/records/edit_fields/_license.html.erb

Summary

Maintainability
Test Coverage
<%# [hyc-override] Overriding partial in hyrax gem in order to make license single-valued and add custom service %>
<% if params[:action] == 'edit' %>
  <%= f.input :license, as: :select,
              collection: CdrLicenseService.select(params[:controller],current_user&.admin?),
              include_blank: true,
              item_helper: CdrLicenseService.method(:include_current_value),
              input_html: { class: 'form-control' } %>
<% else %>
  <%= f.input :license, as: :select,
              collection: CdrLicenseService.select(params[:controller], current_user&.admin?),
              include_blank: true,
              item_helper: CdrLicenseService.method(:include_current_value),
              selected: CdrLicenseService.default_license(params[:controller]),
              input_html: { class: 'form-control' } %>
<% end %>