Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show the top civil servant for an organisation.
As with top minister, this can be evolved.
  • Loading branch information
lazyatom committed Feb 2, 2012
1 parent f509020 commit 69d7894
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/website/organisations.scss
Expand Up @@ -71,7 +71,7 @@
}

#ministers {
li.ministerial_role {
li.ministerial_role, li.board_member_role {
position: relative;
padding-left: 60px;
h3 {
Expand Down
15 changes: 11 additions & 4 deletions app/views/organisations/show.html.erb
Expand Up @@ -13,14 +13,21 @@
</p>
</div>
<div class="g1">
<% roles = [@organisation.top_ministerial_role, @organisation.top_civil_servant].compact %>
<% if @organisation.ministerial_roles.any? %>
<section id="ministers">
<%= render_list_of_ministerial_roles([@organisation.top_ministerial_role]) do |ministerial_role| %>
<%= render_list_of_ministerial_roles(roles) do |role| %>
<div class="image_holder">
<%= image_for_ministerial_role(ministerial_role) %>
<%= image_for_ministerial_role(role) %>
</div>
<h3><%= link_to ministerial_role.name, ministerial_role %></h3>
<p class="current_appointee"><%= ministerial_role.current_person_name %></p>
<h3>
<% if role.is_a?(MinisterialRole) %>
<%= link_to role.name, role %>
<% else %>
<%= role.name %>
<% end %>
</h3>
<p class="current_appointee"><%= role.current_person_name %></p>
<% end %>
</section>
<% end %>
Expand Down
17 changes: 14 additions & 3 deletions features/step_definitions/organisation_steps.rb
Expand Up @@ -27,14 +27,20 @@
end
end

Given /^the "([^"]*)" organisation is associated with several ministers$/ do |organisation_name|
Given /^the "([^"]*)" organisation is associated with several ministers and civil servants$/ do |organisation_name|
organisation = Organisation.find_by_name(organisation_name) || create(:organisation, name: organisation_name)
3.times do
3.times do |x|
person = create(:person)
ministerial_role = create(:ministerial_role)
ministerial_role = create(:ministerial_role, cabinet_member: (x == 1))
organisation.ministerial_roles << ministerial_role
create(:role_appointment, role: ministerial_role, person: person)
end
3.times do |x|
person = create(:person)
role = create(:role, permanent_secretary: (x == 1))
organisation.roles << role
create(:role_appointment, role: role, person: person)
end
end

Given /^that "([^"]*)" is responsible for "([^"]*)" and "([^"]*)"$/ do |parent_org_name, child_org_1_name, child_org_2_name|
Expand Down Expand Up @@ -84,6 +90,11 @@
assert page.has_css?(record_css_selector(organisation.top_ministerial_role))
end

Then /^I should see the top civil servant for the "([^"]*)" organisation$/ do |name|
organisation = Organisation.find_by_name!(name)
assert page.has_css?(record_css_selector(organisation.top_civil_servant))
end

Then /^I should be able to view all ministers for the "([^"]*)" organisation on a separate page$/ do |name|
organisation = Organisation.find_by_name!(name)
navigate_to_organisation('ministers')
Expand Down
3 changes: 2 additions & 1 deletion features/viewing-organisations.feature
Expand Up @@ -12,9 +12,10 @@ Scenario: Organisation page should show consultations
Then I can see links to the consultations "More tea vicar?" and "Cake or biscuit?"

Scenario: Organisation page should show the top minister
Given the "Attorney General's Office" organisation is associated with several ministers
Given the "Attorney General's Office" organisation is associated with several ministers and civil servants
When I visit the "Attorney General's Office" organisation
Then I should see the top minister for the "Attorney General's Office" organisation
And I should see the top civil servant for the "Attorney General's Office" organisation
And I should be able to view all ministers for the "Attorney General's Office" organisation on a separate page

Scenario: A department is responsible for multiple agencies
Expand Down

0 comments on commit 69d7894

Please sign in to comment.