-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Node version fixed * Remove package-lock.json * package-lock.json removed * Google ads conversion tracking second iteration. * Preview param bug fix * feature(organization designation): create new tag component * feature(organization designation): replace previous partial with new component * feature(organization designation): remove previous designation methods from org model --------- Co-authored-by: Alan Soto <[email protected]>
- Loading branch information
1 parent
7c3b5af
commit 446e35b
Showing
12 changed files
with
68 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<% if designation_map.any? %> | ||
<%= content_tag(:div, container_setup) do %> | ||
<% designation_map.each do |designation_name, designation_desc| %> | ||
<% tooltip_id = SecureRandom.hex(8) %> | ||
|
||
<div class="relative text-xs text-center"> | ||
<%# Pill %> | ||
<span class="block labelled-icon w-fit px-2 py-1 border rounded-lg bg-gray-8 text-gray-4" aria-labelledby="<%= tooltip_id %>"> | ||
<%= designation_name %> | ||
</span> | ||
|
||
<%# Hover over %> | ||
<span | ||
role="tooltip" | ||
id="<%= tooltip_id %>" | ||
class="absolute hidden bottom-full right-1/2 py-1 px-3 mb-2 rounded-lg text-white transform translate-x-1/2 bg-gray-2 bg-opacity-90"> | ||
<%= designation_desc %> | ||
</span> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class DesignationTag::Component < ApplicationViewComponent | ||
attr_reader :organization, :container_options, :designation_map | ||
|
||
def initialize(organization, container_options: {}) | ||
@organization = organization.decorate | ||
@container_options = container_options | ||
build_designation_map | ||
end | ||
|
||
def container_setup | ||
setup = {class: "flex flex-wrap gap-2 mt-2"} | ||
|
||
setup.merge(container_options) do |_key, prev_value, new_value| | ||
"#{prev_value} #{new_value}" | ||
end | ||
end | ||
|
||
private | ||
|
||
def build_designation_map | ||
@designation_map = {} | ||
|
||
if ["nationwide", "internationally"].include? organization.scope_of_work | ||
designation_map[organization.scope_of_work.capitalize] = | ||
"Services offered #{organization.scope_of_work}" | ||
end | ||
|
||
if organization.volunteer_availability | ||
designation_map["Volunteer"] = "Volunteer opportunities available" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.