Skip to content

Commit 73d3bc8

Browse files
[Auditor] Disable edit billing address UI (#11894)
## Summary of the problem <!-- Why are these changes being made? What problem does it solve? Link any related issues to provide more details. --> Buttons and form elements weren't disabled for auditors. ## Describe your changes <!-- Explain your thought process to the solution and provide a quick summary of the changes. --> <!-- If there are any visual changes, please attach images, videos, or gifs. -->
1 parent 3d79791 commit 73d3bc8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/views/users/edit_address.html.erb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<% title "Account settings" %>
22
<% page_md %>
3+
<% disabled = !policy(@user).update? %>
4+
35
<%= render "users/nav", selected: :settings %>
46
<h1>
57
Settings
@@ -17,38 +19,38 @@
1719
<%= form.fields_for :stripe_cardholder, @user.stripe_cardholder do |form| %>
1820
<div class="field mb1">
1921
<%= form.label :stripe_billing_address_line1, "Street address" %>
20-
<%= form.text_field :stripe_billing_address_line1, placeholder: StripeCardholder::DEFAULT_BILLING_ADDRESS[:line1], required: true %>
22+
<%= form.text_field :stripe_billing_address_line1, placeholder: StripeCardholder::DEFAULT_BILLING_ADDRESS[:line1], required: true, disabled: %>
2123
</div>
2224

2325
<div class="field mt1">
24-
<%= form.text_field :stripe_billing_address_line2, placeholder: "(Building / Apartment / Room)" %>
26+
<%= form.text_field :stripe_billing_address_line2, placeholder: "(Building / Apartment / Room)", disabled: %>
2527
</div>
2628

2729
<div class="grid grid--split">
2830
<div class="field flex-auto">
2931
<%= form.label :stripe_billing_address_city, "City" %>
30-
<%= form.text_field :stripe_billing_address_city, placeholder: StripeCardholder::DEFAULT_BILLING_ADDRESS[:city], required: true %>
32+
<%= form.text_field :stripe_billing_address_city, placeholder: StripeCardholder::DEFAULT_BILLING_ADDRESS[:city], required: true, disabled: %>
3133
</div>
3234
<div class="field flex-auto">
3335
<%= form.label :address_state, "State / Province" %>
34-
<%= form.select :stripe_billing_address_state, @states %>
36+
<%= form.select :stripe_billing_address_state, @states, {}, disabled: %>
3537
</div>
3638
</div>
3739

3840
<div class="grid grid--split">
3941
<div class="field flex-auto">
4042
<%= form.label :postal_code %>
41-
<%= form.text_field :stripe_billing_address_postal_code, placeholder: StripeCardholder::DEFAULT_BILLING_ADDRESS[:postal_code], required: true %>
43+
<%= form.text_field :stripe_billing_address_postal_code, placeholder: StripeCardholder::DEFAULT_BILLING_ADDRESS[:postal_code], required: true, disabled: %>
4244
</div>
4345

4446
<div class="field flex-auto">
4547
<%= form.label :country %>
46-
<%= form.country_select :stripe_billing_address_country, nil, { only: ["US"] }, { required: true } %>
48+
<%= form.country_select :stripe_billing_address_country, nil, { only: ["US"] }, { required: true, disabled: } %>
4749
</div>
4850
</div>
4951

5052
<div class="actions inline-block mt1">
51-
<%= form.submit "Save" %>
53+
<%= form.submit "Save", disabled: %>
5254
</div>
5355
<% end %>
5456
<% end %>

0 commit comments

Comments
 (0)