Skip to content

Commit

Permalink
Merge pull request #40 from hectoregm/hectoregm/input_placeholders
Browse files Browse the repository at this point in the history
Add placeholder text for each of the credit card inputs.
  • Loading branch information
cbrunsdon authored Jun 24, 2016
2 parents 3ff0bc8 + 2c083f4 commit 19e0d8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
12 changes: 12 additions & 0 deletions app/models/solidus/gateway/braintree_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ def voidable?(response_code)
].include?(transaction.status)
end

def card_number_placeholder
'4141 4141 4141 4141'
end

def expiration_date_placeholder
'01/2020'
end

def card_code_placeholder
'123'
end

private
def message_from_result(result)
if result.success?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<% content_for :head do %>
<%= javascript_tag do %>
braintree.environment = "<%= payment_method.preferred_environment %>"
braintree.placeholders = {
"number": "<%= payment_method.card_number_placeholder %>",
"expirationDate": "<%= payment_method.expiration_date_placeholder %>",
"cvv": "<%= payment_method.card_code_placeholder %>"
}
<% end %>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ var initializeBraintree = function(data) {
hostedFields: {
styles: SolidusBraintree.getFrontendStyles(),
number: {
selector: "#braintree_card_number"
selector: "#braintree_card_number",
placeholder: braintree.placeholders["number"]
},
cvv: {
selector: "#braintree_card_code"
selector: "#braintree_card_code",
placeholder: braintree.placeholders["cvv"]
},
expirationDate: {
selector: "#braintree_card_expiry"
selector: "#braintree_card_expiry",
placeholder: braintree.placeholders["expirationDate"]
}
},
dataCollector: {
Expand Down

0 comments on commit 19e0d8a

Please sign in to comment.