Skip to content

Commit

Permalink
- Allow research material to be surfaced in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
j-corry committed Aug 29, 2024
1 parent 51aa798 commit 66ce57c
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/content_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def get_all_from(field_name)
def self.content_object_class(type_id, subtype_ids)
case type_id
when 363376
'NotSupported'
'ResearchMaterial'
when 90996
'Edm'
when 346697
Expand Down
14 changes: 14 additions & 0 deletions app/models/research_material.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class ResearchMaterial < ContentObject

def initialize(content_object_data)
super
end

def template
'search/objects/research_material'
end

def search_result_partial
'search/results/research_material'
end
end
131 changes: 131 additions & 0 deletions app/views/search/results/_research_material.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<div class="result-item">
<div class="row" id="title">
<%= format_object_title(object.object_title, @ses_data) %>
</div>

<div class="row" id="content">
<%#= render 'search/results/item_details/description', description: object.abstract_text %>
</div>

<div class="row">
<div class="three-panel">
<div class="left" id="primary-person">
<%#= render 'search/results/item_details/member', member: object.member, member_party: object.member_party %>
</div>
<div class="centre" id="secondary-person">
<%#= render 'search/results/item_details/member', member: object.member, member_party: object.member_party %>
</div>
<div class="right" id="primary-group">
<%#= render 'search/results/item_details/departments', departments: object.departments, hide_label: false %>
</div>
</div>
</div>

<div class="row">
<div class="three-panel">
<div class="left" id="type">
<%= render 'search/results/item_details/type', type: object.object_name %>
</div>
<div class="centre" id="status">

</div>
<div class="right" id="secondary-group">
</div>
</div>
</div>

<div <%= 'hidden' unless params[:show_detailed] == "true" %> class="row" id="detailed-view" data-detailed-results-target="toggleHidden">

<div class="row">
<div class="two-panel">
<div class="left" id="legislative-stage">
</div>
<div class="right" id="procedure">
</div>
</div>
</div>

<div class="row">
<div class="four-panel">
<div class="left-outer" id="specific-date-1">
</div>
<div class="left-inner" id="specific-date-2">
</div>
<div class="right-inner" id="specific-date-3">

</div>
<div class="right-outer" id="specific-date-4">

</div>
</div>
</div>

<div class="row">
<div id="coming-into-force">

</div>
</div>

<div class="row">
<div id="supplementary-content">

</div>
</div>

<div class="row">
<div id="corrected">

</div>
</div>

<% unless object.amendments.blank? %>
<% object.amendments.each do |amendment| %>
<div class="row">
<div class="two-panel">
<div class="left" id="amending-member">
<%#= render 'search/results/item_details/amended_by', primary_sponsor: amendment.dig(:primary_sponsor, :value) unless amendment.dig(:primary_sponsor, :value).blank? %>
</div>
<div class="right" id="amendment-date">
<%#= render 'search/results/item_details/amended_on', date_tabled: amendment.dig(:date_tabled, :value) unless amendment.dig(:date_tabled, :value).blank? %>
</div>
</div>
</div>
<% end %>
<% end %>
<%#= render 'search/results/item_details/legislation', legislation: object.legislation unless object.legislation.blank? %>
<%#= render 'search/results/item_details/witnesses', witnesses: object.witnesses unless object.witnesses.blank? %>
<%#= render 'search/results/item_details/subjects', subjects: object.subjects unless object.subjects.blank? %>
<%#= render 'search/results/item_details/topics', topics: object.topics unless object.topics.blank? %>
<%#= render 'search/results/item_details/notes', notes: object.notes unless object.notes.blank? %>
<% unless object.commons_library_location.blank? && object.lords_library_location.blank? %>
<div class="row">
<div class="two-panel">
<div class="left" id="commons-library-location">
<%#= render 'search/results/item_details/commons_library_location', location: object.commons_library_location unless object.commons_library_location.blank? %>
</div>
<div class="right" id="lords-library-location">
<%#= render 'search/results/item_details/lords_library_location', location: object.lords_library_location unless object.lords_library_location.blank? %>
</div>
</div>
</div>
<% end %>

</div>

<div class="row">
<div class="three-panel">
<div class="left" id="significant-date">
<%= render 'search/results/item_details/date', date: object.standard_date %>
</div>
<div class="centre" id="reference">
<%= render 'search/results/item_details/reference', reference: object.standard_reference %>
</div>
<div class="right" id="house">
<%= render 'search/results/item_details/legislature', legislature: object.legislature %>
</div>
</div>
</div>
</div>
<hr/>

0 comments on commit 66ce57c

Please sign in to comment.