Skip to content

Commit

Permalink
Some more small fixes (#1283)
Browse files Browse the repository at this point in the history
* update comments for using the service

* require requester name and city/town

* remove delete account link

* fix the sex filter

* validate 500 max for contacts
  • Loading branch information
kasugaijin authored Dec 19, 2024
1 parent 9245063 commit cfc15a4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ class Contact
include ActiveModel::Model
attr_accessor :name, :email, :message

validates :name, :email, :message, presence: true
validates :name, :email, presence: true
validates :message, presence: true, length: {maximum: 500}

# credit: https://medium.com/@limichelle21/building-and-debugging-a-contact-form-with-rails-mailgun-heroku-c0185b8bf419
end
2 changes: 1 addition & 1 deletion app/models/organization_account_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class OrganizationAccountRequest

before_validation :normalize_phone

validates :name, :email, :city_town, :country, :province_state, presence: true
validates :name, :email, :requester_name, :city_town, :country, :province_state, presence: true
validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
validates :phone_number, presence: true, phone: {possible: true, allow_blank: true}

Expand Down
9 changes: 5 additions & 4 deletions app/services/organizations/create_service.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# class to create a new location, organization, user, and staff account with role admin
# email is sent to admin user if all steps are successful
# Class to create a new location, organization, user, and staff account with role admin.
# An email is sent to admin user if all steps are successful.
# Be sure to use the Country and State codes from countries_states.yml
# call with Organizations::CreateService.new.signal(args)
# sample args:
# {
# location: {
# country: 'Mexico',
# city_town: 'La Ventana',
# country: 'MX',
# city_town: 'JAL',
# province_state: 'Baja'
# },
# organization: {
Expand Down
5 changes: 0 additions & 5 deletions app/views/layouts/adopter_foster_dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@
<i class="fe fe-power nav-icon"></i> Log Out
<% end %>
</li>
<li class="nav-item">
<%= active_link_to adopter_fosterer_dashboard_index_path, class: "nav-link" do %>
<i class="fe fe-trash nav-icon"></i> Delete Account
<% end %>
</li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/adoptable_pets/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>
<div class="form-group">
<%= f.label :sex_eq, "Sex" %>
<%= f.select :sex_eq, ["Male", "Female"], {include_blank: 'All'}, class: "form-select" %>
<%= f.select :sex_eq, [["Male", "male"], ["Female", "female"]], {include_blank: 'All'}, class: "form-select" %>
</div>
<div class="form-group">
<%= f.label :breed_eq, "Breed" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/staff/pets/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
<div class="form-group mb-3 col-md-3">
<%= f.label :sex_eq, "Sex" %>
<%= f.select :sex_eq, ["Male", "Female"], {include_blank: 'All'}, class: "form-select" %>
<%= f.select :sex_eq, [["Male", "male"], ["Female", "female"]], {include_blank: 'All'}, class: "form-select" %>
</div>
<div class="form-group mb-3 col-md-3">
<%= f.label :species_eq, "Species" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_location_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
} %>
<!-- City/Town Text Field -->
<%= form.text_field :city_town,
required: false,
required: true,
class: "form-control" %>

0 comments on commit cfc15a4

Please sign in to comment.