administrate-field-date_picker 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3ec89ea48f351fa68da53310defb8df131f360bf
4
+ data.tar.gz: 7e06cc9b7a5f15c941af37ee7927b461442d6078
5
+ SHA512:
6
+ metadata.gz: f56176c0f5f4b25088d4c7b07fd7dc452533d9b7930786802c7ac3270a12f14477f5fa894c9071d5aebd61165c509cb1c39e869e57667764a69c03346c2e896b
7
+ data.tar.gz: ef39a11900b9afc285982f1cf353350154ccd379074d1aaadb26c5ba01d69b83e8b9d3a6983bba2ec928d571d16c9982fe1b41ab8389133b7f9875b3f0de0504
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,153 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ administrate-field-date_picker (0.0.1)
5
+ administrate (~> 0.2.1)
6
+ flatpickr_rails (~> 0.0.2)
7
+ rails (~> 4.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (4.2.7.1)
13
+ actionpack (= 4.2.7.1)
14
+ actionview (= 4.2.7.1)
15
+ activejob (= 4.2.7.1)
16
+ mail (~> 2.5, >= 2.5.4)
17
+ rails-dom-testing (~> 1.0, >= 1.0.5)
18
+ actionpack (4.2.7.1)
19
+ actionview (= 4.2.7.1)
20
+ activesupport (= 4.2.7.1)
21
+ rack (~> 1.6)
22
+ rack-test (~> 0.6.2)
23
+ rails-dom-testing (~> 1.0, >= 1.0.5)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
+ actionview (4.2.7.1)
26
+ activesupport (= 4.2.7.1)
27
+ builder (~> 3.1)
28
+ erubis (~> 2.7.0)
29
+ rails-dom-testing (~> 1.0, >= 1.0.5)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
+ activejob (4.2.7.1)
32
+ activesupport (= 4.2.7.1)
33
+ globalid (>= 0.3.0)
34
+ activemodel (4.2.7.1)
35
+ activesupport (= 4.2.7.1)
36
+ builder (~> 3.1)
37
+ activerecord (4.2.7.1)
38
+ activemodel (= 4.2.7.1)
39
+ activesupport (= 4.2.7.1)
40
+ arel (~> 6.0)
41
+ activesupport (4.2.7.1)
42
+ i18n (~> 0.7)
43
+ json (~> 1.7, >= 1.7.7)
44
+ minitest (~> 5.1)
45
+ thread_safe (~> 0.3, >= 0.3.4)
46
+ tzinfo (~> 1.1)
47
+ administrate (0.2.2)
48
+ autoprefixer-rails (~> 6.0)
49
+ datetime_picker_rails (~> 0.0.7)
50
+ jquery-rails (~> 4.0)
51
+ kaminari (~> 0.16)
52
+ momentjs-rails (~> 2.8)
53
+ neat (~> 1.1)
54
+ normalize-rails (~> 3.0)
55
+ rails (~> 4.2)
56
+ sass-rails (~> 5.0)
57
+ selectize-rails (~> 0.6)
58
+ arel (6.0.3)
59
+ autoprefixer-rails (6.5.1.1)
60
+ execjs
61
+ builder (3.2.2)
62
+ concurrent-ruby (1.0.2)
63
+ datetime_picker_rails (0.0.7)
64
+ momentjs-rails (>= 2.8.1)
65
+ erubis (2.7.0)
66
+ execjs (2.7.0)
67
+ flatpickr_rails (0.0.2)
68
+ railties (>= 3.0)
69
+ globalid (0.3.7)
70
+ activesupport (>= 4.1.0)
71
+ i18n (0.7.0)
72
+ jquery-rails (4.2.1)
73
+ rails-dom-testing (>= 1, < 3)
74
+ railties (>= 4.2.0)
75
+ thor (>= 0.14, < 2.0)
76
+ json (1.8.3)
77
+ kaminari (0.17.0)
78
+ actionpack (>= 3.0.0)
79
+ activesupport (>= 3.0.0)
80
+ loofah (2.0.3)
81
+ nokogiri (>= 1.5.9)
82
+ mail (2.6.4)
83
+ mime-types (>= 1.16, < 4)
84
+ mime-types (3.1)
85
+ mime-types-data (~> 3.2015)
86
+ mime-types-data (3.2016.0521)
87
+ mini_portile2 (2.1.0)
88
+ minitest (5.9.1)
89
+ momentjs-rails (2.15.1)
90
+ railties (>= 3.1)
91
+ neat (1.8.0)
92
+ sass (>= 3.3)
93
+ thor (~> 0.19)
94
+ nokogiri (1.6.8.1)
95
+ mini_portile2 (~> 2.1.0)
96
+ normalize-rails (3.0.3)
97
+ rack (1.6.4)
98
+ rack-test (0.6.3)
99
+ rack (>= 1.0)
100
+ rails (4.2.7.1)
101
+ actionmailer (= 4.2.7.1)
102
+ actionpack (= 4.2.7.1)
103
+ actionview (= 4.2.7.1)
104
+ activejob (= 4.2.7.1)
105
+ activemodel (= 4.2.7.1)
106
+ activerecord (= 4.2.7.1)
107
+ activesupport (= 4.2.7.1)
108
+ bundler (>= 1.3.0, < 2.0)
109
+ railties (= 4.2.7.1)
110
+ sprockets-rails
111
+ rails-deprecated_sanitizer (1.0.3)
112
+ activesupport (>= 4.2.0.alpha)
113
+ rails-dom-testing (1.0.7)
114
+ activesupport (>= 4.2.0.beta, < 5.0)
115
+ nokogiri (~> 1.6.0)
116
+ rails-deprecated_sanitizer (>= 1.0.1)
117
+ rails-html-sanitizer (1.0.3)
118
+ loofah (~> 2.0)
119
+ railties (4.2.7.1)
120
+ actionpack (= 4.2.7.1)
121
+ activesupport (= 4.2.7.1)
122
+ rake (>= 0.8.7)
123
+ thor (>= 0.18.1, < 2.0)
124
+ rake (11.3.0)
125
+ sass (3.4.22)
126
+ sass-rails (5.0.6)
127
+ railties (>= 4.0.0, < 6)
128
+ sass (~> 3.1)
129
+ sprockets (>= 2.8, < 4.0)
130
+ sprockets-rails (>= 2.0, < 4.0)
131
+ tilt (>= 1.1, < 3)
132
+ selectize-rails (0.12.3)
133
+ sprockets (3.7.0)
134
+ concurrent-ruby (~> 1.0)
135
+ rack (> 1, < 3)
136
+ sprockets-rails (3.2.0)
137
+ actionpack (>= 4.0)
138
+ activesupport (>= 4.0)
139
+ sprockets (>= 3.0.0)
140
+ thor (0.19.1)
141
+ thread_safe (0.3.5)
142
+ tilt (2.0.5)
143
+ tzinfo (1.2.2)
144
+ thread_safe (~> 0.1)
145
+
146
+ PLATFORMS
147
+ ruby
148
+
149
+ DEPENDENCIES
150
+ administrate-field-date_picker!
151
+
152
+ BUNDLED WITH
153
+ 1.13.6
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 z.productions.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Administrate::Field::DatePicker
2
+
3
+ A plugin to pick a date in [Administrate], with the help of [Flatpickr].
4
+
5
+ ![Screenshot](https://raw.githubusercontent.com/z-productions/administrate-field-date_picker/master/screenshot.png)
6
+
7
+ ## Usage
8
+
9
+ Add it to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'administrate-field-date_picker', '~> 0.0.1'
13
+ ```
14
+
15
+ Run:
16
+
17
+ ```bash
18
+ $ bundle install
19
+ ```
20
+
21
+ Add to your `FooDashboard`:
22
+
23
+ ```ruby
24
+ ATTRIBUTE_TYPES = {
25
+ bar: Field::DatePicker,
26
+ }.freeze
27
+ ```
28
+
29
+ ## About
30
+
31
+ Administrate::Field::DatePicker is maintained by [z.productions].
32
+
33
+
34
+ [Flatpickr]: https://github.com/chmln/flatpickr
35
+ [Administrate]: https://github.com/thoughtbot/administrate
36
+ [z.productions]: https://www.z.productions/
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'administrate-field-date_picker'
5
+ gem.version = '0.0.2'
6
+ gem.authors = ['Michele Gerarduzzi']
7
+ gem.email = ['michele.gerarduzzi@gmail.com']
8
+ gem.homepage = 'https://github.com/z-productions/administrate-field-date_picker'
9
+ gem.summary = 'A date picker plugin for Administrate'
10
+ gem.description = gem.summary
11
+ gem.license = 'MIT'
12
+
13
+ gem.require_paths = ['lib']
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+
17
+ gem.add_runtime_dependency 'administrate', '~> 0.2.1'
18
+ gem.add_runtime_dependency 'rails', '>= 4.2'
19
+ gem.add_runtime_dependency 'flatpickr_rails', '~> 0.0.2'
20
+ end
@@ -0,0 +1,5 @@
1
+ //= require flatpickr
2
+
3
+ $(function() {
4
+ flatpickr('.date_picker');
5
+ });
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'flatpickr'
3
+ */
@@ -0,0 +1,20 @@
1
+ <%#
2
+ # DatePicker Form Partial
3
+
4
+ This partial renders an input element that will trigger a date picker when focused.
5
+ It falls back to a HTML5 `date` input field
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of DateTime.
13
+ %>
14
+
15
+ <div class="field-unit__label">
16
+ <%= f.label field.attribute %>
17
+ </div>
18
+ <div class="field-unit__field">
19
+ <%= f.date_field field.attribute, class: 'date_picker' %>
20
+ </div>
@@ -0,0 +1,16 @@
1
+ <%#
2
+ # DatePicker Index Partial
3
+
4
+ This partial renders a date to be displayed
5
+ on a resource's index page.
6
+
7
+ By default, the attribute is rendered as string
8
+ with the %b %d, %Y format, e.g. `Oct 28, 2016`
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of DateTime.
14
+ %>
15
+
16
+ <%= field.data.strftime('%b %d, %Y') %>
@@ -0,0 +1,16 @@
1
+ <%#
2
+ # DatePicker Show Partial
3
+
4
+ This partial renders a date to be displayed
5
+ on a resource's show page.
6
+
7
+ By default, the attribute is rendered as string
8
+ with the %b %d, %Y format, e.g. `Oct 28, 2016`
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of DateTime.
14
+ %>
15
+
16
+ <%= field.data.strftime('%b %d, %Y') %>
@@ -0,0 +1,15 @@
1
+ require 'administrate/field/text'
2
+ require 'administrate/engine'
3
+ require 'rails'
4
+ require 'flatpickr_rails'
5
+
6
+ module Administrate
7
+ module Field
8
+ class DatePicker < Administrate::Field::Text
9
+ class Engine < ::Rails::Engine
10
+ Administrate::Engine.add_javascript 'administrate-field-date_picker/application'
11
+ Administrate::Engine.add_stylesheet 'administrate-field-date_picker/application'
12
+ end
13
+ end
14
+ end
15
+ end
data/screenshot.png ADDED
Binary file
@@ -0,0 +1,14 @@
1
+ require 'administrate/field/date_picker'
2
+
3
+ describe Administrate::Field::DatePicker do
4
+ describe '#to_partial_path' do
5
+ 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)
8
+
9
+ path = field.to_partial_path
10
+
11
+ expect(path).to eq("/fields/date_picker/#{page}")
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-date_picker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Michele Gerarduzzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: administrate
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '4.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: flatpickr_rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.2
55
+ description: A date picker plugin for Administrate
56
+ email:
57
+ - michele.gerarduzzi@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE.md
66
+ - README.md
67
+ - administrate-field-date_picker.gemspec
68
+ - app/assets/javascripts/administrate-field-date_picker/application.js
69
+ - app/assets/stylesheets/administrate-field-date_picker/application.css
70
+ - app/views/fields/date_picker/_form.html.erb
71
+ - app/views/fields/date_picker/_index.html.erb
72
+ - app/views/fields/date_picker/_show.html.erb
73
+ - lib/administrate/field/date_picker.rb
74
+ - screenshot.png
75
+ - spec/lib/administrate/field/date_picker_spec.rb
76
+ homepage: https://github.com/z-productions/administrate-field-date_picker
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.5.1
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: A date picker plugin for Administrate
100
+ test_files:
101
+ - spec/lib/administrate/field/date_picker_spec.rb