-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from sul-dlss/add-component
Componentize facet hierarchy rendering
- Loading branch information
Showing
6 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/components/blacklight/hierarchy/facet_field_list_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<%= render(@layout.new(facet_field: @facet_field)) do |component| %> | ||
<% component.with(:label) do %> | ||
<%= @facet_field.label %> | ||
<% end %> | ||
<% component.with(:body) do %> | ||
<ul class="facet-hierarchy" role="tree"> | ||
<%= render_hierarchy %> | ||
</ul> | ||
<% end %> | ||
<% end %> |
11 changes: 11 additions & 0 deletions
11
app/components/blacklight/hierarchy/facet_field_list_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Blacklight | ||
module Hierarchy | ||
class FacetFieldListComponent < Blacklight::FacetFieldListComponent | ||
def render_hierarchy | ||
helpers.render_hierarchy(@facet_field.facet_field) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
<% Deprecation.warn(self, "Calling the blacklight/hierarchy/facet_hierarchy partial is " \ | ||
"deprecated and will be removed in blacklight-hierarchy 5.0. Replace the facet config for '#{facet_field.key}':\n\n\t" \ | ||
":partial => 'blacklight/hierarchy/facet_hierarchy'\n\nwith:\n\n\t" \ | ||
":component => Blacklight::Hierarchy::FacetFieldListComponent\n\n") %> | ||
<ul class="facet-hierarchy" role="tree"> | ||
<%= render_hierarchy(facet_field) %> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters