administrate-field-date_picker 0.0.5 → 0.1.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
- SHA1:
3
- metadata.gz: 613e14320113b26006bb2c9e5938bd126a5fc7ee
4
- data.tar.gz: 997d723df5335a2c2da342d72ddda111ab3068f1
2
+ SHA256:
3
+ metadata.gz: 614e90c9b7a6bad86dcd9e6075822eda6f3a9f0bf0f1eb40508c52a6d5fea11f
4
+ data.tar.gz: 6b594d5cd684cfebd6e98ea2bfb16c4f75ce0a962c43b4686cf7e363d8a53ec7
5
5
  SHA512:
6
- metadata.gz: d33510269a72472242658893feaa6ab2b09471118b62f0604d1ce5031d7405d1d9758cfcd903caf28dee6f70152fb2e679812c3f24c3bc4a0110d0d650b9597b
7
- data.tar.gz: 949484399a67071063bf55f48a19161f0b5c534d245938cb344071595d712c2490c5ac40950fe866efdb06d9f69e4d76434b6fabb6cd2d2e3174cb723840f7f1
6
+ metadata.gz: 3ed82a35f934ef8541158a1e02e548c4fc446cf98f4c5245f2dbf08b033e7de1c0ce0741cdde1879b800689ad8168ef6ef9d9f0a0c1c714d94ee519097bcbb97
7
+ data.tar.gz: 1ad2b1cb04f8370f13e758a444e517c386ed1dfd2c5b65d9fc048b857c6eb8a7ceb1da3d6a507242f019db8a287019f47e2ecff4bbf0c603de417d4493c5c907
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  *.gem
2
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/CHANGELOG.md CHANGED
@@ -1,24 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.1.0](https://github.com/zooppa/administrate-field-date_picker/tree/v0.1.0) (2018-02-14)
4
+
5
+ [Full Changelog](https://github.com/zooppa/administrate-field-date_picker/compare/v0.0.5...v0.1.0)
6
+
7
+ * Handle nil values (thanks @NickWarm)
8
+ * Use i18n `:default` date format (thanks @neumayr)
9
+
3
10
  ## [v0.0.5](https://github.com/zooppa/administrate-field-date_picker/tree/v0.0.5) (2017-04-03)
11
+
4
12
  [Full Changelog](https://github.com/zooppa/administrate-field-date_picker/compare/v0.0.4...v0.0.5)
5
13
 
6
14
  * Bump up Administrate dependency
7
15
 
8
16
  ## [v0.0.4](https://github.com/zooppa/administrate-field-date_picker/tree/v0.0.4) (2017-03-20)
17
+
9
18
  [Full Changelog](https://github.com/zooppa/administrate-field-date_picker/compare/v0.0.3...v0.0.4)
10
19
 
11
20
  * Bump up Administrate dependency
12
21
 
13
22
  ## [v0.0.3](https://github.com/zooppa/administrate-field-date_picker/tree/v0.0.3) (2016-11-22)
23
+
14
24
  [Full Changelog](https://github.com/zooppa/administrate-field-date_picker/compare/v0.0.2...v0.0.3)
15
25
 
16
26
  * Bump up Administrate dependency
17
27
 
18
28
  ## [v0.0.2](https://github.com/zooppa/administrate-field-date_picker/tree/v0.0.2) (2016-11-02)
29
+
19
30
  [Full Changelog](https://github.com/zooppa/administrate-field-date_picker/compare/v0.0.1...v0.0.2)
20
31
 
21
32
  * Relax `rails` version requirement
22
33
 
23
34
  ## [v0.0.1](https://github.com/zooppa/administrate-field-date_picker/tree/v0.0.1) (2016-11-02)
35
+
24
36
  First release
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2016 z.productions.
3
+ Copyright (c) 2015-2016 Zooppa.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -11,7 +11,7 @@ A plugin to pick a date in [Administrate], with the help of [Flatpickr].
11
11
  Add it to your `Gemfile`:
12
12
 
13
13
  ```ruby
14
- gem 'administrate-field-date_picker', '~> 0.0.5'
14
+ gem 'administrate-field-date_picker', '~> 0.1.0'
15
15
  ```
16
16
 
17
17
  Run:
@@ -30,9 +30,8 @@ ATTRIBUTE_TYPES = {
30
30
 
31
31
  ## About
32
32
 
33
- Administrate::Field::DatePicker is maintained by [z.productions].
33
+ Administrate::Field::DatePicker is maintained by [Zooppa].
34
34
 
35
-
36
- [Flatpickr]: https://github.com/chmln/flatpickr
37
- [Administrate]: https://github.com/thoughtbot/administrate
38
- [z.productions]: https://www.z.productions/
35
+ [flatpickr]: https://github.com/chmln/flatpickr
36
+ [administrate]: https://github.com/thoughtbot/administrate
37
+ [zooppa]: https://www.zooppa.com/
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -2,12 +2,12 @@ $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'administrate-field-date_picker'
5
- gem.version = '0.0.5'
5
+ gem.version = '0.1.0'
6
6
  gem.authors = ['Michele Gerarduzzi']
7
7
  gem.email = ['michele.gerarduzzi@gmail.com']
8
8
  gem.homepage = 'https://github.com/zooppa/administrate-field-date_picker'
9
- gem.summary = 'A date picker plugin for Administrate'
10
- gem.description = gem.summary
9
+ gem.summary = 'Date picker plugin for Administrate'
10
+ gem.description = 'A plugin to select dates with a date picker in Administrate'
11
11
  gem.license = 'MIT'
12
12
 
13
13
  gem.require_paths = ['lib']
@@ -15,6 +15,9 @@ Gem::Specification.new do |gem|
15
15
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
 
17
17
  gem.add_runtime_dependency 'administrate', '< 1.0.0'
18
- gem.add_runtime_dependency 'rails', '>= 4.2'
18
+ gem.add_runtime_dependency 'rails', '>= 4.2', '< 6'
19
19
  gem.add_runtime_dependency 'flatpickr_rails', '~> 0.0.2'
20
+
21
+ gem.add_development_dependency 'rake', '~> 12.3'
22
+ gem.add_development_dependency 'rspec', '~> 3.7'
20
23
  end
@@ -5,7 +5,7 @@ This partial renders a date to be displayed
5
5
  on a resource's index page.
6
6
 
7
7
  By default, the attribute is rendered as string
8
- with the %b %d, %Y format, e.g. `Oct 28, 2016`
8
+ with the :default format
9
9
 
10
10
  ## Local variables:
11
11
 
@@ -13,4 +13,4 @@ with the %b %d, %Y format, e.g. `Oct 28, 2016`
13
13
  An instance of DateTime.
14
14
  %>
15
15
 
16
- <%= field.data.strftime('%b %d, %Y') %>
16
+ <%= field.ldate %>
@@ -5,7 +5,7 @@ This partial renders a date to be displayed
5
5
  on a resource's show page.
6
6
 
7
7
  By default, the attribute is rendered as string
8
- with the %b %d, %Y format, e.g. `Oct 28, 2016`
8
+ with the :default format
9
9
 
10
10
  ## Local variables:
11
11
 
@@ -13,4 +13,4 @@ with the %b %d, %Y format, e.g. `Oct 28, 2016`
13
13
  An instance of DateTime.
14
14
  %>
15
15
 
16
- <%= field.data.strftime('%b %d, %Y') %>
16
+ <%= field.ldate %>
@@ -1,6 +1,6 @@
1
+ require 'rails'
1
2
  require 'administrate/field/text'
2
3
  require 'administrate/engine'
3
- require 'rails'
4
4
  require 'flatpickr_rails'
5
5
 
6
6
  module Administrate
@@ -10,6 +10,10 @@ module Administrate
10
10
  Administrate::Engine.add_javascript 'administrate-field-date_picker/application'
11
11
  Administrate::Engine.add_stylesheet 'administrate-field-date_picker/application'
12
12
  end
13
+
14
+ def ldate(options = {})
15
+ data ? I18n.l(data, options) : nil
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,14 +1,45 @@
1
- require 'administrate/field/date_picker'
1
+ require 'spec_helper'
2
2
 
3
3
  describe Administrate::Field::DatePicker do
4
+ subject { Administrate::Field::DatePicker.new(:date_picker, data, :show) }
5
+
4
6
  describe '#to_partial_path' do
7
+ let(:data) { Date.today }
8
+
5
9
  it 'returns a partial based on the page being rendered' do
6
- page = :show
7
- field = Administrate::Field::DatePicker.new(:date_picker, '11/02/2016', page)
10
+ path = subject.to_partial_path
11
+ expect(path).to eq('/fields/date_picker/show')
12
+ end
13
+ end
14
+
15
+ describe '#ldate' do
16
+ let(:output) { subject.ldate(options) }
17
+ let(:options) { {} }
18
+
19
+ context 'with nil' do
20
+ let(:data) { nil }
21
+
22
+ it 'returns nil' do
23
+ expect(output).to be_nil
24
+ end
25
+ end
26
+
27
+ context 'with a date' do
28
+ let(:data) { Date.parse('2018-02-14') }
29
+
30
+ context 'with no options' do
31
+ it 'returns the date with defaulf format' do
32
+ expect(output).to eq '2018-02-14'
33
+ end
34
+ end
8
35
 
9
- path = field.to_partial_path
36
+ context 'with format' do
37
+ let(:options) { { format: '%b %d, %Y' } }
10
38
 
11
- expect(path).to eq("/fields/date_picker/#{page}")
39
+ it 'returns the formatted date' do
40
+ expect(output).to eq 'Feb 14, 2018'
41
+ end
42
+ end
12
43
  end
13
44
  end
14
45
  end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'administrate/field/date_picker'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate-field-date_picker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michele Gerarduzzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2018-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.2'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '6'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '4.2'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '6'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: flatpickr_rails
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +58,35 @@ dependencies:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: 0.0.2
55
- description: A date picker plugin for Administrate
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '12.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '12.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.7'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.7'
89
+ description: A plugin to select dates with a date picker in Administrate
56
90
  email:
57
91
  - michele.gerarduzzi@gmail.com
58
92
  executables: []
@@ -60,11 +94,12 @@ extensions: []
60
94
  extra_rdoc_files: []
61
95
  files:
62
96
  - ".gitignore"
97
+ - ".rspec"
63
98
  - CHANGELOG.md
64
99
  - Gemfile
65
- - Gemfile.lock
66
100
  - LICENSE.md
67
101
  - README.md
102
+ - Rakefile
68
103
  - administrate-field-date_picker.gemspec
69
104
  - app/assets/javascripts/administrate-field-date_picker/application.js
70
105
  - app/assets/stylesheets/administrate-field-date_picker/application.css
@@ -74,6 +109,7 @@ files:
74
109
  - lib/administrate/field/date_picker.rb
75
110
  - screenshot.png
76
111
  - spec/lib/administrate/field/date_picker_spec.rb
112
+ - spec/spec_helper.rb
77
113
  homepage: https://github.com/zooppa/administrate-field-date_picker
78
114
  licenses:
79
115
  - MIT
@@ -94,9 +130,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
130
  version: '0'
95
131
  requirements: []
96
132
  rubyforge_project:
97
- rubygems_version: 2.6.11
133
+ rubygems_version: 2.7.3
98
134
  signing_key:
99
135
  specification_version: 4
100
- summary: A date picker plugin for Administrate
136
+ summary: Date picker plugin for Administrate
101
137
  test_files:
102
138
  - spec/lib/administrate/field/date_picker_spec.rb
139
+ - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,162 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- administrate-field-date_picker (0.0.5)
5
- administrate (< 1.0.0)
6
- flatpickr_rails (~> 0.0.2)
7
- rails (>= 4.2)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actioncable (5.0.2)
13
- actionpack (= 5.0.2)
14
- nio4r (>= 1.2, < 3.0)
15
- websocket-driver (~> 0.6.1)
16
- actionmailer (5.0.2)
17
- actionpack (= 5.0.2)
18
- actionview (= 5.0.2)
19
- activejob (= 5.0.2)
20
- mail (~> 2.5, >= 2.5.4)
21
- rails-dom-testing (~> 2.0)
22
- actionpack (5.0.2)
23
- actionview (= 5.0.2)
24
- activesupport (= 5.0.2)
25
- rack (~> 2.0)
26
- rack-test (~> 0.6.3)
27
- rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.0.2)
30
- activesupport (= 5.0.2)
31
- builder (~> 3.1)
32
- erubis (~> 2.7.0)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.0.2)
36
- activesupport (= 5.0.2)
37
- globalid (>= 0.3.6)
38
- activemodel (5.0.2)
39
- activesupport (= 5.0.2)
40
- activerecord (5.0.2)
41
- activemodel (= 5.0.2)
42
- activesupport (= 5.0.2)
43
- arel (~> 7.0)
44
- activesupport (5.0.2)
45
- concurrent-ruby (~> 1.0, >= 1.0.2)
46
- i18n (~> 0.7)
47
- minitest (~> 5.1)
48
- tzinfo (~> 1.1)
49
- administrate (0.4.0)
50
- autoprefixer-rails (~> 6.0)
51
- bourbon (~> 4.2)
52
- datetime_picker_rails (~> 0.0.7)
53
- jquery-rails (~> 4.0)
54
- kaminari (~> 0.16)
55
- momentjs-rails (~> 2.8)
56
- neat (~> 1.1)
57
- normalize-rails (~> 3.0)
58
- rails (>= 4.2, < 5.1)
59
- sass-rails (~> 5.0)
60
- selectize-rails (~> 0.6)
61
- arel (7.1.4)
62
- autoprefixer-rails (6.7.7)
63
- execjs
64
- bourbon (4.3.3)
65
- sass (~> 3.4)
66
- thor (~> 0.19)
67
- builder (3.2.3)
68
- concurrent-ruby (1.0.5)
69
- datetime_picker_rails (0.0.7)
70
- momentjs-rails (>= 2.8.1)
71
- erubis (2.7.0)
72
- execjs (2.7.0)
73
- flatpickr_rails (0.0.3)
74
- railties (>= 3.0)
75
- globalid (0.3.7)
76
- activesupport (>= 4.1.0)
77
- i18n (0.8.1)
78
- jquery-rails (4.2.2)
79
- rails-dom-testing (>= 1, < 3)
80
- railties (>= 4.2.0)
81
- thor (>= 0.14, < 2.0)
82
- kaminari (0.17.0)
83
- actionpack (>= 3.0.0)
84
- activesupport (>= 3.0.0)
85
- loofah (2.0.3)
86
- nokogiri (>= 1.5.9)
87
- mail (2.6.4)
88
- mime-types (>= 1.16, < 4)
89
- method_source (0.8.2)
90
- mime-types (3.1)
91
- mime-types-data (~> 3.2015)
92
- mime-types-data (3.2016.0521)
93
- mini_portile2 (2.1.0)
94
- minitest (5.10.1)
95
- momentjs-rails (2.17.1)
96
- railties (>= 3.1)
97
- neat (1.8.0)
98
- sass (>= 3.3)
99
- thor (~> 0.19)
100
- nio4r (2.0.0)
101
- nokogiri (1.7.1)
102
- mini_portile2 (~> 2.1.0)
103
- normalize-rails (3.0.3)
104
- rack (2.0.1)
105
- rack-test (0.6.3)
106
- rack (>= 1.0)
107
- rails (5.0.2)
108
- actioncable (= 5.0.2)
109
- actionmailer (= 5.0.2)
110
- actionpack (= 5.0.2)
111
- actionview (= 5.0.2)
112
- activejob (= 5.0.2)
113
- activemodel (= 5.0.2)
114
- activerecord (= 5.0.2)
115
- activesupport (= 5.0.2)
116
- bundler (>= 1.3.0, < 2.0)
117
- railties (= 5.0.2)
118
- sprockets-rails (>= 2.0.0)
119
- rails-dom-testing (2.0.2)
120
- activesupport (>= 4.2.0, < 6.0)
121
- nokogiri (~> 1.6)
122
- rails-html-sanitizer (1.0.3)
123
- loofah (~> 2.0)
124
- railties (5.0.2)
125
- actionpack (= 5.0.2)
126
- activesupport (= 5.0.2)
127
- method_source
128
- rake (>= 0.8.7)
129
- thor (>= 0.18.1, < 2.0)
130
- rake (12.0.0)
131
- sass (3.4.23)
132
- sass-rails (5.0.6)
133
- railties (>= 4.0.0, < 6)
134
- sass (~> 3.1)
135
- sprockets (>= 2.8, < 4.0)
136
- sprockets-rails (>= 2.0, < 4.0)
137
- tilt (>= 1.1, < 3)
138
- selectize-rails (0.12.4)
139
- sprockets (3.7.1)
140
- concurrent-ruby (~> 1.0)
141
- rack (> 1, < 3)
142
- sprockets-rails (3.2.0)
143
- actionpack (>= 4.0)
144
- activesupport (>= 4.0)
145
- sprockets (>= 3.0.0)
146
- thor (0.19.4)
147
- thread_safe (0.3.6)
148
- tilt (2.0.7)
149
- tzinfo (1.2.2)
150
- thread_safe (~> 0.1)
151
- websocket-driver (0.6.5)
152
- websocket-extensions (>= 0.1.0)
153
- websocket-extensions (0.1.2)
154
-
155
- PLATFORMS
156
- ruby
157
-
158
- DEPENDENCIES
159
- administrate-field-date_picker!
160
-
161
- BUNDLED WITH
162
- 1.14.6