UNC-Libraries/hy-c

View on GitHub
app/views/shared/_select_work_type_modal.html.erb

Summary

Maintainability
Test Coverage
<%# [hyc-override] Overriding partial in hyrax gem to change link for creating masters papers %>
<div class="modal worktypes fade" id="worktypes-to-create" tabindex="-1" role="dialog" aria-labelledby="select-worktype-label">
  <div class="modal-dialog" role="document">
    <form class="modal-content new-work-select">
      <div class="modal-header">
        <h2 class="modal-title" id="select-worktype-label"><%= t('hyrax.dashboard.heading_actions.select_type_of_work') %></h2>
        <button type="button" class="close" data-dismiss="modal" aria-label="<%= t('hyrax.dashboard.heading_actions.close') %>"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body">
        <fieldset>
          <% create_unrestricted_work_presenter.each do |row_presenter| %>
             <% if row_presenter.concern.to_s != 'Artwork' &&
              (current_user&.admin? || (row_presenter.concern.to_s != 'Dissertation' && row_presenter.concern.to_s != 'General')) %>
              <div class="select-worktype">
                <label>
                  <% if row_presenter.concern.to_s == 'MastersPaper' %>
                  <input type="radio" name="payload_concern" value="<%= row_presenter.concern %>"
                         data-single="<%= main_app.masters_papers_department_path(params: { add_works_to_collection: params[:add_works_to_collection]}) %>"
                         data-batch="<%= row_presenter.switch_to_batch_upload_path(route_set: hyrax, params: params) %>">
                  <% else %>
                  <input type="radio" name="payload_concern" value="<%= row_presenter.concern %>"
                         data-single="<%= row_presenter.switch_to_new_work_path(route_set: main_app, params: params) %>"
                         data-batch="<%= row_presenter.switch_to_batch_upload_path(route_set: hyrax, params: params) %>" />
                  <% end %>
                  <div class="select-work-icon">
                    <span class="<%= row_presenter.icon_class %>"></span>
                  </div>
                  <div class="select-work-description">
                    <h3 class="work-type-title"><%= row_presenter.name %></h3>
                    <p><%= row_presenter.description %></p>
                  </div>
                </label>
            </div>
            <% end %>
          <% end %>
        </fieldset>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal"><%= t('hyrax.dashboard.heading_actions.close') %></button>
        <input type="submit" class="btn btn-primary" value="<%= t('hyrax.dashboard.heading_actions.create_work') %>" />
      </div>
    </form>
  </div>
</div>