From d658b2dbcde29a01739d548d04b634d44aba2435 Mon Sep 17 00:00:00 2001
From: Zarino Zappia
Date: Mon, 25 Jul 2016 15:03:54 +0100
Subject: [PATCH] Template logic for showing executive positions on term_table
cards
Part of #13297.
---
lib/person_cards.rb | 4 ++++
views/term_table.erb | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/lib/person_cards.rb b/lib/person_cards.rb
index 404710a7b..837fb383c 100644
--- a/lib/person_cards.rb
+++ b/lib/person_cards.rb
@@ -43,6 +43,10 @@ def memberships
person.memberships.where(legislative_period_id: term.id)
end
+ def positions
+ []
+ end
+
private
attr_reader :person, :term
diff --git a/views/term_table.erb b/views/term_table.erb
index 196d8b05c..101c80084 100644
--- a/views/term_table.erb
+++ b/views/term_table.erb
@@ -178,6 +178,24 @@
<% end %>
<% end %>
+
+
+ <% # TODO: populate :positions with executive branch positions, eg: "President" %>
+ <% person.positions.each do |pos| %>
+
+
+ <%= pos[:position] %>
+
+ <% if !pos[:start_date].to_s.empty? and !pos[:end_date].to_s.empty? %>
+ (<%= pos[:start_date].to_s %> to <%= pos[:end_date].to_s %>)
+ <% elsif !pos[:start_date].to_s.empty? %>
+ (from <%= pos[:start_date].to_s %>)
+ <% elsif !pos[:end_date].to_s.empty? %>
+ (until <%= pos[:end_date].to_s %>)
+ <% end %>
+
+ <% end %>
+
<% %i(bio social contacts identifiers).select { |s| person.send(s).any? }.each do |section| %>