Permalink
Browse files

Show board members on their own page.

This follows directly from the changes with Ministers on organisation pages.
  • Loading branch information...
1 parent 1f6812f commit 7de3b44bb80e9c00160af15c1d569e6236496cfa @lazyatom lazyatom committed Feb 2, 2012
@@ -1,5 +1,6 @@
class OrganisationsController < PublicFacingController
- before_filter :load_organisation, only: [:show, :about, :contact_details, :news, :consultations, :ministers]
+ before_filter :load_organisation, only: [:show, :about, :contact_details, :news, :consultations,
+ :ministers, :board_members]
def index
@organisations_by_type = Organisation.in_listing_order.group_by(&:organisation_type)
@@ -36,6 +37,9 @@ def consultations
def ministers
end
+ def board_members
+ end
+
private
def load_organisation
@@ -5,4 +5,5 @@
<%= organisation_navigation_link_to 'Consultations', consultations_organisation_path(organisation) %>
<%= organisation_navigation_link_to 'Contact Details', contact_details_organisation_path(organisation) %>
<%= organisation_navigation_link_to 'Ministers', ministers_organisation_path(organisation) %>
+ <%= organisation_navigation_link_to 'Board Members', board_members_organisation_path(organisation) %>
</nav>
@@ -0,0 +1,29 @@
+<% page_title "#{@organisation.name} Board Members" %>
+<div class="g3f organisation">
+ <%= render 'header', organisation: @organisation, title: "#{@organisation.name} Board Members" %>
+
+ <div class="g3 page_detail">
+ <% if @organisation.board_member_roles.any? %>
+ <section id="board_members">
+ <% if @organisation.permanent_secretary_board_member_roles.any? %>
+ <section id="permanent_secretary_board_members">
+ <h1>Permanent secretaries</h1>
+ <%= render_list_of_roles(@organisation.permanent_secretary_board_member_roles, "permanent_secretary_board_member_roles") do |board_member_role| %>
+ <h3><%= board_member_role.name %></h3>
+ <p class="current_appointee"><%= board_member_role.current_person_name %></p>
+ <% end %>
+ </section>
+ <% end %>
+ <% if @organisation.other_board_member_roles.any? %>
+ <section id="other_board_members">
+ <h1>Other Board Members</h1>
+ <%= render_list_of_roles(@organisation.other_board_member_roles, "other_board_member_roles") do |board_member_role| %>
+ <h3><%= board_member_role.name %></h3>
+ <p class="current_appointee"><%= board_member_role.current_person_name %></p>
+ <% end %>
+ </section>
+ <% end %>
+ </section>
+ <% end %>
+ </div>
+</div>
@@ -73,30 +73,3 @@
</div>
<% end %>
</div>
-
-<div class="g3">
- <div class="g1 related_documents">
- <% if @organisation.board_member_roles.any? %>
- <section id="board_members">
- <% if @organisation.permanent_secretary_board_member_roles.any? %>
- <section id="permanent_secretary_board_members">
- <h1>Permanent secretaries</h1>
- <%= render_list_of_roles(@organisation.permanent_secretary_board_member_roles, "permanent_secretary_board_member_roles") do |board_member_role| %>
- <h3><%= board_member_role.name %></h3>
- <p class="current_appointee"><%= board_member_role.current_person_name %></p>
- <% end %>
- </section>
- <% end %>
- <% if @organisation.other_board_member_roles.any? %>
- <section id="other_board_members">
- <h1>Other Board Members</h1>
- <%= render_list_of_roles(@organisation.other_board_member_roles, "other_board_member_roles") do |board_member_role| %>
- <h3><%= board_member_role.name %></h3>
- <p class="current_appointee"><%= board_member_role.current_person_name %></p>
- <% end %>
- </section>
- <% end %>
- </section>
- <% end %>
- </div>
-</div>
View
@@ -45,6 +45,7 @@ def redirect(path)
get :consultations
get :contact_details, path: 'contact-details'
get :ministers
+ get :board_members, path: 'board-members'
end
end
resources :ministerial_roles, path: 'ministers', only: [:index, :show]
@@ -83,43 +83,6 @@ class OrganisationsControllerTest < ActionController::TestCase
refute_select "#consultations"
end
- test "shows leading board members associated with organisation" do
- permanent_secretary = create(:board_member_role, permanent_secretary: true)
- organisation = create(:organisation, board_member_roles: [permanent_secretary])
-
- get :show, id: organisation
-
- assert_select permanent_secretary_board_members_selector do
- assert_select_object(permanent_secretary)
- end
- end
-
- test "should not display an empty leading board members section" do
- junior = create(:board_member_role)
- organisation = create(:organisation, board_member_roles: [junior])
-
- get :show, id: organisation
-
- refute_select permanent_secretary_board_members_selector
- end
-
- test "shows board members associated with organisation" do
- permanent_secretary = create(:board_member_role)
- organisation = create(:organisation, board_member_roles: [permanent_secretary])
-
- get :show, id: organisation
-
- assert_select "#other_board_members" do
- assert_select_object(permanent_secretary)
- end
- end
-
- test "should not display an empty board members section" do
- organisation = create(:organisation)
- get :show, id: organisation
- refute_select "#other_board_members"
- end
-
test "should link to the child organisations" do
parent_organisation = create(:organisation)
child_organisation = create(:organisation, parent_organisations: [parent_organisation])
@@ -357,6 +320,43 @@ class OrganisationsControllerTest < ActionController::TestCase
assert_select "img[src*=blank-person.png]"
end
+ test "shows board members associated with organisation" do
+ permanent_secretary = create(:board_member_role)
+ organisation = create(:organisation, board_member_roles: [permanent_secretary])
+
+ get :board_members, id: organisation
+
+ assert_select "#other_board_members" do
+ assert_select_object(permanent_secretary)
+ end
+ end
+
+ test "shows leading board members associated with organisation" do
+ permanent_secretary = create(:board_member_role, permanent_secretary: true)
+ organisation = create(:organisation, board_member_roles: [permanent_secretary])
+
+ get :board_members, id: organisation
+
+ assert_select permanent_secretary_board_members_selector do
+ assert_select_object(permanent_secretary)
+ end
+ end
+
+ test "should not display an empty leading board members section" do
+ junior = create(:board_member_role)
+ organisation = create(:organisation, board_member_roles: [junior])
+
+ get :board_members, id: organisation
+
+ refute_select permanent_secretary_board_members_selector
+ end
+
+ test "should not display an empty board members section" do
+ organisation = create(:organisation)
+ get :board_members, id: organisation
+ refute_select "#other_board_members"
+ end
+
test "should display a list of organisations" do
organisation_1 = create(:organisation)
organisation_2 = create(:organisation)

0 comments on commit 7de3b44

Please sign in to comment.