PR changes: switch syntax for mapCC, remove ng-init

This commit is contained in:
stveep
2018-07-29 22:44:27 +01:00
parent c0f41b6833
commit 286101c934
4 changed files with 16 additions and 27 deletions

View File

@@ -29,6 +29,7 @@ angular.module('admin.payments').directive "stripeElements", ($injector, AdminSt
displayError.textContent = event.error.message
else
displayError.textContent = ''
return
AdminStripeElements.stripe = stripe

View File

@@ -22,19 +22,13 @@ angular.module("admin.payments").factory 'AdminStripeElements', ($rootScope, Sta
# Maps the brand returned by Stripe to that required by activemerchant
mapCC: (ccType) ->
if ccType == 'MasterCard'
return 'master'
else if ccType == 'Visa'
return 'visa'
else if ccType == 'American Express'
return 'american_express'
else if ccType == 'Discover'
return 'discover'
else if ccType == 'JCB'
return 'jcb'
else if ccType == 'Diners Club'
return 'diners_club'
return
switch ccType
when 'MasterCard' then return 'master'
when 'Visa' then return 'visa'
when 'American Express' then return 'american_express'
when 'Discover' then return 'discover'
when 'JCB' then return 'jcb'
when 'Diners Club' then return 'diners_club'
# It doesn't matter if any of these are nil, all are optional.
makeCardData: (secrets) ->

View File

@@ -25,19 +25,13 @@ Darkswarm.factory 'StripeElements', ($rootScope, Loading, RailsFlashLoader) ->
# Maps the brand returned by Stripe to that required by activemerchant
mapCC: (ccType) ->
if ccType == 'MasterCard'
return 'master'
else if ccType == 'Visa'
return 'visa'
else if ccType == 'American Express'
return 'american_express'
else if ccType == 'Discover'
return 'discover'
else if ccType == 'JCB'
return 'jcb'
else if ccType == 'Diners Club'
return 'diners_club'
return
switch ccType
when 'MasterCard' then return 'master'
when 'Visa' then return 'visa'
when 'American Express' then return 'american_express'
when 'Discover' then return 'discover'
when 'JCB' then return 'jcb'
when 'Diners Club' then return 'diners_club'
# It doesn't matter if any of these are nil, all are optional.
makeCardData: (secrets) ->

View File

@@ -2,7 +2,7 @@
<div class="alpha three columns">
<div class="field">
<%= f.label :amount, t(:amount) %>
<%= f.text_field :amount, :value => @order.outstanding_balance, :class => 'fullwidth', "watch-value-as" => 'form_data.amount', "ng-init" => "form_data.amount=#{@order.outstanding_balance}" %>
<%= f.text_field :amount, :value => @order.outstanding_balance, :class => 'fullwidth', "watch-value-as" => 'form_data.amount' %>
</div>
</div>
<div class="omega nine columns">