|
| 1 | +<% pref_include_unpublished = user_prefs['include_unpublished'] %> |
| 2 | + |
| 3 | +<% if user_can?('update_resource_record') %> |
| 4 | + |
| 5 | + <% unless content_for?(:exports) %> |
| 6 | + <% content_for :exports do %> |
| 7 | + <%# ANW-1821 An alt approach to the submenu pattern used elsewhere where we are |
| 8 | + concerned with maximizing the clickable area for actionable dropdown menu |
| 9 | + items...instead of shifting .dropdown-item to the <a> child of the <li>, |
| 10 | + the parent <li> has .dropdown-item.dropdown-submenu and the <a> child is |
| 11 | + responsible for layout; there is so much logic built into the <li>s below |
| 12 | + for export needs that this alt approach was easiest. %> |
| 13 | + <li class="dropdown-item p-0 dropdown-submenu" id="download-ead-dropdown" data-download-ead-url="<%= url_for(:controller => :exports, |
| 14 | + :action => :download_ead, :id => @resource.id, :include_unpublished => "${include_unpublished}", |
| 15 | + :include_daos => "${include_daos}", :include_uris => "${include_uris}", :numbered_cs => "${numbered_cs}", :ead3 => "${ead3}" )%>"> |
| 16 | + <%# The following <a> triggers a download on click and shows the sub dropdown menu |
| 17 | + below it on hover; the sub dropdown menu repositions weirdly (via popper.js) |
| 18 | + after the download in the same page session, so `data-display="static"` is |
| 19 | + added to disable popper.js involvement. %> |
| 20 | + <a href="#" data-toggle="dropdown" data-display="static" class="py-1 px-4 d-block text-decoration-none menu-with-options download-ead-action" title="<%= t("actions.export_ead") %>"><%= t("actions.export_ead") %></a> |
| 21 | + <div class="dropdown-menu" id="form_download_ead"> |
| 22 | + <fieldset class="d-flex flex-column"> |
| 23 | + <input type="hidden" name="id", value="<%= @resource.id %>" /> |
| 24 | + <label class="checkbox" for="include-unpublished"> |
| 25 | + <input type="checkbox" id="include-unpublished" name="include_unpublished" <% if pref_include_unpublished %> checked="checked" <% end %>/> |
| 26 | + <%= t("export_options.include_unpublished") %> |
| 27 | + </label> |
| 28 | + <label class="checkbox" for="include-daos"> |
| 29 | + <input type="checkbox" id="include-daos" name="include_daos" checked="checked"/> |
| 30 | + <%= t("export_options.include_daos") %> |
| 31 | + </label> |
| 32 | + <label class="checkbox" for="include-uris"> |
| 33 | + <input type="checkbox" id="include-uris" name="include_uris" checked="checked"/> |
| 34 | + <%= t("export_options.include_uris") %> |
| 35 | + </label> |
| 36 | + <label class="checkbox" for="numbered-cs"> |
| 37 | + <input type="checkbox" id="numbered-cs" name="numbered_cs" checked="checked"/> |
| 38 | + <%= t("export_options.numbered_cs") %> |
| 39 | + </label> |
| 40 | + <%# EAD3 %> |
| 41 | + <label class="checkbox" for="ead3"> |
| 42 | + <input type="checkbox" id="ead3" name="ead3" /> |
| 43 | + <%= t("export_options.ead3") %> |
| 44 | + </label> |
| 45 | + <%# END - EAD3 %> |
| 46 | + </fieldset> |
| 47 | + </div> |
| 48 | + </li> |
| 49 | + |
| 50 | + <li class="dropdown-item p-0 dropdown-submenu" id="download-marc-dropdown" data-download-marc-url="<%= url_for(:controller => :exports, :action => :download_marc, :id => @resource.id, :include_unpublished_marc => "${include_unpublished_marc}")%>"> |
| 51 | + <a href="#" data-toggle="dropdown" data-display="static" class="py-1 px-4 d-block text-decoration-none menu-with-options download-marc-action" title="<%= t("actions.export_marc") %>"><%= t("actions.export_marc") %></a> |
| 52 | + <div class="dropdown-menu" id="form_download_marc"> |
| 53 | + <fieldset> |
| 54 | + <input type="hidden" name="id", value="<%= @resource.id %>" /> |
| 55 | + <label class="checkbox" for="include-unpublished-marc"> |
| 56 | + <input type="checkbox" id="include-unpublished-marc" name="include_unpublished_marc" <% if pref_include_unpublished %> checked="checked" <% end %>/> |
| 57 | + <%= t("export_options.include_unpublished") %> |
| 58 | + </label> |
| 59 | + <%# END - MARC %> |
| 60 | + </fieldset> |
| 61 | + </div> |
| 62 | + </li> |
| 63 | + |
| 64 | + <li><%= link_to t("actions.container_labels"), {:controller => :exports, :action => :container_labels, :id => @resource.id}, :id => 'container-labels-link', :target => "_blank", :class => "dropdown-item" %></li> |
| 65 | + <li><%= link_to t("actions.container_template"), {:controller => :exports, :action => :container_template, :id => @resource.id}, :id => 'container-template-link', :target => "_self", :class => "dropdown-item" %></li> |
| 66 | + <li><%= link_to t("actions.digital_object_template"), {:controller => :exports, :action => :digital_object_template, :id => @resource.id}, :id => 'digital-object-template-link', :target => "_self", :class => "dropdown-item" %></li> |
| 67 | + <% if user_can?('create_job') %> |
| 68 | + <% if job_types['print_to_pdf_job']['create_permissions'].reject{|perm| user_can?(perm)}.empty? %> |
| 69 | + |
| 70 | + <li class="dropdown-item p-0 dropdown-submenu" id="print-to-pdf-dropdown" data-print-to-pdf-url="<%= url_for(:controller => :exports, :action => :print_to_pdf, :id => @resource.id, :include_unpublished => "${include_unpublished}", :include_uris => "${include_uris}")%>"> |
| 71 | + <a href="#" data-toggle="dropdown" data-display="static" class="py-1 px-4 d-block text-decoration-none menu-with-options print-to-pdf-action" title="<%= t("actions.print_to_pdf") %>"><%= t("actions.print_to_pdf") %></a> |
| 72 | + <div class="dropdown-menu" id="form_print_to_pdf"> |
| 73 | + <fieldset class="d-flex flex-column"> |
| 74 | + <label class="checkbox" for="include-unpublished-pdf"> |
| 75 | + <input type="checkbox" id="include-unpublished-pdf" <% if pref_include_unpublished %> checked="checked" <% end %> /> |
| 76 | + <%= t("export_options.include_unpublished") %> |
| 77 | + </label> |
| 78 | + <label class="checkbox" for="include-uris-pdf"> |
| 79 | + <input type="checkbox" id="include-uris-pdf" /> |
| 80 | + <%= t("export_options.include_uris") %> |
| 81 | + </label> |
| 82 | + </fieldset> |
| 83 | + </div> |
| 84 | + </li> |
| 85 | + |
| 86 | + <% end %> |
| 87 | + <% end %> |
| 88 | + <% end %> |
| 89 | + <% end %> |
| 90 | + |
| 91 | + <%= render_aspace_partial(:partial => '/shared/resource_toolbar', |
| 92 | + :locals => { |
| 93 | + :record_type => 'resource', |
| 94 | + :record => @resource, |
| 95 | + }) |
| 96 | + %> |
| 97 | +<% elsif user_can_view_only?('resource') %> |
| 98 | + <%= render_aspace_partial(:partial => '/shared/resource_toolbar', |
| 99 | + :locals => { |
| 100 | + :record_type => 'resource', |
| 101 | + :record => @resource, |
| 102 | + :view_only => true, |
| 103 | + }) |
| 104 | + %> |
| 105 | +<% end %> |
0 commit comments