<commit_before><%
# Displays a fulltext Umlaut response element in typical markup.
# Pass in a ServiceType object for the response using Rails partial
# :object or :collection convention
# optional argument, :locals =>
#    :show_source => default false, if true display the source of the link
show_source ||= false
service_response = fulltext_response_item # passed in via :object or :collection
# passed in in :object or :collection
view_data = service_response.view_data
institution_code = (view_data[:institution] || service_response.service.group)
# Set the authentcaition based on institution code
unless institution_code.nil? or (view_data[:authentication] and (not view_data[:authentication].blank?))
  service_response.service_data[:authentication] = case institution_code
    when "NYU" then "NYU access only"
    when "HSL" then "HSL access only"
    when "CU" then "Cooper Union access only"
    when "NS" then "New School access only"
    when "NYSID" then "NYSID access only"
  end
end
display_text = view_data[:display_text]
# Display 'NYU ebrary' if the URL is from NYU's ebrary.
# Masks the fact that the data does not come correct.
display_text = (/site.ebrary.com\/lib\/nyulibrary/ =~ view_data[:url]) ? "NYU ebrary" : display_text %>
<li class="response_item">
  <%- # Icon for link -%>
  <%= content_tag :i, nil %>
  <%- # Links -%>
  <% if view_data[:link_supports_ajax_call] %>
    <%-
      # Fancy schmancy ajax? But not if we're generating embed partials, won't work.
      # Generate a hyperlink that will call our standard service action
      # due to special class for unobtrusive JS.
    -%>
    <%= link_to(display_text, {controller: 'link_router', id: service_response.id},
      {id: "svctype_link_#{service_response.id}", target: "_blank", class: "ajax_window"}) %>
  <% elsif (content = response_content(view_data)) %>
    <%- #Collapsible content on page -%>
    <%= expand_contract_section(display_text, "svc_id_#{service_response.id}") do
      content_tag(:div, content, class: "umlaut-content-indent")
    end %>
  <% else %>
    <%- # Ordinary href link, with coverage roll up -%>
    <%= link_to({controller: 'link_router', id: service_response.id},
      {id: "svctype_link_#{service_response.id}", target: "_blank"}) do %>
       <%= coverage_summary(view_data) %>
       <%= display_text %>
    <% end %>
  <% end %>
  <%- # Which service did this come from? -%>
  <% if show_source %>
    <%= content_tag(:div, "from #{view_data[:source] || service_response.service.display_name}", class: "umlaut-link-source") %>
  <% end %>
  <%- # Show authentication before coverage since we have coverage roll-up -%>
  <% if view_data[:authentication].present? %>
    <%= content_tag(:div, view_data[:authentication], class: "response_authentication_instructions text-error") %>
  <% end %>
  <%- # Coverage -%>
  <% if view_data[:coverage].present? %>
    <%= content_tag(:div, view_data[:coverage], class: "response_coverage_statement") %><commit_msg>Update authorization text based on the fact that Umlaut 4 view data is immutable<commit_after><%
# Displays a fulltext Umlaut response element in typical markup.
# Pass in a ServiceType object for the response using Rails partial
# :object or :collection convention
# optional argument, :locals =>
#    :show_source => default false, if true display the source of the link
show_source ||= false
service_response = fulltext_response_item # passed in via :object or :collection
# passed in in :object or :collection
view_data = service_response.view_data
institution_code = (view_data[:institution] || service_response.service.group)
# Set the authentcaition based on institution code
authentication = view_data[:authentication]
unless (institution_code.blank? || authentication.present?)
  authentication = case institution_code
    when "NYU" then "NYU access only"
    when "HSL" then "HSL access only"
    when "CU" then "Cooper Union access only"
    when "NS" then "New School access only"
    when "NYSID" then "NYSID access only"
  end
end
display_text = view_data[:display_text]
# Display 'NYU ebrary' if the URL is from NYU's ebrary.
# Masks the fact that the data does not come correct.
display_text = (/site.ebrary.com\/lib\/nyulibrary/ =~ view_data[:url]) ? "NYU ebrary" : display_text %>
<li class="response_item">
  <%- # Icon for link -%>
  <%= content_tag :i, nil %>
  <%- # Links -%>
  <% if view_data[:link_supports_ajax_call] %>
    <%-
      # Fancy schmancy ajax? But not if we're generating embed partials, won't work.
      # Generate a hyperlink that will call our standard service action
      # due to special class for unobtrusive JS.
    -%>
    <%= link_to(display_text, {controller: 'link_router', id: service_response.id},
      {id: "svctype_link_#{service_response.id}", target: "_blank", class: "ajax_window"}) %>
  <% elsif (content = response_content(view_data)) %>
    <%- #Collapsible content on page -%>
    <%= expand_contract_section(display_text, "svc_id_#{service_response.id}") do
      content_tag(:div, content, class: "umlaut-content-indent")
    end %>
  <% else %>
    <%- # Ordinary href link, with coverage roll up -%>
    <%= link_to({controller: 'link_router', id: service_response.id},
      {id: "svctype_link_#{service_response.id}", target: "_blank"}) do %>
       <%= coverage_summary(view_data) %>
       <%= display_text %>
    <% end %>
  <% end %>
  <%- # Which service did this come from? -%>
  <% if show_source %>
    <%= content_tag(:div, "from #{view_data[:source] || service_response.service.display_name}", class: "umlaut-link-source") %>
  <% end %>
  <%- # Show authentication before coverage since we have coverage roll-up -%>
  <% if authentication.present? %>
    <%= content_tag(:div, authentication, class: "response_authentication_instructions text-error") %>
  <% end %>
  <%- # Coverage -%>
  <% if view_data[:coverage].present? %>
    <%= content_tag(:div, view_data[:coverage], class: "response_coverage_statement") %>
{'fraction_non_alphanumeric': 0.13564984964918142, 'fraction_numerical': 0.0001670564650851988, 'mean_word_length': 4.3029229406554474, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1784203', 'n_tokens_mistral': 1974, 'n_tokens_neox': 1861, 'n_words': 541}