simple_form-bootstrap 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a661ed8effde4d148bc4742b5830e7d3ad159424
4
- data.tar.gz: 6f46a48bfc692ef807c69c0efa0c3b367e911405
3
+ metadata.gz: bdfdf05aca09c195d5c6ee957ac8e7cab9cea7b0
4
+ data.tar.gz: 97d050a70a8db896ef75331994b08bce0acce573
5
5
  SHA512:
6
- metadata.gz: 261fdb832ac3350e5f14354c3e1713b98ae529a7db33e61162f090b36a58a748b86cff640f8d3970f5a94f80fe5990e8e20799535c85dfe3212381ca7dda66ed
7
- data.tar.gz: 5a36a3a2245b91af251ed9c8716f4caa94c1fda3513e1a0c7ae45cfdc5d9b45e1b08d3839df7af59c76f8dcd06eecac15ff03909236c8ed3668e8a85be9257ea
6
+ metadata.gz: d3b8d5ddf01e8bac354cde128819e84525fd3147a1fac346e5d0f26abb53f9155c87f6b1d061d556ed9df630a1b95ad9c3e90e790d2eb3bea20895da7121253d
7
+ data.tar.gz: 3c16f939607cb67e2145d2d7927a324627568ff661f77664e1cf5069c61d1c2c08293b45c7483884d23058c4dde68727f117c45114e82ec72d10a0fe5f4bbacb
@@ -2,8 +2,9 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.0.0
5
- - 2.1.6
6
- - 2.2.2
5
+ - 2.1.9
6
+ - 2.2.5
7
+ - 2.3.1
7
8
  - ruby-head
8
9
  matrix:
9
10
  allow_failures:
@@ -1,8 +1,14 @@
1
1
  ## master
2
2
 
3
+ ## 1.4.0
4
+
3
5
  ### enhancements
6
+ * Fix JavaScript lints.
7
+ * Tests against newest Rubies.
4
8
 
5
9
  ### bug fixes
10
+ * Fix tests running new RSpec versions.
11
+ * Support Rails 5' attributes API.
6
12
 
7
13
  ## 1.3.0
8
14
 
@@ -18,7 +18,7 @@
18
18
  tokenfields.tokenfield();
19
19
  }
20
20
 
21
- $(document).on('ready', function(e) {
21
+ $(document).on('ready', function() {
22
22
  initializeComponents(document);
23
23
  });
24
24
  $(document).on('DOMNodeInserted', function(e) {
@@ -32,7 +32,7 @@
32
32
  this.attr('type', 'text');
33
33
  this.parent().css('display', '');
34
34
  this.parent().next('input[type=text]').attr('type', 'hidden');
35
- this.parent().prev('label').attr('for', this.attr('id'))
35
+ this.parent().prev('label').attr('for', this.attr('id'));
36
36
 
37
37
  return this;
38
38
  },
@@ -1,18 +1,21 @@
1
1
  module SimpleForm::Bootstrap::FormBuilders::DateTime
2
2
  DATE_TIME_COLUMN_TYPES = [
3
+ :datetime,
3
4
  'datetime',
4
5
  'timestamp',
5
6
  'timestamp without time zone'
6
7
  ].freeze
7
8
 
8
9
  DATE_COLUMN_TYPES = [
10
+ :date,
9
11
  'date'
10
12
  ].freeze
11
13
 
12
14
  def default_input_type(attribute_name, column, options, *args, &block)
13
15
  if (options.is_a?(Hash) ? options[:as] : @options[:as]).nil? && !column.nil?
14
- return :bootstrap_date_time if DATE_TIME_COLUMN_TYPES.include?(column.sql_type)
15
- return :bootstrap_date if DATE_COLUMN_TYPES.include?(column.sql_type)
16
+ type = column.respond_to?(:type) ? column.type : column.sql_type
17
+ return :bootstrap_date_time if DATE_TIME_COLUMN_TYPES.include?(type)
18
+ return :bootstrap_date if DATE_COLUMN_TYPES.include?(type)
16
19
  end
17
20
 
18
21
  super(attribute_name, column, options, *args, &block)
@@ -1,4 +1,4 @@
1
1
  module SimpleForm; end
2
2
  module SimpleForm::Bootstrap
3
- VERSION = '1.3.0'
3
+ VERSION = '1.4.0'
4
4
  end
@@ -12,6 +12,10 @@ require 'simple_form'
12
12
  require 'simple_form/bootstrap'
13
13
  SimpleForm.setup do; end
14
14
 
15
+ class TestApplication < Rails::Application
16
+ secrets.secret_key_base = SecureRandom.base64(10)
17
+ end
18
+
15
19
  # Requires supporting ruby files with custom matchers and macros, etc, in
16
20
  # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
17
21
  # run as spec files by default. This means that files in spec/support that end
@@ -14,7 +14,11 @@ RSpec.describe 'date_time', type: :view do
14
14
  end
15
15
 
16
16
  def column_for_attribute(*)
17
- Struct.new(:sql_type).new(@column_sql_type)
17
+ if @column_sql_type.is_a?(Symbol)
18
+ Struct.new(:type).new(@column_sql_type)
19
+ else
20
+ Struct.new(:sql_type).new(@column_sql_type)
21
+ end
18
22
  end
19
23
 
20
24
  def has_attribute?(*)
@@ -34,35 +38,39 @@ RSpec.describe 'date_time', type: :view do
34
38
  end
35
39
 
36
40
  context 'when the database column is a datetime' do
37
- let(:object) { DateTimeModel.new('datetime') }
38
- it 'displays the text field' do
39
- expect(rendered).to have_tag('div.form-group.bootstrap_date_time') do
40
- with_tag('input.bootstrap_date_time', with: { value: object.test })
41
+ ['datetime', :datetime].each do |type|
42
+ let(:object) { DateTimeModel.new(type) }
43
+ it 'displays the text field' do
44
+ expect(rendered).to have_tag('div.form-group.bootstrap_date_time') do
45
+ with_tag('input.bootstrap_date_time', with: { value: object.test })
46
+ end
41
47
  end
42
- end
43
48
 
44
- it 'has a hidden datepicker control' do
45
- selector = 'div.form-group.bootstrap_date_time div.input-group'
46
- required_style = { style: 'display: none' }
49
+ it 'has a hidden datepicker control' do
50
+ selector = 'div.form-group.bootstrap_date_time div.input-group'
51
+ required_style = { style: 'display: none' }
47
52
 
48
- expect(rendered).to have_tag(selector, with: required_style) do
49
- with_tag('input.bootstrap_date_time', with: { type: 'hidden' })
53
+ expect(rendered).to have_tag(selector, with: required_style) do
54
+ with_tag('input.bootstrap_date_time', with: { type: 'hidden' })
55
+ end
50
56
  end
51
57
  end
52
58
  end
53
59
 
54
60
  context 'when the database column is a date' do
55
- let(:object) { DateTimeModel.new('date') }
56
- it 'displays the text field' do
57
- expect(rendered).to have_tag('div.form-group.bootstrap_date') do
58
- with_tag('input.bootstrap_date', with: { value: object.test })
61
+ ['date', :date].each do |type|
62
+ let(:object) { DateTimeModel.new(type) }
63
+ it 'displays the text field' do
64
+ expect(rendered).to have_tag('div.form-group.bootstrap_date') do
65
+ with_tag('input.bootstrap_date', with: { value: object.test })
66
+ end
59
67
  end
60
68
  end
61
69
  end
62
70
 
63
71
  context 'when the database column is not a datetime' do
64
72
  let(:object) { DateTimeModel.new('string') }
65
- it 'does not have a datepicker control' do
73
+ it 'does not have a datepicker control' do
66
74
  expect(rendered).not_to have_tag('div.form-group.bootstrap_date_time')
67
75
  end
68
76
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Low
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  version: '0'
214
214
  requirements: []
215
215
  rubyforge_project:
216
- rubygems_version: 2.5.1
216
+ rubygems_version: 2.6.6
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: Initialises Simple Form to automatically produce Bootstrap 3-friendly markup.