<% if current_page?(:controller => 'search', :action => 'search_boxed') %>
  <div class="results-more">
  <% if @results['total'] > 0 %>
    <% if Flipflop.enabled?(:local_browse) && @results['local_view_more'] %>
      <% view_more_url = @results['local_view_more'] %>
    <% elsif Flipflop.enabled?(:primo_search) %>
      <% view_more_url = @results['primo_ui_view_more'] %>
    <% else %>
      <% view_more_url = @results['eds_ui_view_more'] %>
    <% end %>
    <%= link_to(
      "View more #{view_more_text} results",
      view_more_url,
      data: {count: number_with_delimiter(@results['total']), type: 'view all results'}, class: "button button-primary #{ 'hidden' if @results['total'] <= @per_box }") %>
  <% else %>
    No results found.
  <% end %>
  </div>
<% end %>

<% if current_page?(:controller => 'search', :action => 'search_boxed') %>
  <div class="results-more">
  <% if @results['total'] > 0 %>
    <% if Flipflop.enabled?(:local_browse) && @results['local_view_more'] %>
      <% view_more_url = @results['local_view_more'] %>
    <% elsif Flipflop.enabled?(:primo_search) && (params[:target] == ENV.fetch('PRIMO_BOOK_SCOPE') || params[:target] == ENV.fetch('PRIMO_ARTICLE_SCOPE')) %>
      <% view_more_url = @results['primo_ui_view_more'] %>
    <% else %>
      <% view_more_url = @results['eds_ui_view_more'] %>
    <% end %>
    <%= link_to(
      "View more #{view_more_text} results",
      view_more_url,
      data: {count: number_with_delimiter(@results['total']), type: 'view all results'}, class: "button button-primary #{ 'hidden' if @results['total'] <= @per_box }") %>
  <% else %>
    No results found.
  <% end %>
  </div>
<% end %>

Fix 'view more results' URLs when Primo searches are enabled
Fix 'view more results' URLs when Primo searches are enabled

Why these changes are being introduced:

The 'view more' links for website/Google and ArchivesSpace searches break
when the Primo feature flag is toggled due to a flawed conditional in
the view_all_links partial.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/IMP-2240

How this addresses that need:

This adjusts the aforementioned conditional to check if the Primo feature
flag is enabled AND if the target param is equal to one of the two Primo
targets.

Side effects of this change:

None.
