md-date-time-picker-rails 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +109 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/md-date-time-picker-rails.rb +2 -0
- data/lib/md-date-time-picker-rails/engine.rb +6 -0
- data/lib/md-date-time-picker-rails/version.rb +5 -0
- data/test/md_date_time_picker_rails_test.rb +7 -0
- data/test/test_helper.rb +7 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 49c5c302c6900621bdff77e14461f14b84b5ca4c
|
4
|
+
data.tar.gz: b4217012e4336eaa21910fc4365f42e422581e1d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5dc38b663a67e3c2875b1d44e579e606ad2aa7ce41653e6d9aeeac96cbb0aa740527b22166f5e4619c5220b8295c5fc414841bd320938dfd3b33a29b57aa5dd1
|
7
|
+
data.tar.gz: f0c7c4e3826bd526487dd1e08846a493f17e5ed08b952039fc483b48776d38f53b9be13fdf84ed06f7ede17988417739fcb1426d835ff1bf00f522c155a0ef50
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Kai Park
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# md-date-time-picker-rails
|
2
|
+
|
3
|
+
md-date-time-picker-rails gem is the integration of md-date-time-picker javascript
|
4
|
+
library for your Rails 4, 5 application.
|
5
|
+
|
6
|
+
md-date-time-picker is Material Design - Date and Time Picker
|
7
|
+
source: https://github.com/PuranjayJain/md-date-time-picker
|
8
|
+
|
9
|
+
Ruby gems url: https://rubygems.org/gems/md-date-time-picker-rails
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'md_date_time_picker-rails'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install md-date-time-picker-rails
|
26
|
+
|
27
|
+
Now you need to edit your `app/assets/javascripts/application.js` file
|
28
|
+
and add the following line:
|
29
|
+
``` javascript
|
30
|
+
//= require moment.min
|
31
|
+
//= require mdDateTimePicker.min
|
32
|
+
//= require draggabilly.pkgd.min # If using TimeDialog
|
33
|
+
```
|
34
|
+
|
35
|
+
And you need to edit your `app/assets/stylesheets/application.css` file
|
36
|
+
and add the following line:
|
37
|
+
|
38
|
+
```css
|
39
|
+
*= require mdDateTimePicker.min
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
Here is the example working code to test with your Rails application.
|
46
|
+
|
47
|
+
Add this sample code to your `app/assets/javascripts/application.js`
|
48
|
+
file
|
49
|
+
|
50
|
+
``` javascript
|
51
|
+
$(document).ready(function(){
|
52
|
+
|
53
|
+
toggleButton = document.getElementById("OBJECT_ID");
|
54
|
+
dialog = new mdDateTimePicker["default"]({
|
55
|
+
type: 'date',
|
56
|
+
type: 'time', # If you wanna TIME
|
57
|
+
future: moment().add(1, 'years'), # Optional
|
58
|
+
trigger: toggleButton # Optional
|
59
|
+
});
|
60
|
+
toggleButton.addEventListener("click", function() {
|
61
|
+
return dialog.toggle();
|
62
|
+
});
|
63
|
+
toggleButton.addEventListener("onOk", function(e) {
|
64
|
+
return this.value = dialog.time().format('L');
|
65
|
+
});
|
66
|
+
|
67
|
+
});
|
68
|
+
```
|
69
|
+
|
70
|
+
If use `app/assets/javascript/application.coffee`
|
71
|
+
|
72
|
+
``` coffee
|
73
|
+
|
74
|
+
toggleButton = document.getElementById("OBJECT_ID")
|
75
|
+
dialog = new mdDateTimePicker.default(
|
76
|
+
type: 'date',
|
77
|
+
future: moment().add(1, 'years'),
|
78
|
+
trigger: toggleButton
|
79
|
+
)
|
80
|
+
|
81
|
+
toggleButton.addEventListener "click", ->
|
82
|
+
dialog.toggle()
|
83
|
+
toggleButton.addEventListener "onOk", (e) ->
|
84
|
+
this.value = dialog.time.format('L')
|
85
|
+
|
86
|
+
```
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
## Full documentation
|
91
|
+
|
92
|
+
The Documentation is at
|
93
|
+
https://puranjayjain.github.io/md-date-time-picker
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
1. Fork it
|
98
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
99
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
100
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
101
|
+
5. Create new Pull Request
|
102
|
+
|
103
|
+
|
104
|
+
## License
|
105
|
+
|
106
|
+
The gem is available as open source under the terms of the [MIT
|
107
|
+
License](http://opensource.org/licenses/MIT).
|
108
|
+
|
109
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "md-date-time-picker-rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: md-date-time-picker-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kai Park
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Migration md-date-time-picker to rails Gem
|
14
|
+
email: ggogun@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- LICENSE
|
20
|
+
- README.md
|
21
|
+
- Rakefile
|
22
|
+
- bin/console
|
23
|
+
- bin/setup
|
24
|
+
- lib/md-date-time-picker-rails.rb
|
25
|
+
- lib/md-date-time-picker-rails/engine.rb
|
26
|
+
- lib/md-date-time-picker-rails/version.rb
|
27
|
+
- test/md_date_time_picker_rails_test.rb
|
28
|
+
- test/test_helper.rb
|
29
|
+
homepage: http://rubygems.org/gems/md-date-time-picker-rails
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.5.1
|
50
|
+
signing_key:
|
51
|
+
specification_version: 3
|
52
|
+
summary: md_date_time_picker rails Gem!
|
53
|
+
test_files:
|
54
|
+
- test/md_date_time_picker_rails_test.rb
|