simple_form-datetimepicker 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d59cb71b3f35245b5817b9119ffdd8f3e05e247112d680e63f63b4c468acc627
4
+ data.tar.gz: 6accad1fddf9be57ec638c22f752f47ea52ef0a8011b5fc52c8775351599937f
5
+ SHA512:
6
+ metadata.gz: 0122a1f9660911299a1be7ca9ea4ad891a3c9501ff57f66c0045c159e559c454a534258a9f4d34ee9c0a2512f53ae16009a3d9db5dac4bd5a3c20807de3cd293
7
+ data.tar.gz: 40ea68a66757e4b3fff324e4aa3af9c5d9537ced7fbe63d2095ede13ef1db5bb26591a59d655277a20fed8ce842f818b0474f06a4d239dd06f9b211c9f6d8595
@@ -0,0 +1,20 @@
1
+ Copyright 2018 Roberto Vasquez Angel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,47 @@
1
+ # SimpleForm::Datetimepicker
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+
6
+ Add the javascripts:
7
+
8
+ # app/assets/application.js
9
+ //= require simple_form-datetimepicker
10
+
11
+ Add the stylesheets:
12
+
13
+ # app/assets/application.css
14
+ /*
15
+ *= require simple_form-datetimepicker
16
+ */
17
+
18
+ Use in in your simple form:
19
+
20
+ # date picker only
21
+ = form.input :start_at, as: :date_picker
22
+
23
+ # date time picker
24
+ = form.input :start_at, as: :date_time_picker
25
+
26
+ ## Installation
27
+ Add this line to your application's Gemfile:
28
+
29
+ ```ruby
30
+ gem 'simple_form-datetimepicker'
31
+ ```
32
+
33
+ And then execute:
34
+ ```bash
35
+ $ bundle
36
+ ```
37
+
38
+ Or install it yourself as:
39
+ ```bash
40
+ $ gem install simple_form-datetimepicker
41
+ ```
42
+
43
+ ## Contributing
44
+ Contribution directions go here.
45
+
46
+ ## License
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SimpleForm::Datetimepicker'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
@@ -0,0 +1 @@
1
+ //= require simple_form/datetimepicker/application
@@ -0,0 +1,5 @@
1
+ //= require moment
2
+ //= require moment/de
3
+ //= require bootstrap-datetimepicker
4
+ //= require_self
5
+ //= require_tree ./application
@@ -0,0 +1,28 @@
1
+ $ ->
2
+ $("input[data-behaviour='date_picker']").each ->
3
+ date = $(this).val()
4
+ format = $(this).data('date-format')
5
+ if moment.isDate(date)
6
+ options = {
7
+ defaultDate: moment(date, format),
8
+ format: format,
9
+ }
10
+ else
11
+ options = {
12
+ format: format,
13
+ sideBySide: $(this).data('side-by-side') == true ? true : false
14
+ }
15
+
16
+ if $(this).data('icon-provider') == 'fa'
17
+ options['icons'] = {
18
+ time: "fas fa-clock",
19
+ date: "fas fa-calendar",
20
+ up: "fas fa-caret-up",
21
+ down: "fas fa-caret-down",
22
+ previous: "fas fa-caret-left",
23
+ next: "fas fa-caret-right",
24
+ today: "fas fa-today",
25
+ clear: "fas fa-clear",
26
+ close: "fas fa-close"
27
+ }
28
+ $(this).datetimepicker(options)
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require simple_form/datetimepicker/application
3
+ */
@@ -0,0 +1,5 @@
1
+ /*
2
+ *= require bootstrap-datetimepicker
3
+ *= require_self
4
+ *= require_tree ./application
5
+ */
@@ -0,0 +1,21 @@
1
+ class DatePickerInput < SimpleForm::Inputs::StringInput
2
+ def input_html_options
3
+ value = object.send(attribute_name)
4
+ options = {
5
+ value: value.respond_to?(:to_date) ? I18n.localize(value.to_date, format: :date_picker) : nil,
6
+ data: {
7
+ behaviour: 'date_picker',
8
+ 'date-format': I18n.t('date.formats.date_picker_js')
9
+ }
10
+ }
11
+ options[:data][:'side-by-side'] = @options[:'side_by_side'] || false
12
+ options[:data][:'icon-provider'] = case @options[:icons]
13
+ when :font_awesome
14
+ 'fa'
15
+ else
16
+ nil
17
+ end
18
+
19
+ super.merge options
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ class DateTimePickerInput < SimpleForm::Inputs::StringInput
2
+ def input_html_options
3
+ value = object.send(attribute_name)
4
+ options = {
5
+ value: value.nil? ? nil : I18n.localize(value, format: :date_picker),
6
+ data: {
7
+ behaviour: 'date_picker',
8
+ 'date-format': I18n.t('time.formats.date_picker_js')
9
+ }
10
+ }
11
+ options[:data][:'side-by-side'] = @options[:'side_by_side'] || false
12
+ options[:data][:'icon-provider'] = case @options[:icons]
13
+ when :font_awesome
14
+ 'fa'
15
+ else
16
+ nil
17
+ end
18
+
19
+ super.merge options
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ de:
2
+ date:
3
+ formats:
4
+ date_picker: '%d.%m.%Y'
5
+ date_picker_js: 'DD.MM.YYYY'
6
+ time:
7
+ formats:
8
+ date_picker: '%d.%m.%Y %H:%M:%S'
9
+ date_picker_js: 'DD.MM.YYYY HH:mm:ss'
@@ -0,0 +1,9 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ date_picker: '%Y-%m-%d'
5
+ date_picker_js: 'YYYY-MM-DD'
6
+ time:
7
+ formats:
8
+ date_picker: '%Y-%m-%d %I:%M:%S %p'
9
+ date_picker_js: 'YYYY-MM-DD hh:mm:ss'
@@ -0,0 +1 @@
1
+ require "simple_form/datetimepicker"
@@ -0,0 +1,11 @@
1
+ require 'coffee-rails'
2
+ require 'momentjs-rails'
3
+ require 'bootstrap3-datetimepicker-rails'
4
+
5
+ require "simple_form/datetimepicker/engine"
6
+
7
+ module SimpleForm
8
+ module Datetimepicker
9
+ # Your code goes here...
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module SimpleForm
2
+ module Datetimepicker
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace SimpleForm::Datetimepicker
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module SimpleForm
2
+ module Datetimepicker
3
+ VERSION = '0.0.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :simple_form_datetimepicker do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_form-datetimepicker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roberto Vasquez Angel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: coffee-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: momentjs-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bootstrap3-datetimepicker-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - roberto@vasquez-angel.de
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - MIT-LICENSE
91
+ - README.md
92
+ - Rakefile
93
+ - app/assets/javascripts/simple_form-datetimepicker.js
94
+ - app/assets/javascripts/simple_form/datetimepicker/application.js
95
+ - app/assets/javascripts/simple_form/datetimepicker/application/date_picker.js.coffee
96
+ - app/assets/stylesheets/simple_form-datetimepicker.css
97
+ - app/assets/stylesheets/simple_form/datetimepicker/application.css
98
+ - app/assets/stylesheets/simple_form/datetimepicker/application/keep.css
99
+ - app/inputs/date_picker_input.rb
100
+ - app/inputs/date_time_picker_input.rb
101
+ - config/locales/de.yml
102
+ - config/locales/en.yml
103
+ - lib/simple_form-datetimepicker.rb
104
+ - lib/simple_form/datetimepicker.rb
105
+ - lib/simple_form/datetimepicker/engine.rb
106
+ - lib/simple_form/datetimepicker/version.rb
107
+ - lib/tasks/simple_form/datetimepicker_tasks.rake
108
+ homepage: https://github.com/robotex82/simple_form-datetimepicker
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubygems_version: 3.0.6
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Date(time)picker for Simple Form
131
+ test_files: []