Skip to content
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

Fix/correct new designation tag #515

Merged
merged 12 commits into from
Feb 13, 2024
8 changes: 4 additions & 4 deletions app/components/designation_tag/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 18 additions & 6 deletions app/decorators/organization_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading