diff --git a/app/components/designation_tag/component.rb b/app/components/designation_tag/component.rb index 1d808568d..65897b5bc 100644 --- a/app/components/designation_tag/component.rb +++ b/app/components/designation_tag/component.rb @@ -2,7 +2,7 @@ class DesignationTag::Component < ApplicationViewComponent attr_reader :organization, :container_options, :designation_map def initialize(organization, container_options: {}) - @organization = organization.decorate + @organization = organization @container_options = container_options build_designation_map end @@ -19,10 +19,10 @@ def container_setup def build_designation_map @designation_map = {} + designation_copies = organization.decorate.designation_copies - if ["nationwide", "internationally"].include? organization.scope_of_work - designation_map[organization.scope_of_work.capitalize] = - "Services offered #{organization.scope_of_work}" + if ["National", "International"].include? organization.scope_of_work + designation_map[designation_copies[:tag_copy]] = "Services offered #{designation_copies[:desc_copy]}" end if organization.volunteer_availability diff --git a/app/decorators/organization_decorator.rb b/app/decorators/organization_decorator.rb index 153ec4b88..850d39062 100644 --- a/app/decorators/organization_decorator.rb +++ b/app/decorators/organization_decorator.rb @@ -9,11 +9,23 @@ def volunteer_link object.decorate.url(object.volunteer_link) end - def scope_of_work - { - "National" => "nationwide", - "International" => "internationally", - "Regional" => "locally" - }[object.scope_of_work] + def designation_copies + case object.scope_of_work + when "National" + { + tag_copy: "Nationwide", + desc_copy: "nationwide" + } + when "International" + { + tag_copy: "International", + desc_copy: "internationally" + } + when "Regional" + { + tag_copy: "Regional", + desc_copy: "locally" + } + end end end