New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete policy groups frontend parts #2526

Merged
merged 2 commits into from Apr 18, 2016
Jump to file or symbol
Failed to load files and symbols.
+10 −158
Diff settings

Always

Just for now

@@ -117,7 +117,6 @@
@import "views/_operational-field";
@import "views/_organisations";
@import "views/_people";
@import "views/_policy_groups";
@import "views/_publications";
@import "views/_search";
@import "views/_services-and-information";

This file was deleted.

Oops, something went wrong.
@@ -4,14 +4,12 @@ def index
end
def show
# Routes matching /policy/[ID] still fall through to Whitehall rather than
# government-frontend. We redirect them.
# Return 301 and redirect in case a URL uses the group's ID rather than slug
@policy_group = PolicyGroup.friendly.find(params[:id])
#return 301 and redirect in case a URL uses the group's ID rather than slug
if params[:id] != @policy_group.to_param
redirect_to @policy_group, status: :moved_permanently
else
@policies = @policy_group.published_policies
set_meta_description(@policy_group.summary)
end
end
end

This file was deleted.

Oops, something went wrong.
Copy path View file
@@ -142,6 +142,7 @@ def external_redirect(path_prefix, target)
resources :ministerial_roles, path: 'ministers', only: [:index, :show], localised: true
resources :people, only: [:index, :show], localised: true
# TODO: Remove `:show` when policy group paths can be otherwise generated

This comment has been minimized.

@gpeng

gpeng Mar 30, 2016

Contributor

Is there a 'plan' for this to happen?

resources :policy_groups, path: 'groups', only: [:index, :show]
resources :operational_fields, path: 'fields-of-operation', only: [:index, :show]
get 'world/organisations/:organisation_id/office' => redirect('/world/organisations/%{organisation_id}')
@@ -20,10 +20,10 @@ Feature: Policy groups
Background:
Given I am an editor
Scenario: Policy groups have their own page
Scenario: Policy groups appear in the public index
Given a policy group "ABC Advisories" exists
When I visit the policy group "ABC Advisories"
Then I should see the policy group "ABC Advisories"
When I visit the policy group index
Then I should see the policy group "ABC Advisories" in the index
Scenario:
Given a policy group "Panel" exists
@@ -2,17 +2,16 @@
create(:policy_group, name: group_name)
end
Then /^I should see the policy group "([^"]*)"$/ do |group_name|
Then /^I should see the policy group "([^"]*)" in the index$/ do |group_name|
assert page.has_text?(group_name)
end
Then /^I should see a link to the policy group "([^"]*)"$/ do |group_name|
assert page.has_css?('a', text: group_name)
end
When /^I visit the policy group "([^"]*)"$/ do |group_name|
group = PolicyGroup.where(name: group_name).first
visit policy_group_path(group)
When /^I visit the policy group index$/ do
visit policy_groups_path
end
When /^I delete the policy group "([^"]*)"$/ do |group_name|
@@ -33,5 +32,4 @@
group = PolicyGroup.find_by(name: group_name)
attachment = upload_pdf_to_policy_group(group)
insert_attachment_markdown_into_policy_group_description(attachment, group)
check_attachment_appears_on_policy_group(attachment, group)
end
@@ -11,11 +11,6 @@ def insert_attachment_markdown_into_policy_group_description(attachment, group)
fill_in 'Description', with: group.description.to_s + "\n\n" + markdown
click_button 'Save'
end
def check_attachment_appears_on_policy_group(attachment, group)
visit policy_group_path(group)
assert page_has_attachment?(attachment)
end
end
World(PolicyGroupHelper)
@@ -1,32 +1,6 @@
require 'test_helper'
require "gds_api/test_helpers/rummager"
class PolicyGroupsControllerTest < ActionController::TestCase
include GdsApi::TestHelpers::Rummager
setup do
rummager_has_no_policies_for_any_type
end
test "show sets meta description" do
policy_group = create(:policy_group, summary: 'my meta description')
get :show, id: policy_group
assert_equal 'my meta description', assigns(:meta_description)
end
view_test "should display the group's policies" do
policy_group = create(:policy_group)
rummager_has_policies_for_every_type
get :show, id: policy_group
assert_select ".policies" do
assert_select "a[href='/government/policies/welfare-reform']", text: "Welfare reform"
end
end
test "should redirect to the slug URL if a policy id is provided" do
policy_group = create(:policy_group)
ProTip! Use n and p to navigate between commits in a pull request.