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 authored and adammathys committed Jan 31, 2017
1 parent 2b52543 commit 055b50e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
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
@@ -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
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 055b50e

Please sign in to comment.