Skip to content

Commit

Permalink
FFS-1809: Disable multiple clicking on send invitation button (#400)
Browse files Browse the repository at this point in the history
* Added controller to add javascript on send button.

* FFS-2175: Adding DB query to /health endpoint (#401)

Co-authored-by: Tom Dooner <[email protected]>

* FFS-2175: Removing Skylight from the project (#402)

* Wire up Caseworker Invitation JS controller

Co-Authored-By: Yvette White <[email protected]>

* Create `uswds_form_with` helper to use Turbo on invitation page

Co-Authored-By: Yvette White <[email protected]>

---------

Co-authored-by: George Byers <[email protected]>
Co-authored-by: Tom Dooner <[email protected]>
Co-authored-by: Yvette White <[email protected]>
  • Loading branch information
4 people authored Jan 3, 2025
1 parent ac93d9e commit 014dd2d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def create
error_messages = @cbv_flow_invitation.errors.messages.values.flatten.map { |msg| "<li>#{msg}</li>" }.join
error_messages = "<ul>#{error_messages}</ul>"

flash[:alert_heading] = error_header
flash[:alert] = error_messages.html_safe
flash.now[:alert_heading] = error_header
flash.now[:alert] = error_messages.html_safe

return render :new
return render :new, status: :unprocessable_entity
end

# hydrate the cbv_client with the invitation if there are no cbv_flow_invitation errors
Expand Down
10 changes: 10 additions & 0 deletions app/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,14 @@ def feedback_form_url
def coalesce_to_completed(status)
[ :unsupported, :failed ].include?(status) ? :completed : status
end

def uswds_form_with(model: false, scope: nil, url: nil, format: nil, **options, &block)
options[:builder] = UswdsFormBuilder
options[:data] ||= {}
options[:data][:turbo_frame] = "_top"

turbo_frame_tag(model) do
form_with(model: model, scope: scope, url: url, format: format, **options, &block)
end
end
end
2 changes: 1 addition & 1 deletion app/app/views/caseworker/cbv_flow_invitations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="usa-prose">
<%= site_translation(".description_html", pay_income_days: current_site.pay_income_days) %>
</div>
<%= form_with(model: @cbv_flow_invitation, data: { turbo: false }, url: invitations_path, builder: UswdsFormBuilder) do |f| %>
<%= uswds_form_with(model: @cbv_flow_invitation, url: invitations_path) do |f| %>
<%= render partial: "caseworker/cbv_flow_invitations/#{@cbv_flow_invitation.site_id}", locals: { f: f } %>
<%= f.submit t(".form.submit") %>
<% end %>
2 changes: 1 addition & 1 deletion app/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
condition: service_healthy
redis:
condition: service_healthy
env_file: .env.local.bak
env_file: .env.development.local
environment:
- DOCKERIZED=true
- DB_HOST=postgres
Expand Down

0 comments on commit 014dd2d

Please sign in to comment.