Skip to content

Commit

Permalink
- Change primary sponsor party to accept multiple values
Browse files Browse the repository at this point in the history
- Introduce member_parties method to apply the same change incrementally to member_party
- Remove some unused partials and methods
- Standardise member / member party combined partials with support for multiple parties
  • Loading branch information
j-corry committed Aug 23, 2024
1 parent 1cecfc6 commit 198965c
Show file tree
Hide file tree
Showing 48 changed files with 70 additions and 232 deletions.
6 changes: 5 additions & 1 deletion app/models/content_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def primary_sponsor
end

def primary_sponsor_party
get_first_from('primarySponsorParty_ses')
get_all_from('primarySponsorParty_ses')
end

def legislature
Expand Down Expand Up @@ -288,6 +288,10 @@ def member_party
get_first_from('memberParty_ses')
end

def member_parties
get_all_from('memberParty_ses')
end

def answering_member
get_first_from('answeringMember_ses')
end
Expand Down
4 changes: 0 additions & 4 deletions app/models/written_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ def answering_body
get_first_from('departmentPrinted_t')
end

def asking_or_tabling_member_party
fallback(get_first_from('tablingMemberParty_ses'), get_first_from('askingMemberParty_ses'))
end

def attachment
# this is the title of the attachment, rather than a link to the resource
# there can be multiple titles, all of which will be displayed
Expand Down
4 changes: 2 additions & 2 deletions app/views/search/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<% end %>
<% if Rails.env.development? %>
<%#= render 'search/fragments/data', data: @associated_object_data, title: 'Associated object data' %>
<%#= render 'search/fragments/data', data: @search_data.search, title: 'Search response' %>
<%= render 'search/fragments/data', data: @associated_object_data, title: 'Associated object data' %>
<%= render 'search/fragments/data', data: @search_data.search, title: 'Search response' %>
<%#= render 'search/fragments/data', data: @ses_data, title: 'SES results' %>
<%= render 'search/fragments/data', data: @search_data.facets, title: 'Facets' %>
<%#= render 'search/fragments/data', data: @top_level, title: 'Hierarchy top level types' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/search/preliminary_sentences/_edm.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
%span= " (primary sponsor)"
- else
%span= " (primary sponsor, "
%span>= search_link(object.primary_sponsor_party)
%span>= render 'search/fragments/list', items: object.primary_sponsor_party, terminator: '', singular: false
%span= ")"
- unless object.other_sponsors.blank?
%span>= render 'search/fragments/edm_sponsor_list', items: object.other_sponsors, terminator: '', singular: false
Expand Down
3 changes: 1 addition & 2 deletions app/views/search/results/_bill.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
<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 %>
<%= render 'search/results/item_details/member', member: object.member, member_party: object.member_parties %>
</div>
<div class="centre" id="secondary-person">

</div>
<div class="right" id="primary-group">
<%= render 'search/results/item_details/departments', departments: object.departments, hide_label: false %>
Expand Down
1 change: 0 additions & 1 deletion app/views/search/results/_command_paper.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</div>
</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 %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/search/results/_committee_proceeding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<div class="row">
<div class="three-panel">
<div class="left" id="primary-person">
<%= render 'search/results/item_details/lead_member', lead_member: object.lead_member, lead_member_party: object.lead_member_party %>
<%= render 'search/results/item_details/lead_members', lead_members: object.lead_members, lablel: "Lead Member" %>
</div>
<div class="centre" id="secondary-person">
<%= render 'search/results/item_details/answering_member', answering_member: object.answering_member, answering_member_party: nil, label: 'Answering Member' %>
<%= render 'search/results/item_details/answering_members', answering_members: object.answering_members, label: 'Answering Member' %>
</div>
<div class="right" id="primary-group">
<%= render 'search/results/item_details/departments', departments: object.departments, hide_label: true %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/search/results/_deposited_paper.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
<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: true %>
Expand Down
6 changes: 0 additions & 6 deletions app/views/search/results/_early_day_motion.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
<%= render 'search/results/item_details/primary_sponsor', primary_sponsor: object.primary_sponsor, primary_sponsor_party: object.primary_sponsor_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>
Expand Down Expand Up @@ -95,19 +93,15 @@
<% 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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
<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: true %>
Expand Down Expand Up @@ -80,21 +78,15 @@
<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">
Expand Down
7 changes: 0 additions & 7 deletions app/views/search/results/_european_material.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
</div>
</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>
Expand Down Expand Up @@ -81,21 +79,16 @@
<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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
<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: true %>
Expand Down Expand Up @@ -79,21 +77,15 @@
<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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<%= render 'search/results/item_details/corresponding_minister', corresponding_minister: object.corresponding_minister %>
</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: true %>
Expand Down Expand Up @@ -81,21 +80,15 @@
<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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
<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>
Expand Down Expand Up @@ -81,30 +78,20 @@
<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>
Expand Down
5 changes: 0 additions & 5 deletions app/views/search/results/_formal_proceeding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<%= render 'search/results/item_details/lead_member', lead_member: object.lead_member, lead_member_party: object.lead_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: true %>
Expand Down Expand Up @@ -88,20 +87,16 @@
<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? %>
Expand Down
6 changes: 0 additions & 6 deletions app/views/search/results/_grand_committee_proceeding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,24 @@
<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>
Expand Down
Loading

0 comments on commit 198965c

Please sign in to comment.