Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #14 from alphagov/tag-descriptions

Import tag descriptions
  • Loading branch information...
commit 47bb62850c0f686bac1dd804486f12796b7d1e40 2 parents 5a25647 + 3ed2173
@KushalP KushalP authored
Showing with 22 additions and 175 deletions.
  1. +1 −1  Gemfile
  2. +2 −2 Gemfile.lock
  3. +19 −172 lib/tasks/migrate.rake
View
2  Gemfile
@@ -33,7 +33,7 @@ gem 'lograge'
if ENV['CONTENT_MODELS_DEV']
gem "govuk_content_models", path: '../govuk_content_models'
else
- gem "govuk_content_models", "0.5.1"
+ gem "govuk_content_models", "0.6.0"
end
if ENV['BUNDLE_DEV']
View
4 Gemfile.lock
@@ -118,7 +118,7 @@ GEM
json
gherkin (2.11.1)
json (>= 1.4.6)
- govuk_content_models (0.5.1)
+ govuk_content_models (0.6.0)
bson_ext
differ
gds-api-adapters
@@ -302,7 +302,7 @@ DEPENDENCIES
gds-sso (~> 1.2.0)
gds-warmup-controller (= 0.1.0)
gelf
- govuk_content_models (= 0.5.1)
+ govuk_content_models (= 0.6.0)
launchy
lograge
minitest
View
191 lib/tasks/migrate.rake
@@ -1,176 +1,23 @@
namespace :migrate do
- desc "Populate CuratedList with data extracted from text file in Rummager"
- task :populate_curated_list do
- Mongoid.load!("config/mongoid.yml")
-
- class CuratedList
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field "slug", type: String
- field "artefact_ids", type: Array, default: []
-
- index "slug"
-
- validates :slug, presence: true, uniqueness: true
- end
-
- class Artefact
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field "slug", type: String
- end
-
- curated_lists = {
- "neighbourhoods" => [
- "uk-online-centre-internet-access-computer-training",
- "organise-fete-street-party",
- "noise-pollution-road-train-plane",
- "control-dog-public",
- "report-litter",
- "report-abandoned-vehicle",
- "join-library",
- "garden-bonfires-rules",
- "find-out-about-local-park",
- "book-computer-at-library",
- "find-a-community-support-group-or-organisation",
- "check-drinking-water-quality"
- ],
- "housing" => [
- "housing-benefit",
- "council-tax-benefit",
- "council-housing",
- "apply-for-council-housing",
- "pay-council-tax",
- "council-tax-bands",
- "warm-front-scheme",
- "mortgage-rescue-scheme",
- "private-renting",
- "affordable-home-ownership-schemes",
- "tenancy-deposit-protection",
- "rubbish-collection-day",
- ],
- "crime-and-justice" => [
- "jury-service",
- "report-crime-anti-social-behaviour",
- "life-in-prison",
- "become-magistrate",
- "staying-in-touch-with-someone-in-prison",
- "legal-aid",
- "report-domestic-abuse",
- "courts",
- "pay-court-fine-online",
- "get-support-as-a-victim-of-crime",
- "arrested-your-rights",
- "going-to-court-victim-witness"
- ],
- "education" => [
- "apply-for-student-finance-2012-13",
- "student-finance-calculator",
- "school-term-holiday-dates",
- "national-curriculum",
- "find-nursery-school-place",
- "apply-for-primary-school-place",
- "apply-for-secondary-school-place",
- "career-development-loans",
- "1619-bursary-fund",
- "courses-qualifications",
- "grant-bursary-adult-learners",
- ],
- "work" =>[
- "find-job",
- "jobseekers-allowance",
- "calculate-redundancy-pay",
- "your-right-to-minimum-wage",
- "taking-annual-leave-your-rights",
- "employment-contracts-and-conditions",
- "redundant-your-rights",
- "statutory-sick-pay-ssp",
- "crb-criminal-records-bureau-check",
- "national-insurance-number",
- "statutory-maternity-pay",
- "looking-for-work-if-youre-disabled"
- ],
- "family" => [
- "order-copy-birth-death-marriage-certificate",
- "register-birth",
- "divorce",
- "after-a-death",
- "register-offices",
- "marriages-civil-partnerships",
- "wills-probate-inheritance",
- "maternity-allowance",
- "carers-allowance",
- "qualify-tax-credits-quick-questionnaire",
- "paternityleave",
- "find-before-after-school-childcare",
- ],
- "money-and-tax" => [
- "benefits-calculator",
- "income-support",
- "national-insurance",
- "claim-tax-credits",
- "tax-credits-calculator",
- "crisis-loans",
- "dla-disability-living-allowance-guide",
- "state-pension",
- "file-your-self-assessment-tax-return",
- "community-care-grant",
- "income-tax-rates",
- "pension-credit",
- ],
- "driving" => [
- "car-tax-disc-vehicle-licence",
- "calculate-vehicle-tax-rates",
- "book-a-driving-theory-test",
- "book-practical-driving-test",
- "change-address-driving-licence",
- "check-mot-status-vehicle",
- "vehicle-tax-rate-tables",
- "apply-online-to-replace-a-driving-licence",
- "change-name-driving-licence",
- "apply-first-provisional-driving-licence",
- "change-photo-driving-licence",
- "apply-blue-badge",
- ],
- "travel" => [
- "apply-renew-passport",
- "plan-your-journey",
- "local-road-closures-diversions",
- "passport-quick",
- "hand-luggage-restrictions-at-uk-airports",
- "apply-renew-european-health-insurance-card",
- "free-bus-passes-in-england",
- "transport-disabled",
- "state-pension-if-you-retire-abroad",
- "moving-abroad",
- "bringing-food-animals-plants-into-uk"
- ],
- "life-in-the-uk" => [
- "petition-government",
- "search-local-archives",
- "register-to-vote",
- "bank-holidays",
- "becoming-a-british-citizen",
- "rights-disabled-person",
- "make-will",
- "volunteering",
- "equality-act-2010",
- "book-life-in-uk-test",
- "power-of-attorney",
- "organise-citizenship-ceremony-council",
- ]
+ desc "Add descriptions for section tags"
+ task :add_tag_descriptions => :environment do
+ descriptions = {
+ 'business' => 'Information about starting up and running a business in the UK, including help if you\'re self employed or a sole trader.',
+ 'crime-and-justice' => 'Simple information to help answer your questions on jury service, courts, sentencing, ASBOs and prisons.',
+ 'driving' => 'Book your driving test or renew your vehicle tax online, find out the legal requirements for buying, owning, importing or scrapping a car or motorcycle, and read about your rights and responsibilities as a driver.',
+ 'education' => 'Get help if you're at school, planning to go on to further or higher education, looking for training or interested in a student or career development loan.',
+ 'family' => 'Find out about the laws for getting married/civil partnerships, the process of divorce and separation, parental leave, how to adopt a child, and more.',
+ 'housing' => 'Your legal obligations and rights when renting, buying or owning a home, plus information about Council Tax, what to do if you\'re homeless and where to get help if you have a housing dispute.',
+ 'life-in-the-uk' => 'Becoming a British citizen, registering to vote, information about government and the monarchy in the UK, and how to raise an e-petition.',
+ 'money-and-tax' => 'Find out about pensions, benefits, and what to do if you have debts. Also includes a comprehensive section on tax, including how you pay it and which tax credits you're eligible for.',
+ 'neighbourhoods' => 'Report local problems like abandoned vehicles, litter and noise pollution and find out information about your community.',
+ 'travel' => 'Plan a journey in the UK, see where you can use your bus pass and find out what you need to do before going abroad.',
+ 'work' => 'Find out about your rights and responsibilities as an employee, the benefits that can help you get back into work, the National Minimum Wage and your holiday entitlement.'
}
- curated_lists.each do |list_slug, artefact_slugs|
- curated_list = CuratedList.create(slug: list_slug)
- # Do this the long-way-round to get ordering of items correct
- artefact_slugs.each do |artefact_slug|
- if artefact = Artefact.where(slug: artefact_slug).first
- curated_list.artefact_ids << artefact.id
- end
- end
- curated_list.save!
+ descriptions.each do |tag_id, description|
+ tag = Tag.where(tag_id: tag_id).first
+ tag.update_attributes!(description: description)
+ puts "Added description to tag: #{tag.tag_id}"
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.