-
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.
Feature | Donate and Volunteer buttons (#481)
* Volunteery attribute * Donate and volunteer bottons * Add instructions * Decorate urls * Add validations for donation and volunteer urls * Refactor (Volunteer and donate buttons): Clean up. Abstracted all buttons into a partial. --------- Co-authored-by: Josue Granados <[email protected]>
- Loading branch information
1 parent
a9d999f
commit a3682c2
Showing
16 changed files
with
118 additions
and
22 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
class OrganizationDecorator < ApplicationDecorator | ||
delegate_all | ||
|
||
def donation_link | ||
object.decorate.url(object.donation_link) | ||
end | ||
|
||
def volunteer_link | ||
object.decorate.url(object.volunteer_link) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
div class=local_assigns[:container_styles] | ||
- if local_assigns[:location].organization.donation_link.present? | ||
= content_tag(\ | ||
:a,\ | ||
href: local_assigns[:location].organization.decorate.donation_link,\ | ||
class: "centered-flex w-full gap-2 py-3 border-0 rounded-md font-bold transition-colors text-indigo-700 bg-indigo-100 hover:bg-indigo-200",\ | ||
target: "_blank",\ | ||
) do | ||
= image_tag "donate-icon.svg", class: "w-7 h-7" | ||
| Donate | ||
|
||
- if local_assigns[:location].organization.volunteer_availability? && local_assigns[:location].organization.volunteer_link.present? | ||
= content_tag(\ | ||
:a,\ | ||
href: local_assigns[:location].organization.decorate.volunteer_link,\ | ||
class: "centered-flex w-full gap-2 p-3 border-0 rounded-md font-bold transition-colors text-indigo-700 bg-seafoam hover:bg-electric-teal",\ | ||
target: "_blank"\ | ||
) do | ||
= image_tag "volunteer-icon.svg", class: "w-7 h-7" | ||
| Volunteer | ||
|
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 |
---|---|---|
|
@@ -115,10 +115,9 @@ div class="" | |
- if @location.social_media.present? | ||
div class="border-t border-gray-8 my-7" | ||
= render SocialMedia::Component.new(social_media: @location.social_media) | ||
- if @location.organization.donation_link.present? | ||
div class="border-t border-gray-8 my-7" | ||
a href[email protected]_link class="flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-indigo-700 bg-indigo-100 hover:bg-indigo-200" target="_blank" | ||
| Donate | ||
// Donate and volunteer links | ||
- if has_donation_or_volunteer_link?(@location) | ||
= render "locations/donate_volunteer_buttons", location: @location, container_styles: "flex flex-col gap-y-4 pt-7 border-t border-gray-8" | ||
|
||
- if @location.youtube_video_link.present? | ||
div class="flex flex-col items-center p-5 text-center" | ||
|
@@ -157,8 +156,11 @@ div class="" | |
| - | ||
| #{@location.decorate.closed_office_hours_display} | ||
|
||
|
||
// Aside Section | ||
div class="flex-col flex-grow-0 hidden w-full bg-white rounded h-min-content sm:flex md:max-w-402px px-11 md:p-7" | ||
- if has_donation_or_volunteer_link?(@location) | ||
= render "locations/donate_volunteer_buttons", location: @location, container_styles: "flex flex-col gap-y-4 pb-7 mb-7 border-b border-gray-8" | ||
|
||
h3 class="text-sm font-bold uppercase mb-3.5" | ||
| Causes | ||
= render CausesList::Component.new( \ | ||
|
@@ -185,7 +187,3 @@ div class="" | |
- if @location.social_media.present? | ||
div class="border-t border-gray-8 my-7" | ||
= render SocialMedia::Component.new(social_media: @location.social_media) | ||
- if @location.organization.donation_link.present? | ||
div class="border-t border-gray-8 my-7" | ||
a href[email protected]_link class="flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-indigo-700 bg-indigo-100 hover:bg-indigo-200" target="_blank" | ||
| Donate |
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
5 changes: 5 additions & 0 deletions
5
db/migrate/20231006165935_add_volunteer_link_to_organizations.rb
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,5 @@ | ||
class AddVolunteerLinkToOrganizations < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :organizations, :volunteer_link, :string | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.