Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Hide backend new card form by default
Browse files Browse the repository at this point in the history
When the page first loads, this form should not be visible. We want it
to be displayed when the user selects "new card". Otherwise it's visible
when a reusable source is selected.
  • Loading branch information
Luuk Veenis committed Nov 1, 2016
1 parent a86af66 commit 3084a6a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
<% end %>
</div>

<%= render partial: "spree/shared/braintree_hosted_fields", locals: { id: id } %>
<div id="card_form<%= id %>" data-hook style="display: none;">
<%= render partial: "spree/shared/braintree_hosted_fields", locals: { id: id } %>
</div>
</fieldset>
2 changes: 1 addition & 1 deletion app/views/spree/shared/_braintree_hosted_fields.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% prefix = "payment_source[#{id}]" %>

<div id="card_form<%= id %>" data-hook>
<div class="hosted-fields">
<div class="field" data-hook="card_number">
<%= label_tag "card_number#{id}", Spree::CreditCard.human_attribute_name(:number), class: "required" %>
<div class="input" id="card_number<%= id %>"></div>
Expand Down
2 changes: 1 addition & 1 deletion spec/features/braintree_credit_card_checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
visit spree.checkout_state_path(:delivery)
click_button "Save and Continue"
choose("Braintree")
expect(page).to have_selector("#card_form#{braintree.id}", visible: true)
expect(page).to have_selector("#payment_method_#{braintree.id}", visible: true)
expect(page).to have_selector("iframe#braintree-hosted-field-number")
end
end
Expand Down

0 comments on commit 3084a6a

Please sign in to comment.