Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ViewComponent Slots v2 API #242

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<%= render(@layout.new(facet_field: @facet_field)) do |component| %>
<% component.label do %>
<% component.with_label do %>
<%= @facet_field.label %>
<% end %>

<% component.body do %>
<% component.with_body do %>
<div class="limit_content range_limit <%= @facet_field.key %>-config blrl-plot-config">
<% if @facet_field.selected_range_facet_item %>
<%= render BlacklightRangeLimit::RangeSegmentsComponent.new(facet_field: @facet_field, facet_items: [@facet_field.selected_range_facet_item], classes: ['current']) %>
Expand Down Expand Up @@ -37,7 +37,7 @@

<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: @facet_field, classes: @classes) %>

<%= more_link(key: @facet_field.key, label: @facet_field.label) unless @facet_field.in_modal? %>
<%= with_more_link(key: @facet_field.key, label: @facet_field.label) unless @facet_field.in_modal? %>

<% if @facet_field.missing_facet_item && !request.xhr? %>
<%= render BlacklightRangeLimit::RangeSegmentsComponent.new(facet_field: @facet_field, facet_items: [@facet_field.missing_facet_item], classes: ['missing', 'subsection']) %>
Expand Down
5 changes: 3 additions & 2 deletions spec/components/range_facet_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
instance_double(
BlacklightRangeLimit::FacetFieldPresenter,
key: 'key',
html_id: 'id',
active?: false,
collapsed?: false,
in_modal?: false,
Expand All @@ -30,7 +29,8 @@
range_config: {},
modal_path: nil,
facet_field: facet_config,
**facet_field_params
**facet_field_params,
**extra_facet_field_params
)
end

Expand All @@ -39,6 +39,7 @@
end

let(:facet_field_params) { {} }
let(:extra_facet_field_params) { Blacklight::VERSION > '8' ? {} : { html_id: 'id' } }

before do
allow(component).to receive(:search_facet_path).and_return('/range/key')
Expand Down
5 changes: 3 additions & 2 deletions spec/components/range_form_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
end

let(:facet_field_params) { {} }
let(:extra_facet_field_params) { Blacklight::VERSION > '8' ? {} : { html_id: 'id' } }
let(:selected_range) { nil }
let(:search_params) { { another_field: 'another_value' } }

let(:facet_field) do
instance_double(
BlacklightRangeLimit::FacetFieldPresenter,
key: 'key',
html_id: 'id',
active?: false,
collapsed?: false,
in_modal?: false,
Expand All @@ -34,7 +34,8 @@
range_config: {},
modal_path: nil,
facet_field: facet_config,
**facet_field_params
**facet_field_params,
**extra_facet_field_params
)
end

Expand Down