-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply bootstrap_form to newly added organization_profile form (#252)
* Apply bootstrap_form to newly added organization_profile form * Add location attributes so bootstrap_form has desired attribute name shown
- Loading branch information
1 parent
c26f83b
commit d08f790
Showing
2 changed files
with
12 additions
and
18 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 |
---|---|---|
@@ -1,10 +1,7 @@ | ||
<%= form_with model: profile, :url => organization_profile_path do |form| %> | ||
|
||
<%= bootstrap_form_with model: profile, :url => organization_profile_path do |form| %> | ||
<% if profile.errors.count > 0 %> | ||
<div class="alert alert-danger mt-1" role="alert"> | ||
<p> | ||
<%= t '.please_fix_the_errors' %> | ||
</p> | ||
<%= t '.please_fix_the_errors' %> | ||
</div> | ||
<% end %> | ||
|
||
|
@@ -13,30 +10,19 @@ | |
<h3>Contact</h3> | ||
|
||
<div class="form-group"> | ||
<%= form.label :phone_number, class: 'bigger' %> | ||
<%= form.telephone_field :phone_number, | ||
autofocus: true, | ||
placeholder: "10 digit number", | ||
class: 'form-control' %> | ||
|
||
<% profile.errors.full_messages_for(:phone_number).each do |message| %> | ||
<div class="alert alert-danger mt-1" role="alert"><%= message %></div> | ||
<% end %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= form.label :email %> | ||
<%= form.text_field :email, placeholder: "[email protected]", class: 'form-control' %> | ||
|
||
<% profile.errors.full_messages_for(:email).each do |message| %> | ||
<div class="alert alert-danger mt-1" role="alert"><%= message %></div> | ||
<% end %> | ||
</div> | ||
|
||
<%# nested form for locations table %> | ||
<div class="form-group bigger" data-controller="country-state"> | ||
<%= form.fields_for :location do |location| %> | ||
<%= location.label :country %> | ||
<%= location.select :country, | ||
CS.countries.invert, | ||
{ prompt: "Please select" }, | ||
|
@@ -50,7 +36,6 @@ | |
<div class="alert alert-danger mt-1" role="alert"><%= error.message %></div> | ||
<% end %> | ||
|
||
<%= location.label :province_state, 'Province/State' %> | ||
<%= location.select :province_state, | ||
CS.states(location.object.country).invert, | ||
{ prompt: "Please select" }, | ||
|
@@ -61,7 +46,6 @@ | |
<div class="alert alert-danger mt-1" role="alert"><%= error.message %></div> | ||
<% end %> | ||
|
||
<%= location.label :city_town, 'City/Town' %> | ||
<%= location.text_field :city_town, class: 'form-control' %> | ||
<% profile.location.custom_messages(:city_town).each do |error| %> | ||
<div class="alert alert-danger mt-1" role="alert"><%= error.message %></div> | ||
|
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