Skip to content

Commit 2dd537a

Browse files
committed
Replace xdan-datetimepicker-rails gem on jquery-datetimepicker NPM package
1 parent 9a7993b commit 2dd537a

File tree

10 files changed

+56
-6
lines changed

10 files changed

+56
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ jobs:
3939
run: |
4040
gem install bundler -v '< 2'
4141
bundle install
42+
yarn install
4243
bundle exec rspec spec

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ spec/rails/rails-*
55
pkg
66
.bundle
77
vendor/bundl
8+
9+
/public/packs
10+
/public/packs-test
11+
/public/assets
12+
/node_modules
13+
/yarn-error.log
14+
yarn-debug.log*
15+
.yarn-integrity

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gem 'active_admin_datetimepicker'
1818

1919
And then execute:
2020

21-
$ bundle
21+
$ bundle && yarn
2222

2323
Or install it yourself as:
2424

@@ -39,7 +39,17 @@ Add the following line into `app/assets/javascripts/active_admin.js`:
3939

4040
## Usage
4141

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).
42+
This plugin adds the `date_time_picker` input and `date_time_range` filter, which use the [XDSoft DateTime Picker NPM package](https://github.com/xdan/datetimepicker).
43+
#### If you use Webpacker
44+
Will be enough to run `bundle && yarn`, but if you want to install `jquery-datetimepicker` with different version just run `yarn add jquery-datetimepicker@^2.5.4`
45+
#### If you use only Sprockets
46+
You should make sure about presence the `jquery-datetimepicker` into `node_modules` and `node_modules` correct load to you project `config/initializers/assets.rb`:
47+
```
48+
Rails.application.config.assets.paths << Rails.root.join('node_modules')
49+
```
50+
helpful articles:
51+
- [Rails importing JavaScript packages from node_modules with assets pipeline(without webpacker](https://medium.com/@elicloudh/rails-importing-javascript-packages-from-node-modules-with-assets-pipeline-without-webpacker-98d985b22cea)
52+
- [Rails 5.1, the proof of the maturity of the ecosystem](https://g3ortega.com/rails/2017/05/30/rails-5-1-and-forward-yarn-on-rails.html)
4353

4454
The `date_time_picker` input accepts many of the options available to the standard jQueryUI Datepicker. For example:
4555

active_admin_datetimepicker.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ Gem::Specification.new do |spec|
2121

2222
spec.add_dependency "coffee-rails"
2323
spec.add_dependency "activeadmin", ">= 1.1", "< 3.a"
24-
spec.add_dependency "xdan-datetimepicker-rails", "~> 2.5.4"
2524
end

app/assets/javascripts/active_admin_datetimepicker.js.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#= require jquery.xdan.datetimepicker.full
1+
#= require jquery-datetimepicker/build/jquery.datetimepicker.full.min.js
22

33
@setupDateTimePicker = (container) ->
44
defaults = {

config/initializers/active_admin_datetimepicker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ActiveAdmin.setup do |config|
2-
config.register_stylesheet 'jquery.xdan.datetimepicker.css'
2+
config.register_stylesheet 'jquery-datetimepicker/build/jquery.datetimepicker.min.css'
33
end
44

55
Ransack.configure do |config|

lib/active_admin_datetimepicker.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'activeadmin'
2-
require 'xdan-datetimepicker-rails'
32
require 'active_admin_datetimepicker/version'
43
require 'active_admin_datetimepicker/base'
54
require 'active_admin_datetimepicker/inputs/date_time_picker_input'

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"jquery-datetimepicker": "^2.5.4"
4+
}
5+
}

spec/support/rails_template.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
generate :'active_admin:install --skip-users'
2323
generate :'formtastic:install'
24+
run 'yarn add jquery-datetimepicker@^2.5.4'
2425

2526
# Install active_admin_date_time_datetimepicker assets
2627
inject_into_file "app/assets/stylesheets/active_admin.scss",

yarn.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
jquery-datetimepicker@^2.5.4:
6+
version "2.5.21"
7+
resolved "https://registry.yarnpkg.com/jquery-datetimepicker/-/jquery-datetimepicker-2.5.21.tgz#00c388a78df2732fedfdb5c6529b6e84d53e0235"
8+
integrity sha512-wDTpZ4f1PWd1XGaIIE0n6jLynlm+akBJ7/NjaB1bk2UJSS593CHJPZ3+FNEXoyvNVUeBlBC0oX6WTfCyfUhX/w==
9+
dependencies:
10+
jquery ">= 1.7.2"
11+
jquery-mousewheel ">= 3.1.13"
12+
php-date-formatter "^1.3.4"
13+
14+
"jquery-mousewheel@>= 3.1.13":
15+
version "3.1.13"
16+
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
17+
integrity sha1-BvAzXxbjU6aV5yBr9QUDy1I6buU=
18+
19+
"jquery@>= 1.7.2":
20+
version "3.6.0"
21+
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470"
22+
integrity sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==
23+
24+
php-date-formatter@^1.3.4:
25+
version "1.3.6"
26+
resolved "https://registry.yarnpkg.com/php-date-formatter/-/php-date-formatter-1.3.6.tgz#6d67359da890c742005fa89d20be3ded31cc1d2a"
27+
integrity sha512-/CKsZYmAwXeNh8KpD/CF9hcJDZNhdb2ICN8+qgqOt5sUu9liZIxZ1R284TNj5MtPt8RjG5X0xn6WSqL0kcKMBg==

0 commit comments

Comments
 (0)