Skip to content

Commit

Permalink
Minor refactor of modal forms for coll number, f record and sequence
Browse files Browse the repository at this point in the history
Pulls some ancillary changes out of the obs-location PR
  • Loading branch information
nimmolo committed Jul 23, 2024
1 parent 6840c56 commit f3e3d50
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/views/controllers/collection_numbers/_form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ when "new", "create"
url_params = add_query_param(
{ action: :create, observation_id: @observation.id }
)
button = :ADD.t
button = :ADD.l
when "edit", "update"
url_params = add_query_param({ action: :update })
url_params = url_params.merge({ back: @back }) if @back.present?
button = :SAVE.t
button = :SAVE.l
end
form_args = {
model: @collection_number, url: url_params, id: "collection_number_form"
Expand Down
3 changes: 1 addition & 2 deletions app/views/controllers/collection_numbers/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ add_tab_set(

<div class="row">
<div class="col-xs-12 col-sm-7">
<%= render(partial: "collection_numbers/form",
locals: { action: :update, local: true }) %>
<%= render(partial: "collection_numbers/form", locals: { local: true }) %>
</div>

<div class="col-xs-12 col-sm-5">
Expand Down
3 changes: 1 addition & 2 deletions app/views/controllers/collection_numbers/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ add_tab_set(collection_number_form_new_tabs(obs: @observation))

<div class="row">
<div class="col-xs-12 col-sm-7">
<%= render(partial: "collection_numbers/form",
locals: { action: :create, local: true }) %>
<%= render(partial: "collection_numbers/form", locals: { local: true }) %>
</div>

<div class="col-xs-12 col-sm-5">
Expand Down
4 changes: 2 additions & 2 deletions app/views/controllers/herbarium_records/_form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ when "new", "create"
url_params = add_query_param(
{ action: :create, observation_id: @observation.id }
)
button = :ADD.t
button = :ADD.l
when "edit", "update"
url_params = add_query_param({ action: :update })
url_params = url_params.merge({ back: @back }) if @back.present?
button = :SAVE.t
button = :SAVE.l
end
form_args = {
model: @herbarium_record, url: url_params, id: "herbarium_record_form"
Expand Down
3 changes: 1 addition & 2 deletions app/views/controllers/herbarium_records/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ add_tab_set(herbarium_record_form_edit_tabs(back: @back,

<div class="row">
<div class="col-xs-12 col-sm-7">
<%= render(partial: "herbarium_records/form",
locals: { action: :update, local: true }) %>
<%= render(partial: "herbarium_records/form", locals: { local: true }) %>
</div>

<div class="col-xs-12 col-sm-5">
Expand Down
3 changes: 1 addition & 2 deletions app/views/controllers/herbarium_records/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ add_tab_set(herbarium_record_form_new_tabs(obs: @observation))
<div class="row">
<div class="col-xs-12 col-sm-7">
<span class="text-larger mb-3"><%= :Observation.t %> #<%= @observation.id %></span><!-- .text-larger -->
<%= render(partial: "herbarium_records/form",
locals: { action: :create, local: true }) %>
<%= render(partial: "herbarium_records/form", locals: { local: true }) %>
</div>

<div class="col-xs-12 col-sm-5">
Expand Down
4 changes: 2 additions & 2 deletions app/views/controllers/sequences/_form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ when "new", "create"
url_params = add_query_param(
{ action: :create, observation_id: @observation.id }
)
button = :ADD.t
button = :ADD.l
when "edit", "update"
url_params = add_query_param({ action: :update })
url_params = url_params.merge({ back: @back }) if @back.present?
button = :UPDATE.t
button = :UPDATE.l
end
form_args = {
model: @sequence, url: url_params, id: "sequence_form"
Expand Down
3 changes: 1 addition & 2 deletions app/views/controllers/sequences/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ obs = @sequence.observation
<div class="col-xs-12 col-sm-7">
<%= render(partial: "sequences/observation_title",
locals: { observation: obs }) %>
<%= render(partial: "sequences/form",
locals: { action: :update, local: true }) %>
<%= render(partial: "sequences/form", locals: { local: true }) %>

<div class="small">
<span class="font-weight-bold"><%= :CREATED_BY.t %>:</span>
Expand Down
3 changes: 1 addition & 2 deletions app/views/controllers/sequences/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ add_tab_set(sequence_form_tabs(obj: @observation))
<div class="col-xs-12 col-sm-7">
<%= render(partial: "sequences/observation_title",
locals: { observation: @observation }) %>
<%= render(partial: "sequences/form",
locals: { action: :create, local: true }) %>
<%= render(partial: "sequences/form", locals: { local: true }) %>
</div>

<div class="col-xs-12 col-sm-5">
Expand Down

0 comments on commit f3e3d50

Please sign in to comment.