active_admin_datetimepicker 0.7.4 → 1.0.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
2
  SHA256:
3
- metadata.gz: 15f98b11567aa0f6a378da8943a0f3fc48512906dbc4c43c8589e5cfb1238172
4
- data.tar.gz: e5b599f3c441b9843545156228eef9db4e4d7727606844c0beff5416d46e62fc
3
+ metadata.gz: 6d14c8bf962657fbcbb8aad0e9c3133583af752ad7988c5d8505afd065f588d4
4
+ data.tar.gz: be5c65e10479834f0da606a7649473f19182fd49ab6d7a0ac87bf3be20871404
5
5
  SHA512:
6
- metadata.gz: 15c365b5f317889da065fa694cf64cfd68a289e26f9407df5e41436dab71c3991a226c5dcb181b22be70625d392e58828af6962bc0f7be18e0cbb37072c5a794
7
- data.tar.gz: 8a3813adde99405f377f87779038702fcd877b4a73abe05908d3075a126f4c7e6f374e5828f377014b8c1f76d6595a9720be4c6b9ecb05e8c35d8623985ac47e
6
+ metadata.gz: 2274eb012d94b43a8145ed5f803862a0ff4397074af4059d20958d88d35fcd62c2867125a01d22968492543174543735afd35c5173b2da60e2238209ef435ee6
7
+ data.tar.gz: e5f25cb849a2577be0aa6af197300075eda084373328d5be653e9f956dd5c291cb268b86d34f7a5543e7862f932d8de2726510b163b3819d66fa188d18d7afca
@@ -0,0 +1,39 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - master
7
+ jobs:
8
+ test:
9
+ name: Tests with Ruby ${{ matrix.ruby }} Rails ${{ matrix.rails }} Active Admin ${{ matrix.activeadmin }}
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby:
14
+ - 2.5
15
+ - 2.6
16
+ rails:
17
+ - '5.2.0'
18
+ - '6.0.0'
19
+ activeadmin:
20
+ - '2.0.0'
21
+ - '2.6.0'
22
+ exclude:
23
+ - rails: '5.2.0'
24
+ activeadmin: '2.6.0'
25
+ - rails: '6.0.0'
26
+ activeadmin: '2.0.0'
27
+ env:
28
+ RAILS: ${{ matrix.rails }}
29
+ AA: ${{ matrix.activeadmin }}
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: actions/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ - name: Run tests
36
+ run: |
37
+ gem install bundler -v '< 2'
38
+ bundle install
39
+ bundle exec rspec spec
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/active_admin_datetimepicker.svg)](http://badge.fury.io/rb/active_admin_datetimepicker)
2
+ [![NPM Version](https://badge.fury.io/js/@activeadmin-plugins%2Factive_admin_datetimepicker.svg)](https://badge.fury.io/js/@activeadmin-plugins%2Factive_admin_datetimepicker)
3
+ [![npm](https://img.shields.io/npm/dm/active_admin_datetimepicker.svg)](https://www.npmjs.com/package/@activeadmin-plugins/active_admin_datetimepicker)
2
4
  [![Build Status](https://img.shields.io/travis/activeadmin-plugins/active_admin_datetimepicker.svg)](https://travis-ci.org/activeadmin-plugins/active_admin_datetimepicker)
3
5
  [![Coverage](https://coveralls.io/repos/activeadmin-plugins/active_admin_datetimepicker/badge.svg?branch=master)](https://coveralls.io/r/activeadmin-plugins/active_admin_datetimepicker)
4
6
 
@@ -24,7 +26,8 @@ Or install it yourself as:
24
26
 
25
27
  $ gem install active_admin_datetimepicker
26
28
 
27
- Add the following line into `app/assets/stylesheets/active_admin.css.scss`:
29
+ ##### Using assets via Sprockets
30
+ Add the following line into `app/assets/stylesheets/active_admin.scss`:
28
31
 
29
32
  ```css
30
33
  @import "active_admin_datetimepicker";
@@ -36,10 +39,42 @@ Add the following line into `app/assets/javascripts/active_admin.js`:
36
39
  //= require active_admin_datetimepicker
37
40
  ```
38
41
 
42
+ ##### Using assets via Webpacker (or any other assets bundler) as a NPM module (Yarn package)
43
+
44
+ Execute:
45
+
46
+ $ npm i @activeadmin-plugins/active_admin_datetimepicker
47
+
48
+ Or
49
+
50
+ $ yarn add @activeadmin-plugins/active_admin_datetimepicker
51
+
52
+ Or add manually to `package.json`:
53
+
54
+ ```
55
+ "dependencies": {
56
+ "@activeadmin-plugins/active_admin_datetimepicker": "1.0.0"
57
+ }
58
+ ```
59
+ and execute:
60
+
61
+ $ yarn
62
+
63
+ Add the following line into `app/assets/javascripts/active_admin.js`:
64
+
65
+ ```javascript
66
+ import '@activeadmin-plugins/active_admin_datetimepicker';
67
+ ```
68
+
69
+ Add the following line into `app/assets/stylesheets/active_admin.scss`:
70
+
71
+ ```css
72
+ @import '@activeadmin-plugins/active_admin_datetimepicker';
73
+ ```
39
74
 
40
75
  ## Usage
41
76
 
42
- This plugin adds the `date_time_picker` input and `date_time_range` filter, which use the [XDSoft DateTime Picker gem](https://github.com/shekibobo/xdan-datetimepicker-rails).
77
+ This plugin adds the `date_time_picker` input and `date_time_range` filter, which use the [XDSoft DateTime Picker](https://github.com/xdan/datetimepicker/).
43
78
 
44
79
  The `date_time_picker` input accepts many of the options available to the standard jQueryUI Datepicker. For example:
45
80
 
@@ -19,7 +19,5 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "coffee-rails"
23
- spec.add_dependency "activeadmin", ">= 1.1", "< 3.a"
24
- spec.add_dependency "xdan-datetimepicker-rails", "~> 2.5.4"
22
+ spec.add_dependency "activeadmin", ">= 2.0", "< 3.a"
25
23
  end
@@ -0,0 +1,25 @@
1
+ //= require vendor/jquery.datetimepicker.full
2
+
3
+ function setupDateTimePicker(container) {
4
+ const defaults = {
5
+ formatDate: 'y-m-d',
6
+ format: 'Y-m-d H:i',
7
+ allowBlank: true,
8
+ defaultSelect: false,
9
+ validateOnBlur: false
10
+ }
11
+
12
+ $(container).find('input.date-time-picker').each(function(index, entry) {
13
+ $(entry).datetimepicker($.extend(defaults, $(entry).data('datepicker-options')));
14
+ });
15
+ }
16
+
17
+ function initXdanDateTimePickerPlugin() {
18
+ setupDateTimePicker($('body'));
19
+ $(document).on('has_many_add:after', '.has_many_container', function(e, fieldset) {
20
+ setupDateTimePicker(fieldset);
21
+ });
22
+ }
23
+
24
+ $(document).ready(initXdanDateTimePickerPlugin);
25
+ $(document).on('turbolinks:load', initXdanDateTimePickerPlugin());