credit_card_type_field 1.3 → 1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ module CreditCardField
7
7
  ActiveSupport.on_load(:action_view) do
8
8
  require "credit_card_type_field/view_helper"
9
9
  class ActionView::Helpers::FormBuilder
10
+ include ActionView::Helpers::CaptureHelper
10
11
  include CreditCardTypeField::ViewHelper::FormHelper
11
12
  end
12
13
  ActionView::Base.send :include, CreditCardTypeField::ViewHelper::FormTagHelper
@@ -14,6 +15,7 @@ module CreditCardField
14
15
  begin
15
16
  require 'simple_form'
16
17
  class SimpleForm::FormBuilder
18
+ include ActionView::Helpers::CaptureHelper
17
19
  include CreditCardTypeField::ViewHelper::FormHelper
18
20
  end
19
21
  rescue LoadError
@@ -1,3 +1,3 @@
1
1
  module CreditCardField
2
- VERSION = "1.3"
2
+ VERSION = "1.4"
3
3
  end
@@ -3,6 +3,7 @@ module CreditCardTypeField
3
3
 
4
4
  module FormHelper
5
5
  def credit_card_type_field(method, options = {})
6
+ append_js = options[:js].nil? ? true : options[:js]
6
7
  options[:card_number_field_name] ||= 'credit_card_no'
7
8
  field_name = "#{@object_name}\\\\[#{options[:card_number_field_name]}\\\\]"
8
9
  options[:accept_types] ||= %w(visa master american_express diners_club)
@@ -16,12 +17,14 @@ module CreditCardTypeField
16
17
  <script>
17
18
  $('input[rel=credit-card-type]').closest('form').find('input[name=#{field_name}]').keyup(CreditCardField.keyup);
18
19
  </script>
19
- ).html_safe
20
+ ).html_safe if append_js
21
+ html
20
22
  end
21
23
  end
22
24
 
23
25
  module FormTagHelper
24
26
  def credit_card_type_field_tag(name, value = nil, options = {})
27
+ append_js = options[:js].nil? ? true : options[:js]
25
28
  options[:card_number_field_name] ||= 'credit_card_no'
26
29
  field_name = options[:card_number_field_name]
27
30
  options[:accept_types] ||= %w(visa master american_express diners_club)
@@ -35,7 +38,8 @@ module CreditCardTypeField
35
38
  <script>
36
39
  $('input[rel=credit-card-type]').closest('form').find('input[name=#{field_name}]').keyup(CreditCardField.keyup);
37
40
  </script>
38
- ).html_safe
41
+ ).html_safe if append_js
42
+ html
39
43
  end
40
44
  end
41
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit_card_type_field
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: