Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Commit

Permalink
Merge pull request #63 from alphagov/move_browse_citizenship_passports
Browse files Browse the repository at this point in the history
Move passports subsection to new browse section
  • Loading branch information
dhwthompson committed Mar 12, 2013
2 parents ebe31b6 + f1c3672 commit 9b37baa
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ gem 'lograge', '~> 0.1.0'
if ENV['CONTENT_MODELS_DEV']
gem "govuk_content_models", path: '../govuk_content_models'
else
gem "govuk_content_models", "4.10.1"
gem "govuk_content_models", "4.10.2"
end

if ENV['BUNDLE_DEV']
Expand Down
36 changes: 18 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ GEM
factory_girl_rails (3.3.0)
factory_girl (~> 3.3.0)
railties (>= 3.0.0)
faraday (0.8.4)
faraday (0.8.6)
multipart-post (~> 1.1)
ffi (1.1.4)
gds-api-adapters (4.1.3)
Expand All @@ -120,7 +120,7 @@ GEM
htmlentities (~> 4)
kramdown (~> 0.13.3)
sanitize (= 2.0.3)
govuk_content_models (4.10.1)
govuk_content_models (4.10.2)
bson_ext
differ
gds-api-adapters
Expand All @@ -133,17 +133,17 @@ GEM
hike (1.2.1)
htmlentities (4.3.1)
httpauth (0.2.0)
i18n (0.6.1)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
jquery-ui-rails (3.0.1)
jquery-rails
railties (>= 3.1.0)
json (1.7.6)
jwt (0.1.5)
multi_json (>= 1.0)
json (1.7.7)
jwt (0.1.7)
multi_json (>= 1.5)
kgio (2.7.4)
kramdown (0.13.8)
launchy (2.1.2)
Expand Down Expand Up @@ -176,7 +176,7 @@ GEM
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (~> 0.0, >= 0.0.9)
metaclass (0.0.1)
mime-types (1.19)
mime-types (1.21)
minitest (3.3.0)
mocha (0.12.3)
metaclass (~> 0.0.1)
Expand All @@ -191,20 +191,20 @@ GEM
bundler (>= 1.0.0)
rails (>= 3.2.0)
railties (>= 3.2.0)
multi_json (1.3.7)
multipart-post (1.1.5)
multi_json (1.6.1)
multipart-post (1.2.0)
net-http-digest_auth (1.2.1)
net-http-persistent (2.7)
nokogiri (1.5.6)
ntlm-http (0.1.1)
null_logger (0.0.1)
oauth2 (0.8.0)
oauth2 (0.8.1)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.2)
omniauth (1.1.1)
omniauth (1.1.3)
hashie (~> 1.2)
rack
omniauth-gds (0.0.3)
Expand All @@ -216,12 +216,12 @@ GEM
polyglot (0.3.3)
quiet_assets (1.0.1)
railties (~> 3.1)
rack (1.4.3)
rack (1.4.5)
rack-accept (0.4.5)
rack (>= 0.4)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
Expand All @@ -242,7 +242,7 @@ GEM
thor (>= 0.14.6, < 2.0)
raindrops (0.10.0)
rake (10.0.3)
rdoc (3.12)
rdoc (3.12.2)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
Expand Down Expand Up @@ -277,14 +277,14 @@ GEM
state_machine (1.1.2)
therubyracer (0.9.10)
libv8 (~> 3.3.10)
thor (0.16.0)
tilt (1.3.3)
thor (0.17.0)
tilt (1.3.5)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
turn (0.9.6)
ansi
tzinfo (0.3.35)
tzinfo (0.3.37)
uglifier (1.2.7)
execjs (>= 0.3.0)
multi_json (~> 1.3)
Expand Down Expand Up @@ -326,7 +326,7 @@ DEPENDENCIES
gds-api-adapters (= 4.1.3)
gds-sso (= 3.0.0)
gelf
govuk_content_models (= 4.10.1)
govuk_content_models (= 4.10.2)
jquery-rails (= 2.0.2)
jquery-ui-rails (= 3.0.1)
launchy
Expand Down
27 changes: 27 additions & 0 deletions db/migrate/20130311165857_add_abroad_browse_category.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class AddAbroadBrowseCategory < Mongoid::Migration
def self.up
abroad_tag = Tag.create(
tag_type: "section",
title: "Passports, travel and living abroad",
tag_id: "abroad",
description: "Includes renewing passports and travel advice by country")

Tag.create(
tag_type: "section",
title: "Living abroad",
tag_id: "abroad/living-abroad",
parent_id: abroad_tag.tag_id,
description: "Includes tax, State Pension, benefits and UK government services abroad")

Tag.create(
tag_type: "section",
title: "Travel abroad",
tag_id: "abroad/travel-abroad",
parent_id: abroad_tag.tag_id,
description: "Includes the latest travel advice by country, finding a British embassy and getting help abroad")
end

def self.down
Tag.any_in(tag_id: ["abroad", "abroad/living-abroad", "abroad/travel-abroad"]).delete
end
end
28 changes: 28 additions & 0 deletions db/migrate/20130311170326_move_passports_to_abroad_category.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class MovePassportsToAbroadCategory < Mongoid::Migration
def self.up
tag = Tag.where(tag_type: "section", tag_id: "citizenship/passports").first
if tag
tag.tag_id = "abroad/passports"
tag.parent_id = "abroad"
tag.save!
end

curated_list = CuratedList.any_in(tag_ids: ["citizenship/passports"]).first
if curated_list
curated_list.slug = tag_id_as_curated_list_slug("abroad/passports")
curated_list.tag_ids = ["abroad/passports"]
curated_list.save!
end

artefacts = Artefact.any_in(tag_ids: ["citizenship/passports"])
artefacts.each do |artefact|
artefact.section_ids = artefact.section_ids - ["citizenship/passports"]
artefact.section_ids = artefact.section_ids + ["abroad/passports"]
artefact.save!
end
end

def self.tag_id_as_curated_list_slug(tag_id)
tag_id.gsub(%r{/}, "-")
end
end

0 comments on commit 9b37baa

Please sign in to comment.