Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/bundler/phonelib-0.8.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mononoken authored Jun 8, 2024
2 parents 1fa5560 + db47204 commit 56d770b
Show file tree
Hide file tree
Showing 87 changed files with 898 additions and 412 deletions.
56 changes: 55 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,61 @@
"contributions": [
"code"
]
}
},
{
"login": "Naraveni",
"name": "Naraveni",
"avatar_url": "https://avatars.githubusercontent.com/u/170462097?v=4",
"profile": "https://github.com/Naraveni",
"contributions": [
"code"
]
},
{
"login": "maebeale",
"name": "maebeale",
"avatar_url": "https://avatars.githubusercontent.com/u/7607813?v=4",
"profile": "https://github.com/maebeale",
"contributions": [
"review"
]
},
{
"login": "meg-gutshall",
"name": "Meg Gutshall",
"avatar_url": "https://avatars.githubusercontent.com/u/37842352?v=4",
"profile": "https://meghangutshall.com/",
"contributions": [
"code"
]
},
{
"login": "jaxonavena",
"name": "Jaxon",
"avatar_url": "https://avatars.githubusercontent.com/u/89274915?v=4",
"profile": "https://github.com/jaxonavena",
"contributions": [
"code"
]
},
{
"login": "alexanderc360",
"name": "Alex Cohen",
"avatar_url": "https://avatars.githubusercontent.com/u/33144250?v=4",
"profile": "https://github.com/alexanderc360",
"contributions": [
"code"
]
},
{
"login": "sevilla",
"name": "Kristine Sevilla",
"avatar_url": "https://avatars.githubusercontent.com/u/1185489?v=4",
"profile": "https://github.com/sevilla",
"contributions": [
"code"
]
},
],
"contributorsPerLine": 7,
"skipCi": true,
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ GEM
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.3.1)
faker (3.4.1)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pet Rescue Adoption Application
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-44-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-46-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

The Pet Rescue app is derived from the [Baja Pet Rescue Dog Adoption Application](https://github.com/kasugaijin/baja-pet-rescue/tree/main) created by @kasugaijin who wanted to give back to the grassroots organization from where he adopted his dog in Mexico by building them a web application. Pet Rescue is an application that makes it easy to connect shelters with people who are looking to adopt or foster pets.
Expand Down Expand Up @@ -272,6 +272,12 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Tacabr0n"><img src="https://avatars.githubusercontent.com/u/158373986?v=4?s=100" width="100px;" alt="Tacabr0n"/><br /><sub><b>Tacabr0n</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=Tacabr0n" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://jamey-alea.com"><img src="https://avatars.githubusercontent.com/u/8495523?v=4?s=100" width="100px;" alt="Jamey Alea"/><br /><sub><b>Jamey Alea</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=jameybash" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Naraveni"><img src="https://avatars.githubusercontent.com/u/170462097?v=4?s=100" width="100px;" alt="Naraveni"/><br /><sub><b>Naraveni</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=Naraveni" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/maebeale"><img src="https://avatars.githubusercontent.com/u/7607813?v=4?s=100" width="100px;" alt="maebeale"/><br /><sub><b>maebeale</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/pulls?q=is%3Apr+reviewed-by%3Amaebeale" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://meghangutshall.com/"><img src="https://avatars.githubusercontent.com/u/37842352?v=4?s=100" width="100px;" alt="Meg Gutshall"/><br /><sub><b>Meg Gutshall</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=meg-gutshall" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jaxonavena"><img src="https://avatars.githubusercontent.com/u/89274915?v=4?s=100" width="100px;" alt="Jaxon"/><br /><sub><b>Jaxon</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=jaxonavena" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/alexanderc360"><img src="https://avatars.githubusercontent.com/u/33144250?v=4?s=100" width="100px;" alt="Alex Cohen"/><br /><sub><b>Alex Cohen</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=alexanderc360" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sevilla"><img src="https://avatars.githubusercontent.com/u/1185489?v=4?s=100" width="100px;" alt="Kristine Sevilla"/><br /><sub><b>Kristine Sevilla</b></sub></a><br /><a href="https://github.com/rubyforgood/pet-rescue/commits?author=sevilla" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/organization_scopable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module OrganizationScopable

def set_tenant
if Current.organization.blank?
redirect_to root_path, alert: "Organization not found."
redirect_to root_path, alert: t("general.organization_not_found")
else
set_current_tenant(Current.organization)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def create

if @application.save
redirect_to adoptable_pet_path(@application.pet),
notice: "Application submitted! #{MessagesHelper.affirmations.sample}"
notice: t(".success", message: MessagesHelper.affirmations.sample)

# mailer
@org_staff = User.organization_staff(@pet.organization_id)
Expand All @@ -26,7 +26,7 @@ def create
.new_adoption_application.deliver_now
else
redirect_to adoptable_pet_path(@pet),
alert: "Error. Please try again."
alert: t(".error")
end
end

Expand All @@ -35,7 +35,7 @@ def update
if @application.update(application_params)
redirect_to adopter_fosterer_adopter_applications_path
else
redirect_to adopter_fosterer_profile_path, alert: "Error."
redirect_to adopter_fosterer_profile_path, alert: t(".error")
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def index
@user = current_user
@organization = Current.organization
@hide_footer = true
@application_count = @user.adopter_foster_account&.adopter_applications&.count.to_i

authorize! :adopter_foster_dashboard, context: {organization: @organization}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def create

respond_to do |format|
if @adopter_foster_profile.save
format.html { redirect_to adopter_fosterer_profile_path, notice: "Profile created" }
format.html { redirect_to adopter_fosterer_profile_path, notice: t(".success") }
else
format.html { render :new, status: :unprocessable_entity, alert: "Error" }
format.html { render :new, status: :unprocessable_entity, alert: t(".error") }
end
end
end
Expand All @@ -29,7 +29,7 @@ def edit
def update
respond_to do |format|
if @adopter_foster_profile.update(adopter_foster_profile_params)
format.html { redirect_to adopter_fosterer_profile_path, notice: "Profile updated" }
format.html { redirect_to adopter_fosterer_profile_path, notice: t(".success") }
else
format.html { render :edit, status: :unprocessable_entity }
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/organizations/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def purge
authorize! @attachment

@attachment.purge
redirect_to request.referrer, notice: "Attachment removed"
redirect_to request.referrer, notice: t(".success")
end

def purge_avatar
Expand All @@ -13,7 +13,7 @@ def purge_avatar

if current_user.avatar.id == @attachment.id
@attachment.purge
redirect_to request.referrer, notice: "Avatar removed"
redirect_to request.referrer, notice: t(".success")
else
redirect_to request.referrer, alert: t("errors.authorization_error")
end
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/organizations/staff/adopters_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Organizations::Staff::AdoptersController < Organizations::BaseController
layout "dashboard"

def index
authorize! AdopterFosterAccount, context: {organization: Current.organization}

@adopter_accounts = authorized_scope(AdopterFosterAccount.adopters)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def update
respond_to do |format|
if @application.update(application_params)
format.html { redirect_to staff_dashboard_index_path }
format.turbo_stream { flash.now[:notice] = "Application was successfully updated." }
format.turbo_stream { flash.now[:notice] = t(".success") }
else
format.html { render :edit, status: :unprocessable_entity }
format.turbo_stream { flash.now[:alert] = "Error updating application" }
format.turbo_stream { flash.now[:alert] = t(".error") }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def create
@task = DefaultPetTask.new(task_params)

if @task.save
redirect_to staff_default_pet_tasks_path, notice: "Default pet task saved successfully."
redirect_to staff_default_pet_tasks_path, notice: t(".success")
else
flash.now[:alert] = "Error creating default pet task."
flash.now[:alert] = t(".error")
render :new, status: :unprocessable_entity
end
end
Expand All @@ -28,7 +28,7 @@ def edit

def update
if @task.update(task_params)
redirect_to staff_default_pet_tasks_path, notice: "Default pet task updated successfully."
redirect_to staff_default_pet_tasks_path, notice: t(".success")
else
render :edit, status: :unprocessable_entity
end
Expand All @@ -37,7 +37,7 @@ def update
def destroy
@task.destroy

redirect_to staff_default_pet_tasks_path, notice: "Default pet task was successfully deleted."
redirect_to staff_default_pet_tasks_path, notice: t(".success")
end

private
Expand All @@ -51,7 +51,7 @@ def set_task

authorize! @task
rescue ActiveRecord::RecordNotFound
redirect_to staff_default_pet_tasks_path, alert: "Default Pet Task not found."
redirect_to staff_default_pet_tasks_path, alert: t(".error")
end

def context_authorize!
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/organizations/staff/faqs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def create
@faq = Faq.new(faq_params)

if @faq.save
redirect_to staff_faqs_url, notice: "FAQ was successfully created."
redirect_to staff_faqs_url, notice: t(".success")
else
render :new, status: :unprocessable_entity
end
Expand All @@ -38,20 +38,20 @@ def create
def update
respond_to do |format|
if @faq.update(faq_params)
format.html { redirect_to staff_faqs_url, notice: "FAQ was successfully updated." }
format.turbo_stream { flash.now[:notice] = "FAQ was successfully updated." }
format.html { redirect_to staff_faqs_url, notice: t(".success") }
format.turbo_stream { flash.now[:notice] = t(".success") }
else
format.html { render :edit, status: :unprocessable_entity }
format.turbo_stream { flash.now[:alert] = "Error updating FAQ" }
format.turbo_stream { flash.now[:alert] = t(".error") }
end
end
end

def destroy
@faq.destroy!
respond_to do |format|
format.html { redirect_to staff_faqs_url, notice: "FAQ was successfully deleted." }
format.turbo_stream { flash.now[:notice] = "FAQ was successfully deleted." }
format.html { redirect_to staff_faqs_url, notice: t(".success") }
format.turbo_stream { flash.now[:notice] = t(".success") }
end
end

Expand All @@ -62,7 +62,7 @@ def set_faq

authorize! @faq
rescue ActiveRecord::RecordNotFound
redirect_to staff_faqs_path, alert: "FAQ not found."
redirect_to staff_faqs_path, alert: t(".error")
end

def faq_params
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/organizations/staff/forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create
@form = organization.forms.new(form_params)

if @form.save
redirect_to staff_forms_path, notice: t(".saved")
redirect_to staff_forms_path, notice: t(".success")
else
flash.now[:alert] = t(".error")

Expand All @@ -32,7 +32,7 @@ def edit

def update
if @form.update(form_params)
redirect_to staff_forms_path, notice: t(".updated")
redirect_to staff_forms_path, notice: t(".success")
else
render :edit, status: :unprocessable_entity
end
Expand All @@ -41,7 +41,7 @@ def update
def destroy
@form.destroy

redirect_to staff_forms_path, notice: t(".destroyed")
redirect_to staff_forms_path, notice: t(".success")
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/organizations/staff/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create

if @user.save
@user.invite!(current_user)
redirect_to staff_staff_index_path, notice: "Invite sent!"
redirect_to staff_staff_index_path, notice: t(".success")
else
render "organizations/staff/staff_invitations/new", status: :unprocessable_entity
end
Expand All @@ -42,7 +42,7 @@ def create

if @user.save
@user.invite!(current_user)
redirect_to staff_fosterers_path, notice: "Invite sent!"
redirect_to staff_fosterers_path, notice: t(".success")
else
render "organizations/staff/fosterer_invitations/new", status: :unprocessable_entity
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def create
@foster = Match.new(match_params.merge(match_type: :foster))

if @foster.save
FosterMailer.reminder(@foster).deliver_later
redirect_to action: :index
else
@pets = Pet.fosterable.order(:name)
Expand Down Expand Up @@ -52,7 +53,7 @@ def edit

def update
if @foster.update(match_params)
flash[:success] = "Foster for #{@foster.pet.name} successfully updated."
flash[:success] = t(".success", @foster.pet.name)
redirect_to action: :index
else
render :edit, status: :unprocessable_entity
Expand All @@ -61,9 +62,8 @@ def update

def destroy
@foster.destroy

flash[:success] = "Foster for #{@foster.pet.name} deleted."
redirect_to action: :index, page: params[:page]
redirect_to request.referer
end

private
Expand Down
9 changes: 5 additions & 4 deletions app/controllers/organizations/staff/matches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ def create
))

if @match.save
AdoptionMailer.reminder(@match).deliver_later
@match.retire_applications

redirect_back_or_to staff_dashboard_index_path, notice: "Pet successfully adopted."
redirect_back_or_to staff_dashboard_index_path, notice: t(".success")
else
redirect_back_or_to staff_dashboard_index_path, alert: "Error."
redirect_back_or_to staff_dashboard_index_path, alert: t(".error")
end
end

def destroy
if @match.destroy
@match.withdraw_application

redirect_to staff_pets_path, notice: "Adoption reverted & application set to 'Withdrawn'"
redirect_to staff_pets_path, notice: t(".success")
else
redirect_to staff_pets_path, alert: "Failed to revert adoption"
redirect_to staff_pets_path, alert: t(".error")
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def edit

def update
if @organization_profile.update(organization_profile_params)
redirect_to edit_staff_organization_profile_path, notice: "Your profile has been updated!"
redirect_to edit_staff_organization_profile_path, notice: t(".success")
else
render :edit, status: :unprocessable_entity
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def edit

def update
if @page_text.update(page_text_params)
redirect_to edit_staff_page_text_path, notice: "Page text updated successfully!"
redirect_to edit_staff_page_text_path, notice: t(".success")
else
redirect_to edit_staff_page_text_path, alert: @page_text.errors.full_messages.to_sentence
end
Expand Down
Loading

0 comments on commit 56d770b

Please sign in to comment.