Skip to content

Commit

Permalink
no empty sidebar, codesnippets only when dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
dnoneill committed Sep 4, 2024
1 parent b87598b commit 0df3b3c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
20 changes: 11 additions & 9 deletions app/components/document/sidebar_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<div class="bg-fog-light component-container rounded">
<% filtered_components = components.map{|component | render component }.uniq.compact_blank %>
<%= filtered_components.join('<hr style="border-top: dotted 1px;" />').html_safe if filtered_components.any? %>
<% tools = render_show_tools %>
<% if filtered_components.any? && tools.present? %>
<hr style="border-top: dotted 1px;" />
<% end %>
<%= tools %>
</div>
<% filtered_components = components.map{|component | render component }.uniq.compact_blank %>
<% tools = render_show_tools %>
<% if filtered_components.any? || tools.present? %>
<div class="bg-fog-light component-container rounded">
<%= filtered_components.join('<hr style="border-top: dotted 1px;" />').html_safe if filtered_components.any? %>
<% if filtered_components.any? && tools.present? %>
<hr style="border-top: dotted 1px;" />
<% end %>
<%= tools %>
</div>
<% end %>
<%= render AlsoAvailableComponent.new(document:) %>

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class CatalogController < ApplicationController
}
config.add_show_tools_partial :code_snippet_link, component: CodeSnippetLinkComponent,
if: proc { |_context, _config, options|
options[:document] &&
options[:document]&.dataset? &&
!options[:document].restricted?
}
config.show.document_actions.delete(:sms)
Expand Down
4 changes: 4 additions & 0 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def institution
fetch(Settings.FIELDS.PROVIDER, '')
end

def dataset?
fetch(Settings.FIELDS.RESOURCE_CLASS, []).include?('Datasets')
end

def contact_email
Settings.INSTITUTIONS.send(institution)&.email
end
Expand Down

0 comments on commit 0df3b3c

Please sign in to comment.