Skip to content

Commit 258b879

Browse files
Set default method of button_component to POST
1 parent 6be1566 commit 258b879

File tree

6 files changed

+11
-15
lines changed

6 files changed

+11
-15
lines changed

dpc-portal/app/components/core/button/button_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Button
66
class ButtonComponent < ViewComponent::Base
77
attr_accessor :label, :destination, :method, :additional_classes
88

9-
def initialize(label:, destination:, method: :get, additional_classes: nil, disabled: false)
9+
def initialize(label:, destination:, method: :post, additional_classes: nil, disabled: false)
1010
super
1111
@label = label
1212
@destination = destination

dpc-portal/app/components/page/invitations/accept_invitation_component.html.erb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
</ul>
1212
</p>
1313
<%= render Core::Button::ButtonComponent.new(label: 'Verify information',
14-
destination: confirm_organization_invitation_path(@organization, @invitation),
15-
method: :post) %>
14+
destination: confirm_organization_invitation_path(@organization, @invitation)) %>
1615
<% end %>
1716
<% if @invitation.credential_delegate? %>
1817
<p>Your identity has been verified. You can now accept your invite</p>
1918
<%= render Core::Button::ButtonComponent.new(label: 'Accept invite',
20-
destination: register_organization_invitation_path(@organization, @invitation),
21-
method: :post) %>
19+
destination: register_organization_invitation_path(@organization, @invitation)) %>
2220
<% end %>
2321
</div>
2422
</div>

dpc-portal/app/components/page/invitations/register_component.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<div>
44
<p>Your role as Authorized Official and your organization's Medicare enrollment have been verified.</p>
55
<%= render Core::Button::ButtonComponent.new(label: "Submit registration",
6-
destination: register_organization_invitation_path(@organization, @invitation),
7-
method: :post) %>
6+
destination: register_organization_invitation_path(@organization, @invitation)) %>
87
</div>
98
</div>

dpc-portal/app/components/page/utility/error_component.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
when :ao_expired %>
1111
<%= render Core::Button::ButtonComponent.new(label: "Request new link",
1212
disabled: @invitation&.renewed?,
13-
destination: renew_organization_invitation_path(@invitation.provider_organization, @invitation),
14-
method: :post) %>
13+
destination: renew_organization_invitation_path(@invitation.provider_organization, @invitation)) %>
1514
<% when :ao_accepted %>
1615
<%= link_to new_user_session_path, class: 'usa-button', data: { turbo: false } do %>
1716
Sign in with <span class="login-button__logo">Login.gov</span>

dpc-portal/spec/components/core/button/button_component_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
let(:component) { described_class.new(label: 'label', destination: 'destination') }
1414
let(:expected_html) do
1515
<<~HTML
16-
<form class="button_to" method="get" action="destination"><button class="usa-button" type="submit">label</button></form>
16+
<form class="button_to" method="post" action="destination"><button class="usa-button" type="submit">label</button></form>
1717
HTML
1818
end
1919

@@ -30,7 +30,7 @@
3030
end
3131
let(:expected_html) do
3232
<<~HTML
33-
<form class="button_to" method="get" action="destination"><button class="usa-button--outline usa-button" type="submit">label</button></form>
33+
<form class="button_to" method="post" action="destination"><button class="usa-button--outline usa-button" type="submit">label</button></form>
3434
HTML
3535
end
3636
it { is_expected.to match_html_fragment(expected_html) }
@@ -42,7 +42,7 @@
4242
end
4343
let(:expected_html) do
4444
<<~HTML
45-
<form class="button_to" method="get" action="destination"><button class="usa-button" disabled="disabled" type="submit">label</button></form>
45+
<form class="button_to" method="post" action="destination"><button class="usa-button" disabled="disabled" type="submit">label</button></form>
4646
HTML
4747
end
4848
it { is_expected.to match_html_fragment(expected_html) }

dpc-portal/spec/components/page/organization/credentials_componenent_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@
2020
let(:org) { ComponentSupport::MockOrg.new(0) }
2121
it 'Should have Generate token button' do
2222
button = <<~BUTTON
23-
<form class="button_to" method="get" action="/portal/organizations/#{org.path_id}/client_tokens/new">
23+
<form class="button_to" method="post" action="/portal/organizations/#{org.path_id}/client_tokens/new">
2424
<button class="usa-button" type="submit">Generate token</button>
2525
</form>
2626
BUTTON
2727
is_expected.to include(normalize_space(button))
2828
end
2929
it 'Should have Create key button' do
3030
button = <<~BUTTON
31-
<form class="button_to" method="get" action="/portal/organizations/#{org.path_id}/public_keys/new">
31+
<form class="button_to" method="post" action="/portal/organizations/#{org.path_id}/public_keys/new">
3232
<button class="usa-button" type="submit">Add key</button>
3333
</form>
3434
BUTTON
3535
is_expected.to include(normalize_space(button))
3636
end
3737
it 'Should have Add IP button' do
3838
button = <<~BUTTON
39-
<form class="button_to" method="get" action="/portal/organizations/#{org.path_id}/ip_addresses/new">
39+
<form class="button_to" method="post" action="/portal/organizations/#{org.path_id}/ip_addresses/new">
4040
<button class="usa-button" type="submit">Add IP</button>
4141
</form>
4242
BUTTON

0 commit comments

Comments
 (0)