laydate-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +57 -7
- data/app/assets/stylesheets/laydate-rails.scss +13 -0
- data/laydate/gulpfile.js +1 -1
- data/laydate/src/theme/default/laydate.css +9 -5
- data/lib/laydate/rails/version.rb +1 -1
- data/vendor/assets/fonts/{font/iconfont.eot → iconfont.eot} +0 -0
- data/vendor/assets/fonts/{font/iconfont.svg → iconfont.svg} +0 -0
- data/vendor/assets/fonts/{font/iconfont.ttf → iconfont.ttf} +0 -0
- data/vendor/assets/fonts/{font/iconfont.woff → iconfont.woff} +0 -0
- data/vendor/assets/stylesheets/laydate.css +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7a146a0eb20214fd49fb13b8a13be0d4683bd3a45eb6b4300f6b39b7c79385a
|
4
|
+
data.tar.gz: fc215aef2874771115007e0f4df60fa19be8cbd8aeebb8c07fc72fefc709dcf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dc65c64a8dfe489b8bf2cdc666ee0efbd1484d95080c76f72c7c7135eee482d074a48635df9320b017e281b16f7fc9eca966f235c8264e88c6244e0caf8b7e1
|
7
|
+
data.tar.gz: 02c4f0b71ccfaeff59aed3c4deb3cabab24672f74fabb7384b26a3bad918f9113ab490d5a6be2fdf525fcdb21d500870115d5e40fd4af7e1d4663240b5f98f49
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# Laydate::Rails
|
2
2
|
|
3
|
-
|
3
|
+
Another date time picker JS plugin, trust me, it's simple to to use and looks ready nice.
|
4
4
|
|
5
|
-
|
5
|
+
This is simply a wrapper on top of the awesome npm package [laydate](https://www.layui.com/laydate/) so it could be used easily in rails applications.
|
6
|
+
|
7
|
+
Laydate team did an awesome job so there is no dependency on either jQuery or bootstrap, all by itself.
|
8
|
+
|
9
|
+
**Why this Gem**: My original plan was just to use npm/yarn to manage it in my rails application, but with one issue, the npm package loads css in the js by relative path, so you only need to include the js src in html, which is great in some cases. And this works great in my development env as well, but in rails production all are compiled into one simple js/css file, it breaks the relative path of css and fonts as well, anyway, the gem seems to work.
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -22,17 +26,63 @@ Or install it yourself as:
|
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
|
29
|
+
Add `#= require laydate` to your `app/assets/javascripts/application.js(.coffee)`, if you are using ActiveAdmin like me, just add it to `app/assets/javascripts/active_admin.js.coffee`;
|
30
|
+
|
31
|
+
Add `@import "laydate-rails";` to your `app/assets/stylesheets/application.scss`, Note: `app/assets/stylesheets/active_admin.scss` for AA project;
|
32
|
+
|
33
|
+
If you don't have `application.scss`, try rename your `applications.css` file;
|
34
|
+
|
35
|
+
mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
|
26
36
|
|
27
|
-
|
37
|
+
You are all set
|
38
|
+
|
39
|
+
## Examples
|
40
|
+
The full API documents link: https://www.layui.com/laydate/
|
41
|
+
|
42
|
+
Basic:
|
43
|
+
|
44
|
+
html:
|
45
|
+
```
|
46
|
+
<input type="text" id="test1">
|
47
|
+
```
|
28
48
|
|
29
|
-
|
49
|
+
js:
|
50
|
+
```
|
51
|
+
laydate.render({
|
52
|
+
elem: '#test1', // element selector
|
53
|
+
lang: 'en' // default is Chinese version, use en for english
|
54
|
+
});
|
55
|
+
```
|
56
|
+
|
57
|
+
Advanced:
|
58
|
+
|
59
|
+
html:
|
60
|
+
```
|
61
|
+
<input type="text" id="test1">
|
62
|
+
```
|
63
|
+
|
64
|
+
js:
|
65
|
+
```
|
66
|
+
laydate.render({
|
67
|
+
elem: '#test1',
|
68
|
+
lang: 'en',
|
69
|
+
type: 'date' | 'time' | 'datetime',
|
70
|
+
range: true,
|
71
|
+
done: afterDone, // function
|
72
|
+
change: afterChange, // function
|
73
|
+
theme: '#393D49', // change color if you want
|
74
|
+
showBottom: false, // if you want to show clear/Today/confirm buttons
|
75
|
+
value: '1989-10-14' // default value
|
76
|
+
min: '2016-10-14',
|
77
|
+
max: '2080-10-14'
|
78
|
+
});
|
79
|
+
```
|
30
80
|
|
31
|
-
|
81
|
+
There are many other options too, reference to the official document for more infomations;
|
32
82
|
|
33
83
|
## Contributing
|
34
84
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
85
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/AlbaHoo/laydate-rails.
|
36
86
|
|
37
87
|
## License
|
38
88
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/** 图标字体 **/
|
2
|
+
@font-face {
|
3
|
+
font-family: 'laydate-icon';
|
4
|
+
src: url(font_path('iconfont.eot'));
|
5
|
+
src: url(font_path('iconfont.eot#iefix')) format('embedded-opentype'),
|
6
|
+
url(font_path('iconfont.svg#iconfont')) format('svg'),
|
7
|
+
url(font_path('iconfont.woff')) format('woff'),
|
8
|
+
url(font_path('iconfont.ttf')) format('truetype');
|
9
|
+
}
|
10
|
+
|
11
|
+
// import vender/assets/stylesheets/laydate.css
|
12
|
+
@import "laydate.css";
|
13
|
+
|
data/laydate/gulpfile.js
CHANGED
@@ -30,7 +30,7 @@ var task = {
|
|
30
30
|
|
31
31
|
}
|
32
32
|
,other: function(){
|
33
|
-
gulp.src('./src/theme/default/font/*', { base: './src/theme/default/' }).pipe(rename({}))
|
33
|
+
gulp.src('./src/theme/default/font/*', { base: './src/theme/default/font' }).pipe(rename({}))
|
34
34
|
.pipe(gulp.dest('./../vendor/assets/fonts/'));
|
35
35
|
}
|
36
36
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
/** 图标字体
|
1
|
+
/** 图标字体
|
2
|
+
* it breaks the rails font-path so move it to app/assets/stylesheets/laydate
|
2
3
|
@font-face {font-family: 'laydate-icon';
|
3
4
|
src: url('./font/iconfont.eot');
|
4
5
|
src: url('./font/iconfont.eot#iefix') format('embedded-opentype'),
|
@@ -6,7 +7,9 @@
|
|
6
7
|
url('./font/iconfont.woff') format('woff'),
|
7
8
|
url('./font/iconfont.ttf') format('truetype');
|
8
9
|
}
|
9
|
-
|
10
|
+
|
11
|
+
**/
|
12
|
+
|
10
13
|
.laydate-icon{
|
11
14
|
font-family:"laydate-icon" !important;
|
12
15
|
font-size: 16px;
|
@@ -16,12 +19,13 @@
|
|
16
19
|
}
|
17
20
|
|
18
21
|
/**
|
19
|
-
|
22
|
+
|
20
23
|
@Name: laydata
|
21
24
|
@Author: 贤心
|
22
|
-
|
25
|
+
editted: Alba Hoo
|
26
|
+
|
23
27
|
**/
|
24
|
-
|
28
|
+
|
25
29
|
|
26
30
|
html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
27
31
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,2 +1,2 @@
|
|
1
1
|
/*! laydate-v5.0.9 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */
|
2
|
-
.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}
|
2
|
+
.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laydate-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alba Hoo
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
+
- app/assets/stylesheets/laydate-rails.scss
|
54
55
|
- bin/console
|
55
56
|
- bin/setup
|
56
57
|
- laydate-rails.gemspec
|
@@ -69,10 +70,10 @@ files:
|
|
69
70
|
- laydate/test/test.url
|
70
71
|
- lib/laydate/rails.rb
|
71
72
|
- lib/laydate/rails/version.rb
|
72
|
-
- vendor/assets/fonts/
|
73
|
-
- vendor/assets/fonts/
|
74
|
-
- vendor/assets/fonts/
|
75
|
-
- vendor/assets/fonts/
|
73
|
+
- vendor/assets/fonts/iconfont.eot
|
74
|
+
- vendor/assets/fonts/iconfont.svg
|
75
|
+
- vendor/assets/fonts/iconfont.ttf
|
76
|
+
- vendor/assets/fonts/iconfont.woff
|
76
77
|
- vendor/assets/javascripts/laydate.js
|
77
78
|
- vendor/assets/stylesheets/laydate.css
|
78
79
|
homepage: https://www.layui.com/laydate
|