Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show board members on their own page.

This follows directly from the changes with Ministers on organisation pages.
  • Loading branch information...
commit 7de3b44bb80e9c00160af15c1d569e6236496cfa 1 parent 1f6812f
@lazyatom lazyatom authored
View
6 app/controllers/organisations_controller.rb
@@ -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
View
1  app/views/organisations/_navigation.html.erb
@@ -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>
View
29 app/views/organisations/board_members.html.erb
@@ -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>
View
27 app/views/organisations/show.html.erb
@@ -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
1  config/routes.rb
@@ -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]
View
74 test/functional/organisations_controller_test.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.