active_admin_datetimepicker 2.0.0 → 2.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a412a3cb88c5eb14cebad912cfa50ada6975101677646d706acda30d6c640c1e
4
- data.tar.gz: 1dc79d1cbec67a1ff6dc2d83f31acc64aeb18b57062bf0c4a972e90981780f4e
3
+ metadata.gz: 2fcbf5dabe33507c8eac39d407c1f3834daf47773d6d0ebd7aca2d77291d5401
4
+ data.tar.gz: 99facdae8b8ba1ed1f1c5b5be44a888899ccd71524bd735852726715457499f4
5
5
  SHA512:
6
- metadata.gz: 4df596944f75400400a868191653398e29fc35d2592cdce04ecc9a9a3fea4c198367bd90b99335af7d145d58e0f31a56d9e3dc7cf1977714216799356d685dd9
7
- data.tar.gz: cfbc25279cb4250ebf00a5d6f2e09e7b7119e0eae6c19fd73e44fe9f454627a0374ede49fb06aede1726c6b7de7d70c533f3516754438ce90acbcc96527891d3
6
+ metadata.gz: 8d07649d493e428c8e922025f5374389e89e2340e52087bff17eb963dbb3b82e11f6989643924330410ebd767c29b32e1997d0fba73c90af7a889b5a0b613b61
7
+ data.tar.gz: b3505a963858aac440411d5e9a908e8d8290d75ecd353929112187f4e8ada1d688e28ad63e0a115f10793f7942b515f472ec35cf2c043cca23170233fa05ac00
data/README.md CHANGED
@@ -118,6 +118,34 @@ ActiveAdminDatetimepicker::Base.format = "%d/%m/%Y %H:%M" # Ruby format
118
118
 
119
119
  See [the datetimepicker documentation for more details](http://xdsoft.net/jqplugins/datetimepicker/).
120
120
 
121
+ ## Theming
122
+
123
+ ### Accent color
124
+
125
+ The upstream XDSoft stylesheet hardcodes a bright blue (`#33aaff`) on the
126
+ selected/current day, the current time slot and "today". This gem exposes that
127
+ color as a single SCSS variable so you can recolor the whole picker without
128
+ `!important` overrides. Set it **before** importing the gem; the default keeps
129
+ the original blue, so existing apps are unaffected:
130
+
131
+ ```scss
132
+ $aa-datetimepicker-accent-color: #38678b; // your brand color
133
+ @import "active_admin_datetimepicker";
134
+ ```
135
+
136
+ ### Dark mode
137
+
138
+ The picker follows the host's dark theme using the same triggers as
139
+ [`active_admin_theme`](https://github.com/activeadmin-plugins/active_admin_theme):
140
+ the OS `prefers-color-scheme: dark` preference and an explicit
141
+ `html[data-theme="dark"]`. Under either, the picker adopts XDSoft's built-in
142
+ `.xdsoft_dark` skin (its orange current/today, dark surfaces). A page pinned
143
+ with `html[data-theme="light"]` always stays light. No configuration is needed;
144
+ it works out of the box once the gem's stylesheet is imported.
145
+
146
+ Note: in dark mode the current/today cells use XDSoft's built-in dark skin
147
+ colors, not `$aa-datetimepicker-accent-color`.
148
+
121
149
 
122
150
  ## Contributing
123
151
 
@@ -45,3 +45,159 @@ div.xdsoft_datetimepicker {
45
45
  }
46
46
  }
47
47
 
48
+
49
+ // --- Configurable accent color ---------------------------------------------
50
+ // Upstream xdsoft hardcodes a bright blue (#33aaff) on the selected/current day,
51
+ // the current time slot and "today". There is no vendor variable for it, so host
52
+ // apps used to resort to !important overrides. Expose it two ways:
53
+ //
54
+ // * `$aa-datetimepicker-accent-color` — a compile-time SCSS variable, set it
55
+ // before importing this gem.
56
+ // * `--aa-datetimepicker-accent` — a runtime CSS custom property. Prefer this
57
+ // in sprockets apps: a SCSS variable set in the host manifest does NOT reach
58
+ // this gem's partial across a sprockets `@import` (separate compilation
59
+ // scope), whereas a CSS custom property flows through the cascade regardless.
60
+ // Set it on `:root` (or `html[data-theme=...]` for per-mode values).
61
+ //
62
+ // Both default to the original blue, so existing apps see no change unless they
63
+ // opt in. The CSS property wins when set; otherwise it falls back to the SCSS
64
+ // variable's value.
65
+ $aa-datetimepicker-accent-color: #33aaff !default;
66
+ $-aa-dtp-accent: var(--aa-datetimepicker-accent, #{$aa-datetimepicker-accent-color});
67
+
68
+ // Dark-mode surface/text/border, same idea as the accent: runtime CSS custom
69
+ // properties so a themed host can bind the picker to its own dark palette
70
+ // (e.g. `--aa-datetimepicker-surface: var(--aa-surface)`), with fallbacks that
71
+ // are a soft dark rather than pure black so the picker is usable out of the box.
72
+ $-aa-dtp-surface: var(--aa-datetimepicker-surface, #1f242a);
73
+ $-aa-dtp-surface-2: var(--aa-datetimepicker-surface-2, #262c33);
74
+ $-aa-dtp-text: var(--aa-datetimepicker-text, #cfd3d8);
75
+ $-aa-dtp-text-muted: var(--aa-datetimepicker-text-muted, #8a9099);
76
+ $-aa-dtp-border: var(--aa-datetimepicker-border, #3a4048);
77
+ $-aa-dtp-hover: var(--aa-datetimepicker-hover, #2e353d);
78
+
79
+ div.xdsoft_datetimepicker {
80
+ .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current,
81
+ .xdsoft_calendar td.xdsoft_current,
82
+ .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current {
83
+ background: $-aa-dtp-accent;
84
+ }
85
+
86
+ // "today" is a text color, not a fill
87
+ .xdsoft_calendar td.xdsoft_today {
88
+ color: $-aa-dtp-accent;
89
+ }
90
+
91
+ // When today is also the selected cell, its accent fill needs light text
92
+ // (otherwise accent-on-accent hides the number).
93
+ .xdsoft_calendar td.xdsoft_today.xdsoft_current {
94
+ color: #fff;
95
+ }
96
+
97
+ .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover,
98
+ .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current.xdsoft_disabled:hover {
99
+ background: $-aa-dtp-accent !important;
100
+ }
101
+ }
102
+
103
+
104
+ // --- Dark mode -------------------------------------------------------------
105
+ // Follow the host's dark theme using the same triggers active_admin_theme uses:
106
+ // the OS `prefers-color-scheme` preference (unless the page is pinned light) and
107
+ // an explicit `html[data-theme="dark"]`. Rather than invent new dark colors we
108
+ // reuse xdsoft's own built-in `.xdsoft_dark` skin, re-scoped onto
109
+ // `.xdsoft_datetimepicker` directly (the picker is appended to <body>, so it can
110
+ // never carry the `.xdsoft_dark` class on its own). A `[data-theme="light"]`
111
+ // page always stays light.
112
+ @mixin aa-datetimepicker-dark {
113
+ .xdsoft_datetimepicker {
114
+ box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.6);
115
+ background: $-aa-dtp-surface;
116
+ border: 1px solid $-aa-dtp-border;
117
+ color: $-aa-dtp-text;
118
+
119
+ .xdsoft_timepicker .xdsoft_time_box {
120
+ border: 1px solid $-aa-dtp-border;
121
+ }
122
+ .xdsoft_timepicker .xdsoft_time_box > div > div {
123
+ background: $-aa-dtp-surface;
124
+ border-top: 1px solid $-aa-dtp-border;
125
+ color: $-aa-dtp-text;
126
+ }
127
+
128
+ .xdsoft_label {
129
+ background-color: $-aa-dtp-surface;
130
+ }
131
+ .xdsoft_label > .xdsoft_select {
132
+ border: 1px solid $-aa-dtp-border;
133
+ background: $-aa-dtp-surface;
134
+ }
135
+ .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
136
+ color: $-aa-dtp-text;
137
+ background: $-aa-dtp-hover;
138
+ }
139
+ .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
140
+ background: $-aa-dtp-accent;
141
+ box-shadow: none;
142
+ color: #fff;
143
+ }
144
+
145
+ .xdsoft_calendar td,
146
+ .xdsoft_calendar th {
147
+ background: $-aa-dtp-surface;
148
+ border: 1px solid $-aa-dtp-border;
149
+ color: $-aa-dtp-text;
150
+ }
151
+ .xdsoft_calendar th {
152
+ background: $-aa-dtp-surface-2;
153
+ color: $-aa-dtp-text-muted;
154
+ }
155
+ .xdsoft_calendar td.xdsoft_other_month,
156
+ .xdsoft_calendar td.xdsoft_disabled {
157
+ color: $-aa-dtp-text-muted;
158
+ }
159
+ .xdsoft_calendar td.xdsoft_today {
160
+ color: $-aa-dtp-accent;
161
+ }
162
+ .xdsoft_calendar td.xdsoft_default,
163
+ .xdsoft_calendar td.xdsoft_current,
164
+ .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current {
165
+ background: $-aa-dtp-accent;
166
+ box-shadow: none;
167
+ color: #fff;
168
+ }
169
+ .xdsoft_calendar td:hover:not(.xdsoft_current),
170
+ .xdsoft_timepicker .xdsoft_time_box > div > div:hover:not(.xdsoft_current) {
171
+ color: $-aa-dtp-text !important;
172
+ background: $-aa-dtp-hover !important;
173
+ }
174
+
175
+ .xdsoft_scrollbar > .xdsoft_scroller {
176
+ background: $-aa-dtp-border !important;
177
+ }
178
+
179
+ // Month prev/next, the "today" home button and the time-column up/down
180
+ // scrollers are a dark PNG sprite with no vendor variable — on the dark
181
+ // surface they disappear. Invert so the arrows read as light icons. The
182
+ // time scrollers also carry .xdsoft_prev/.xdsoft_next, so they're covered.
183
+ .xdsoft_prev,
184
+ .xdsoft_next,
185
+ .xdsoft_today_button {
186
+ filter: invert(1);
187
+ }
188
+
189
+ .xdsoft_copyright {
190
+ color: $-aa-dtp-text-muted !important;
191
+ a { color: $-aa-dtp-text !important; }
192
+ a:hover { color: $-aa-dtp-text-muted !important; }
193
+ }
194
+ }
195
+ }
196
+
197
+ // OS preference, unless the user explicitly chose light
198
+ @media (prefers-color-scheme: dark) {
199
+ html:not([data-theme="light"]) { @include aa-datetimepicker-dark; }
200
+ }
201
+ // Explicit user choice always wins
202
+ html[data-theme="dark"] { @include aa-datetimepicker-dark; }
203
+
@@ -1,3 +1,3 @@
1
1
  module ActiveAdminDatetimepicker
2
- VERSION = "2.0.0"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin_datetimepicker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Fedoronchuk
@@ -36,14 +36,8 @@ executables: []
36
36
  extensions: []
37
37
  extra_rdoc_files: []
38
38
  files:
39
- - ".github/workflows/ci.yml"
40
- - ".gitignore"
41
- - CODE_OF_CONDUCT.md
42
- - Gemfile
43
39
  - LICENSE.txt
44
40
  - README.md
45
- - Rakefile
46
- - active_admin_datetimepicker.gemspec
47
41
  - app/assets/javascripts/active_admin_datetimepicker.js
48
42
  - app/assets/javascripts/vendor/jquery.datetimepicker.full.js
49
43
  - app/assets/stylesheets/active_admin_datetimepicker.scss
@@ -54,9 +48,6 @@ files:
54
48
  - lib/active_admin_datetimepicker/inputs/date_time_picker_input.rb
55
49
  - lib/active_admin_datetimepicker/inputs/filters/date_time_range_input.rb
56
50
  - lib/active_admin_datetimepicker/version.rb
57
- - package.json
58
- - screen/screen.png
59
- - tasks/test.rake
60
51
  homepage: https://github.com/activeadmin-plugins/activeadmin_datetimepicker
61
52
  licenses:
62
53
  - MIT
@@ -68,14 +59,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
59
  requirements:
69
60
  - - ">="
70
61
  - !ruby/object:Gem::Version
71
- version: 3.1.0
62
+ version: '3.3'
72
63
  required_rubygems_version: !ruby/object:Gem::Requirement
73
64
  requirements:
74
65
  - - ">="
75
66
  - !ruby/object:Gem::Version
76
67
  version: '0'
77
68
  requirements: []
78
- rubygems_version: 3.7.1
69
+ rubygems_version: 4.0.20
79
70
  specification_version: 4
80
71
  summary: datetimepicker extension for ActiveAdmin
81
72
  test_files: []
@@ -1,91 +0,0 @@
1
- name: CI
2
- on:
3
- pull_request:
4
- push:
5
- branches: [master]
6
-
7
- permissions:
8
- contents: read
9
- pages: write
10
- id-token: write
11
-
12
- jobs:
13
- test:
14
- name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} / AA ${{ matrix.activeadmin }}
15
- runs-on: ubuntu-latest
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: ['3.2', '3.3', '3.4']
20
- rails: ['7.1.0', '7.2.0', '8.0.0']
21
- activeadmin: ['3.2.0', '3.3.0', '3.4.0', '3.5.1']
22
- exclude:
23
- - rails: '8.0.0'
24
- activeadmin: '3.2.0'
25
- env:
26
- RAILS: ${{ matrix.rails }}
27
- AA: ${{ matrix.activeadmin }}
28
- steps:
29
- - uses: actions/checkout@v4
30
- - uses: ruby/setup-ruby@v1
31
- with:
32
- ruby-version: ${{ matrix.ruby }}
33
- bundler-cache: true
34
- - name: Run tests
35
- run: bundle exec rspec spec
36
-
37
- - name: Generate badge.json
38
- if: matrix.ruby == '3.4' && matrix.rails == '8.0.0' && matrix.activeadmin == '3.5.1'
39
- run: |
40
- LAST_RUN="coverage/.last_run.json"
41
- if [ ! -f "$LAST_RUN" ]; then
42
- mkdir -p badge
43
- echo '{"schemaVersion":1,"label":"coverage","message":"unknown","color":"lightgrey"}' > badge/badge.json
44
- exit 0
45
- fi
46
- PERCENT=$(ruby -rjson -e "puts JSON.parse(File.read('$LAST_RUN')).dig('result','line').round(1)")
47
- PERCENT_NUM=$(ruby -rjson -e "puts JSON.parse(File.read('$LAST_RUN')).dig('result','line')")
48
- if ruby -e "exit(($PERCENT_NUM >= 90) ? 0 : 1)"; then COLOR="brightgreen"
49
- elif ruby -e "exit(($PERCENT_NUM >= 75) ? 0 : 1)"; then COLOR="green"
50
- elif ruby -e "exit(($PERCENT_NUM >= 60) ? 0 : 1)"; then COLOR="yellow"
51
- else COLOR="red"; fi
52
- mkdir -p badge
53
- echo "{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"${PERCENT}%\",\"color\":\"${COLOR}\"}" > badge/badge.json
54
-
55
- - name: Upload badge artifact
56
- if: matrix.ruby == '3.4' && matrix.rails == '8.0.0' && matrix.activeadmin == '3.5.1'
57
- uses: actions/upload-artifact@v4
58
- with:
59
- name: coverage-badge
60
- path: badge
61
-
62
- deploy-coverage:
63
- needs: test
64
- if: github.ref == 'refs/heads/master' && github.event_name == 'push'
65
- runs-on: ubuntu-latest
66
- environment:
67
- name: github-pages
68
- url: ${{ steps.deployment.outputs.page_url }}
69
-
70
- steps:
71
- - uses: actions/checkout@v4
72
- with:
73
- ref: gh-pages
74
-
75
- - name: Download coverage badge
76
- uses: actions/download-artifact@v4
77
- with:
78
- name: coverage-badge
79
- path: .
80
-
81
- - name: Setup Pages
82
- uses: actions/configure-pages@v5
83
-
84
- - name: Upload Pages artifact
85
- uses: actions/upload-pages-artifact@v3
86
- with:
87
- path: .
88
-
89
- - name: Deploy to GitHub Pages
90
- id: deployment
91
- uses: actions/deploy-pages@v4
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- bin/
2
- Gemfile.lock
3
- coverage/
4
- spec/rails/rails-*
5
- pkg
6
- .bundle
7
- vendor/bundl
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile DELETED
@@ -1,20 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- default_rails_version = '7.1.0'
5
- default_activeadmin_version = '3.2.0'
6
-
7
- gem 'rails', "~> #{ENV['RAILS'] || default_rails_version}"
8
- gem 'activeadmin', "~> #{ENV['AA'] || default_activeadmin_version}"
9
- gem 'sprockets-rails'
10
- gem 'sass-rails'
11
-
12
- group :test do
13
- gem 'simplecov', require: false
14
- gem 'rspec-rails'
15
- gem 'sqlite3', '~> 2.0'
16
- gem 'database_cleaner'
17
- gem 'capybara'
18
- gem 'cuprite'
19
- gem 'webrick', require: false
20
- end
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- require "bundler"
2
- require 'rake'
3
- Bundler.setup
4
- Bundler::GemHelper.install_tasks
5
-
6
- # Import all our rake tasks
7
- FileList['tasks/**/*.rake'].each { |task| import task }
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'active_admin_datetimepicker/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "active_admin_datetimepicker"
8
- spec.version = ActiveAdminDatetimepicker::VERSION
9
- spec.authors = ["Igor Fedoronchuk"]
10
- spec.email = ["fedoronchuk@gmail.com"]
11
-
12
- spec.summary = %q{datetimepicker extension for ActiveAdmin}
13
- spec.description = %q{Integrate jQuery xdan datetimepicker plugin to ActiveAdmin}
14
- spec.homepage = "https://github.com/activeadmin-plugins/activeadmin_datetimepicker"
15
- spec.license = "MIT"
16
-
17
- spec.required_ruby_version = '>= 3.1.0'
18
-
19
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- spec.bindir = "bin"
21
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_dependency "activeadmin", ">= 3.0", "< 4.0"
25
- end
data/package.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "name": "@activeadmin-plugins/active_admin_datetimepicker",
3
- "version": "2.0.0",
4
- "description": "Integrate jQuery xdan datetimepicker plugin to ActiveAdmin",
5
- "main": "src/active_admin_datetimepicker.js",
6
- "style": "src/active_admin_datetimepicker.scss",
7
- "author": "Igor Fedoronchuk <fedoronchuk@gmail.com>",
8
- "license": "MIT",
9
- "private": false,
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/activeadmin-plugins/active_admin_datetimepicker.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/activeadmin-plugins/active_admin_datetimepicker/issues"
16
- },
17
- "homepage": "https://github.com/activeadmin-plugins/active_admin_datetimepicker#readme",
18
- "keywords": [
19
- "active",
20
- "admin",
21
- "datetimepicker"
22
- ],
23
- "files": [
24
- "src/**/*",
25
- "!src/*.bak"
26
- ],
27
- "scripts": {
28
- "prepare_src": "rm -rf src && cp -R app/assets/javascripts/ src && cp -R app/assets/stylesheets/ src",
29
- "prepare_import": "sed -i.bak 1s/'\\/\\/\\= require vendor\\/jquery.datetimepicker.full'/\"import '.\\/vendor\\/jquery.datetimepicker.full';\"/ src/active_admin_datetimepicker.js",
30
- "prepublishOnly": "npm run prepare_src && npm run prepare_import"
31
- },
32
- "dependencies": {
33
- "jquery-mousewheel": ">= 3.1.13"
34
- }
35
- }
data/screen/screen.png DELETED
Binary file
data/tasks/test.rake DELETED
@@ -1,13 +0,0 @@
1
- desc "Creates a test rails app for the specs to run against"
2
- task :setup do
3
- require 'rails/version'
4
-
5
- rails_new_opts = %w(
6
- --skip-turbolinks
7
- --skip-spring
8
- --skip-bootsnap
9
- -m
10
- spec/support/rails_template.rb
11
- )
12
- system "bundle exec rails new spec/rails/rails-#{Rails::VERSION::STRING} #{rails_new_opts.join(' ')}"
13
- end