cm-admin 3.0.15 → 4.0.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 +4 -4
- data/Gemfile.lock +3 -12
- data/app/assets/javascripts/cm_admin/custom_action.js +5 -1
- data/app/assets/javascripts/cm_admin/filters.js +3 -0
- data/app/helpers/cm_admin/application_helper.rb +0 -5
- data/app/views/layouts/cm_admin.html.slim +4 -10
- data/app/views/layouts/static.html.slim +1 -4
- data/cm_admin.gemspec +2 -3
- data/docs/CustomFilterMethod.md +53 -0
- data/lib/cm_admin/engine.rb +13 -38
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/version_manager.rb +4 -8
- data/lib/cm_admin.rb +0 -7
- metadata +7 -33
- data/app/javascript/packs/cm_admin/application.js +0 -27
- data/app/javascript/packs/cm_admin/scaffolds.js +0 -5
- data/app/javascript/stylesheets/cm_admin/application.scss +0 -3
- data/bin/webpack +0 -18
- data/bin/webpack-dev-server +0 -18
- data/config/.DS_Store +0 -0
- data/config/webpack/development.js +0 -5
- data/config/webpack/environment.js +0 -13
- data/config/webpack/production.js +0 -5
- data/config/webpack/test.js +0 -5
- data/config/webpacker.yml +0 -92
- data/lib/.DS_Store +0 -0
- data/lib/tasks/webpack_install.rake +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 758deeaf34976fadccc5e68a438f0ba2cc3fe7f519431ffe750c740c162b92c7
|
4
|
+
data.tar.gz: 770661bd71b01b11ec2f50c4a88adf8a182d6d082e0b8415ef099df8559e8279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e87eb00d34c7c2e601078d815d6137ef4eddb22d543294d33301a102b3f9ff2931f46e353a832db435441df81cb32d198d06824bd8cef82984440fc0ef5186d5
|
7
|
+
data.tar.gz: 594fcf9d069ef492dfb469e22cb4b609ea3b6d4c6acbf1404080c3d9e8b18ed2fa416ef2122a7035c9a53dc8dc915ae6724a768e1aa74fec16bd5735c9879cef
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cm-admin (
|
4
|
+
cm-admin (4.0.0)
|
5
5
|
caxlsx_rails
|
6
6
|
cocoon (~> 1.2.15)
|
7
7
|
csv-importer (~> 0.8.2)
|
@@ -9,9 +9,8 @@ PATH
|
|
9
9
|
local_time (~> 3.0.2)
|
10
10
|
pagy (~> 4.11.0)
|
11
11
|
pundit (~> 2.2.0)
|
12
|
-
rails (>=
|
13
|
-
slim (
|
14
|
-
webpacker (~> 5.4.3)
|
12
|
+
rails (>= 7.0)
|
13
|
+
slim (>= 4.1.0)
|
15
14
|
|
16
15
|
GEM
|
17
16
|
remote: https://rubygems.org/
|
@@ -178,8 +177,6 @@ GEM
|
|
178
177
|
activesupport (>= 3.0.0)
|
179
178
|
racc (1.8.1)
|
180
179
|
rack (3.1.8)
|
181
|
-
rack-proxy (0.7.7)
|
182
|
-
rack
|
183
180
|
rack-session (2.0.0)
|
184
181
|
rack (>= 3.0.0)
|
185
182
|
rack-test (2.1.0)
|
@@ -258,7 +255,6 @@ GEM
|
|
258
255
|
rubocop-ast (>= 1.31.1, < 2.0)
|
259
256
|
ruby-progressbar (1.13.0)
|
260
257
|
rubyzip (2.3.2)
|
261
|
-
semantic_range (3.0.0)
|
262
258
|
slim (4.1.0)
|
263
259
|
temple (>= 0.7.6, < 0.9)
|
264
260
|
tilt (>= 2.0.6, < 2.1)
|
@@ -275,11 +271,6 @@ GEM
|
|
275
271
|
axiom-types (~> 0.1)
|
276
272
|
coercible (~> 1.0)
|
277
273
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
278
|
-
webpacker (5.4.4)
|
279
|
-
activesupport (>= 5.2)
|
280
|
-
rack-proxy (>= 0.6.1)
|
281
|
-
railties (>= 5.2)
|
282
|
-
semantic_range (>= 2.3.0)
|
283
274
|
webrick (1.8.2)
|
284
275
|
websocket-driver (0.7.6)
|
285
276
|
websocket-extensions (>= 0.1.0)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as bootstrap from "bootstrap";
|
2
2
|
window.bootstrap = bootstrap;
|
3
3
|
|
4
|
-
|
4
|
+
export function handleFetchModalClick() {
|
5
5
|
$('[data-action="fetch-modal"]').on("click", function (e) {
|
6
6
|
const actionName = $(this).attr("data-action_name");
|
7
7
|
const modelName = $(this).attr("data-model_name");
|
@@ -27,4 +27,8 @@ document.addEventListener("turbo:load", function () {
|
|
27
27
|
},
|
28
28
|
});
|
29
29
|
});
|
30
|
+
}
|
31
|
+
|
32
|
+
document.addEventListener("turbo:load", function () {
|
33
|
+
handleFetchModalClick();
|
30
34
|
});
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { handleFetchModalClick } from "./custom_action";
|
2
|
+
|
1
3
|
var currentRequest = null;
|
2
4
|
|
3
5
|
var CmFilter = {
|
@@ -123,6 +125,7 @@ var getFilteredData = function (
|
|
123
125
|
dropdown.show();
|
124
126
|
}
|
125
127
|
}
|
128
|
+
handleFetchModalClick();
|
126
129
|
},
|
127
130
|
error: function (jqxhr, textStatus, errorThrown) {
|
128
131
|
console.log(errorThrown, textStatus);
|
@@ -1,10 +1,5 @@
|
|
1
1
|
module CmAdmin
|
2
2
|
module ApplicationHelper
|
3
|
-
|
4
|
-
def current_webpacker_instance
|
5
|
-
CmAdmin.webpacker
|
6
|
-
end
|
7
|
-
|
8
3
|
# Allow if policy is not defined.
|
9
4
|
def has_valid_policy(ar_object, action_name)
|
10
5
|
if ar_object.instance_of?(OpenStruct) && ar_object&.parent_record.present? && ar_object&.associated_model.present?
|
@@ -20,17 +20,11 @@ html
|
|
20
20
|
meta[name="viewport" content="width=device-width,initial-scale=1"]
|
21
21
|
= csrf_meta_tags
|
22
22
|
= csp_meta_tag
|
23
|
-
= stylesheet_link_tag 'cm_admin/cm_admin', media: 'all', 'data-
|
24
|
-
|
25
|
-
|
26
|
-
= javascript_pack_tag 'cm_admin/application', 'data-turbolinks-track': 'reload'
|
27
|
-
script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"
|
28
|
-
- elsif CmAdmin::VersionManager.use_importmap?
|
29
|
-
= javascript_importmap_tags
|
30
|
-
= javascript_import_module_tag "cm_admin/application"
|
31
|
-
= javascript_include_tag 'cm_admin/custom', 'data-turbolinks-track': 'reload'
|
23
|
+
= stylesheet_link_tag 'cm_admin/cm_admin', media: 'all', 'data-turbo-track': 'reload'
|
24
|
+
= javascript_importmap_tags
|
25
|
+
= javascript_import_module_tag "cm_admin/application"
|
32
26
|
script src="https://kit.fontawesome.com/9c93dde7a7.js" data-mutate-approach="sync"
|
33
|
-
= stylesheet_link_tag 'cm_admin/custom', media: 'all', 'data-
|
27
|
+
= stylesheet_link_tag 'cm_admin/custom', media: 'all', 'data-turbo-track': 'reload'
|
34
28
|
link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /
|
35
29
|
|
36
30
|
script src="https://raw.githack.com/SortableJS/Sortable/master/Sortable.js"
|
@@ -6,10 +6,7 @@ html
|
|
6
6
|
meta[name="viewport" content="width=device-width,initial-scale=1"]
|
7
7
|
= csrf_meta_tags
|
8
8
|
= csp_meta_tag
|
9
|
-
= stylesheet_link_tag 'cm_admin/cm_admin', media: 'all', 'data-
|
10
|
-
- if CmAdmin::VersionManager.rails6?
|
11
|
-
= stylesheet_pack_tag 'cm_admin/application', 'data-turbolinks-track': 'reload'
|
12
|
-
= javascript_pack_tag 'cm_admin/application', 'data-turbolinks-track': 'reload'
|
9
|
+
= stylesheet_link_tag 'cm_admin/cm_admin', media: 'all', 'data-turbo-track': 'reload'
|
13
10
|
body
|
14
11
|
- flash.each do |type, msg|
|
15
12
|
.alert class="alert-#{type}"
|
data/cm_admin.gemspec
CHANGED
@@ -34,8 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_runtime_dependency 'local_time', '~> 3.0.2'
|
35
35
|
spec.add_runtime_dependency 'pagy', '~> 4.11.0'
|
36
36
|
spec.add_runtime_dependency 'pundit', '~> 2.2.0'
|
37
|
-
spec.add_runtime_dependency
|
38
|
-
spec.add_runtime_dependency 'slim', '
|
39
|
-
spec.add_runtime_dependency 'webpacker', '~> 5.4.3'
|
37
|
+
spec.add_runtime_dependency 'rails', '>= 7.0'
|
38
|
+
spec.add_runtime_dependency 'slim', '>= 4.1.0'
|
40
39
|
spec.add_dependency 'importmap-rails'
|
41
40
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Custom Filter Method
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
We can add a custom filter method to filter records based on specific criteria. This is useful when the default filtering options do not meet the requirements. The custom filter method can be defined using the `filter_with` option.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
The custom filter method is implemented using the `filter` dsl_method with the `filter_with` option. Below are the key elements and their usage:
|
10
|
+
|
11
|
+
### Syntax
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
filter :filter_name, :filter_type, filter_with: :custom_filter_method
|
15
|
+
```
|
16
|
+
|
17
|
+
### Example
|
18
|
+
|
19
|
+
**1. For Search and Select:**
|
20
|
+
|
21
|
+
Define the custom filter method in your model:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
class YourModel < ApplicationRecord
|
25
|
+
scope :custom_filter_method, ->(value) { where('column_name LIKE ?', "%#{value}%") }
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
Use the custom filter method in your cm admin:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
filter :filter_name, :search, filter_with: :custom_filter_method
|
33
|
+
```
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
filter :filter_name, :single_select, helper_method: :options_for_select, filter_with: :custom_filter_method
|
37
|
+
```
|
38
|
+
|
39
|
+
**2. For Date and Range:**
|
40
|
+
|
41
|
+
Define the custom filter method in your model:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
class YourModel < ApplicationRecord
|
45
|
+
scope :custom_filter_method, ->(from, to) { where('column_name BETWEEN ? AND ?', from, to) }
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
Use the custom filter method in your cm admin:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
filter :filter_name, :date, filter_with: :custom_filter_method
|
53
|
+
```
|
data/lib/cm_admin/engine.rb
CHANGED
@@ -6,56 +6,31 @@ module CmAdmin
|
|
6
6
|
class Engine < Rails::Engine
|
7
7
|
isolate_namespace CmAdmin
|
8
8
|
|
9
|
-
config.app_middleware.use(
|
10
|
-
Rack::Static,
|
11
|
-
# note! this varies from the webpacker/engine documentation
|
12
|
-
urls: ["/cm-admin-packs"], root: CmAdmin::Engine.root.join("public")
|
13
|
-
)
|
14
|
-
|
15
9
|
initializer 'RailsAdmin precompile hook', group: :all do |app|
|
16
|
-
app.config.assets.precompile += %w
|
10
|
+
app.config.assets.precompile += %w[
|
17
11
|
cm_admin/cm_admin.css
|
18
12
|
cm_admin/custom.js
|
19
13
|
cm_admin/custom.css
|
20
|
-
|
14
|
+
]
|
21
15
|
end
|
22
16
|
|
23
17
|
def mount_path
|
24
18
|
CmAdmin::Engine.routes.find_script_name({})
|
25
19
|
end
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
rescue
|
32
|
-
nil
|
33
|
-
end
|
34
|
-
next unless insert_middleware
|
21
|
+
initializer 'cm_admin.importmap', before: 'importmap' do |app|
|
22
|
+
# NOTE: this will add pins from this engine to the main app
|
23
|
+
# https://github.com/rails/importmap-rails#composing-import-maps
|
24
|
+
app.config.importmap.paths << root.join('config/importmap.rb')
|
35
25
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
webpacker: CmAdmin.webpacker
|
40
|
-
)
|
41
|
-
end
|
42
|
-
elsif VersionManager.rails7?
|
43
|
-
initializer "cm_admin.importmap", before: "importmap" do |app|
|
44
|
-
# NOTE: this will add pins from this engine to the main app
|
45
|
-
# https://github.com/rails/importmap-rails#composing-import-maps
|
46
|
-
app.config.importmap.paths << root.join("config/importmap.rb")
|
47
|
-
|
48
|
-
# NOTE: something about cache; I did not look into it.
|
49
|
-
# https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
|
50
|
-
app.config.importmap.cache_sweepers << root.join("app/assets/javascripts")
|
51
|
-
end
|
52
|
-
|
53
|
-
# NOTE: add engine manifest to precompile assets in production
|
54
|
-
initializer "cm_admin.assets" do |app|
|
55
|
-
app.config.assets.precompile += %w[cm_admin_manifest]
|
56
|
-
end
|
26
|
+
# NOTE: something about cache; I did not look into it.
|
27
|
+
# https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
|
28
|
+
app.config.importmap.cache_sweepers << root.join('app/assets/javascripts')
|
57
29
|
end
|
58
30
|
|
59
|
-
|
31
|
+
# NOTE: add engine manifest to precompile assets in production
|
32
|
+
initializer 'cm_admin.assets' do |app|
|
33
|
+
app.config.assets.precompile += %w[cm_admin_manifest]
|
34
|
+
end
|
60
35
|
end
|
61
36
|
end
|
data/lib/cm_admin/version.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
1
|
module CmAdmin
|
2
2
|
class VersionManager
|
3
3
|
class << self
|
4
|
-
def rails6?
|
5
|
-
Rails::VERSION::MAJOR == 6
|
6
|
-
end
|
7
|
-
|
8
4
|
def rails7?
|
9
5
|
Rails::VERSION::MAJOR == 7
|
10
6
|
end
|
11
7
|
|
12
|
-
def
|
13
|
-
|
8
|
+
def rails8?
|
9
|
+
Rails::VERSION::MAJOR == 8
|
14
10
|
end
|
15
11
|
|
16
|
-
def
|
17
|
-
|
12
|
+
def use_importmap?
|
13
|
+
(rails7? || rails8?) && File.exist?('config/importmap.rb')
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
data/lib/cm_admin.rb
CHANGED
@@ -16,13 +16,6 @@ module CmAdmin
|
|
16
16
|
@@cm_admin_models ||= []
|
17
17
|
|
18
18
|
class << self
|
19
|
-
def webpacker
|
20
|
-
@webpacker ||= ::Webpacker::Instance.new(
|
21
|
-
root_path: CmAdmin::Engine.root,
|
22
|
-
config_path: CmAdmin::Engine.root.join('config', 'webpacker.yml')
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
19
|
def configure
|
27
20
|
# instance_eval(&block)
|
28
21
|
@config ||= Configuration.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cm-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: exe
|
16
16
|
cert_chain: []
|
17
|
-
date: 2024-11-
|
17
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: caxlsx_rails
|
@@ -106,42 +106,28 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '7.0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '7.0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: slim
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: 4.1.0
|
124
124
|
type: :runtime
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - "
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: 4.1.0
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: webpacker
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: 5.4.3
|
138
|
-
type: :runtime
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - "~>"
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: 5.4.3
|
145
131
|
- !ruby/object:Gem::Dependency
|
146
132
|
name: importmap-rails
|
147
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -358,9 +344,6 @@ files:
|
|
358
344
|
- app/controllers/cm_admin/static_controller.rb
|
359
345
|
- app/helpers/cm_admin/application_helper.rb
|
360
346
|
- app/helpers/cm_admin/custom_helper.rb
|
361
|
-
- app/javascript/packs/cm_admin/application.js
|
362
|
-
- app/javascript/packs/cm_admin/scaffolds.js
|
363
|
-
- app/javascript/stylesheets/cm_admin/application.scss
|
364
347
|
- app/jobs/file_import_processor_job.rb
|
365
348
|
- app/models/cm_permission.rb
|
366
349
|
- app/models/cm_role.rb
|
@@ -413,24 +396,16 @@ files:
|
|
413
396
|
- bin/console
|
414
397
|
- bin/importmap
|
415
398
|
- bin/setup
|
416
|
-
- bin/webpack
|
417
|
-
- bin/webpack-dev-server
|
418
399
|
- cm_admin.gemspec
|
419
|
-
- config/.DS_Store
|
420
400
|
- config/importmap.rb
|
421
401
|
- config/initializers/active_record_extension.rb
|
422
402
|
- config/routes.rb
|
423
|
-
- config/webpack/development.js
|
424
|
-
- config/webpack/environment.js
|
425
|
-
- config/webpack/production.js
|
426
|
-
- config/webpack/test.js
|
427
|
-
- config/webpacker.yml
|
428
403
|
- docs/AddingAlert.md
|
404
|
+
- docs/CustomFilterMethod.md
|
429
405
|
- docs/ListingSelectTwoAjax.md
|
430
406
|
- docs/ListingSelectTwoItems.md
|
431
407
|
- docs/RoleManagement.md
|
432
408
|
- docs/ShowHideContent.md
|
433
|
-
- lib/.DS_Store
|
434
409
|
- lib/cm-admin.rb
|
435
410
|
- lib/cm_admin.rb
|
436
411
|
- lib/cm_admin/configuration.rb
|
@@ -497,7 +472,6 @@ files:
|
|
497
472
|
- lib/generators/cm_admin/templates/graphql/objects/base/paging_type.rb
|
498
473
|
- lib/generators/cm_admin/templates/graphql/queries/base_query.rb
|
499
474
|
- lib/generators/cm_admin/templates/policy.rb
|
500
|
-
- lib/tasks/webpack_install.rake
|
501
475
|
- package-lock.json
|
502
476
|
- package.json
|
503
477
|
- postcss.config.js
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require("@rails/ujs").start();
|
2
|
-
require("turbolinks").start();
|
3
|
-
require("@rails/activestorage").start();
|
4
|
-
require("stylesheets/cm_admin/application");
|
5
|
-
require("jquery");
|
6
|
-
require("moment");
|
7
|
-
require("bootstrap");
|
8
|
-
require("flatpickr");
|
9
|
-
require("jgrowl");
|
10
|
-
require("trix");
|
11
|
-
require("./scaffolds.js");
|
12
|
-
require("/app/assets/javascripts/cm_admin/shared_scaffolds.js");
|
13
|
-
require("/app/assets/javascripts/cm_admin/form_validation.js");
|
14
|
-
require("/app/assets/javascripts/cm_admin/quick_search.js");
|
15
|
-
require("/app/assets/javascripts/cm_admin/filters.js");
|
16
|
-
require("/app/assets/javascripts/cm_admin/exports.js");
|
17
|
-
require("/app/assets/javascripts/cm_admin/bulk_actions.js");
|
18
|
-
|
19
|
-
import jQuery from "jquery";
|
20
|
-
import LocalTime from "local-time";
|
21
|
-
window.$ = jQuery;
|
22
|
-
window.jQuery = jQuery;
|
23
|
-
|
24
|
-
LocalTime.start();
|
25
|
-
require("@nathanvda/cocoon");
|
26
|
-
import "@fortawesome/fontawesome-free/css/all";
|
27
|
-
import "daterangepicker";
|
data/bin/webpack
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development'
|
4
|
-
ENV['NODE_ENV'] ||= 'development'
|
5
|
-
|
6
|
-
require 'pathname'
|
7
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
8
|
-
Pathname.new(__FILE__).realpath)
|
9
|
-
|
10
|
-
require 'bundler/setup'
|
11
|
-
|
12
|
-
require 'webpacker'
|
13
|
-
require 'webpacker/webpack_runner'
|
14
|
-
|
15
|
-
APP_ROOT = File.expand_path('..', __dir__)
|
16
|
-
Dir.chdir(APP_ROOT) do
|
17
|
-
Webpacker::WebpackRunner.run(ARGV)
|
18
|
-
end
|
data/bin/webpack-dev-server
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development'
|
4
|
-
ENV['NODE_ENV'] ||= 'development'
|
5
|
-
|
6
|
-
require 'pathname'
|
7
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
8
|
-
Pathname.new(__FILE__).realpath)
|
9
|
-
|
10
|
-
require 'bundler/setup'
|
11
|
-
|
12
|
-
require 'webpacker'
|
13
|
-
require 'webpacker/dev_server_runner'
|
14
|
-
|
15
|
-
APP_ROOT = File.expand_path('..', __dir__)
|
16
|
-
Dir.chdir(APP_ROOT) do
|
17
|
-
Webpacker::DevServerRunner.run(ARGV)
|
18
|
-
end
|
data/config/.DS_Store
DELETED
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
const { environment } = require('@rails/webpacker')
|
2
|
-
|
3
|
-
const webpack = require('webpack')
|
4
|
-
environment.plugins.prepend('Provide',
|
5
|
-
new webpack.ProvidePlugin({
|
6
|
-
$: 'jquery',
|
7
|
-
jQuery: 'jquery',
|
8
|
-
moment: 'moment',
|
9
|
-
Popper: ['popper.js', 'default']
|
10
|
-
})
|
11
|
-
)
|
12
|
-
|
13
|
-
module.exports = environment
|
data/config/webpack/test.js
DELETED
data/config/webpacker.yml
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
|
-
|
3
|
-
default: &default
|
4
|
-
source_path: app/javascript
|
5
|
-
source_entry_path: packs
|
6
|
-
public_root_path: public
|
7
|
-
public_output_path: cm-admin-packs
|
8
|
-
cache_path: tmp/cache/webpacker
|
9
|
-
webpack_compile_output: true
|
10
|
-
|
11
|
-
# Additional paths webpack should lookup modules
|
12
|
-
# ['app/assets', 'engine/foo/app/assets']
|
13
|
-
additional_paths: ['app/assets']
|
14
|
-
|
15
|
-
# Reload manifest.json on all requests so we reload latest compiled packs
|
16
|
-
cache_manifest: false
|
17
|
-
|
18
|
-
# Extract and emit a css file
|
19
|
-
extract_css: false
|
20
|
-
|
21
|
-
static_assets_extensions:
|
22
|
-
- .jpg
|
23
|
-
- .jpeg
|
24
|
-
- .png
|
25
|
-
- .gif
|
26
|
-
- .tiff
|
27
|
-
- .ico
|
28
|
-
- .svg
|
29
|
-
- .eot
|
30
|
-
- .otf
|
31
|
-
- .ttf
|
32
|
-
- .woff
|
33
|
-
- .woff2
|
34
|
-
|
35
|
-
extensions:
|
36
|
-
- .mjs
|
37
|
-
- .js
|
38
|
-
- .sass
|
39
|
-
- .scss
|
40
|
-
- .css
|
41
|
-
- .module.sass
|
42
|
-
- .module.scss
|
43
|
-
- .module.css
|
44
|
-
- .png
|
45
|
-
- .svg
|
46
|
-
- .gif
|
47
|
-
- .jpeg
|
48
|
-
- .jpg
|
49
|
-
|
50
|
-
development:
|
51
|
-
<<: *default
|
52
|
-
compile: true
|
53
|
-
|
54
|
-
# Reference: https://webpack.js.org/configuration/dev-server/
|
55
|
-
dev_server:
|
56
|
-
https: false
|
57
|
-
host: localhost
|
58
|
-
port: 3035
|
59
|
-
public: localhost:3035
|
60
|
-
hmr: false
|
61
|
-
# Inline should be set to true if using HMR
|
62
|
-
inline: true
|
63
|
-
overlay: true
|
64
|
-
compress: true
|
65
|
-
disable_host_check: true
|
66
|
-
use_local_ip: false
|
67
|
-
quiet: false
|
68
|
-
pretty: false
|
69
|
-
headers:
|
70
|
-
'Access-Control-Allow-Origin': '*'
|
71
|
-
watch_options:
|
72
|
-
ignored: '**/node_modules/**'
|
73
|
-
|
74
|
-
|
75
|
-
test:
|
76
|
-
<<: *default
|
77
|
-
compile: true
|
78
|
-
|
79
|
-
# Compile test packs to a separate directory
|
80
|
-
public_output_path: packs-test
|
81
|
-
|
82
|
-
production:
|
83
|
-
<<: *default
|
84
|
-
|
85
|
-
# Production depends on precompilation of packs prior to booting for performance.
|
86
|
-
compile: false
|
87
|
-
|
88
|
-
# Extract and emit a css file
|
89
|
-
extract_css: true
|
90
|
-
|
91
|
-
# Cache manifest.json for performance
|
92
|
-
cache_manifest: true
|
data/lib/.DS_Store
DELETED
Binary file
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# desc "Explaining what the task does"
|
2
|
-
# task :cm_admin do
|
3
|
-
# # Task goes here
|
4
|
-
# end
|
5
|
-
|
6
|
-
def ensure_log_goes_to_stdout
|
7
|
-
old_logger = Webpacker.logger
|
8
|
-
Webpacker.logger = ActiveSupport::Logger.new(STDOUT)
|
9
|
-
yield
|
10
|
-
ensure
|
11
|
-
Webpacker.logger = old_logger
|
12
|
-
end
|
13
|
-
|
14
|
-
namespace :cm_admin do
|
15
|
-
namespace :webpacker do
|
16
|
-
desc "Install deps with yarn"
|
17
|
-
task :yarn_install do
|
18
|
-
Dir.chdir(File.join(__dir__, "../..")) do
|
19
|
-
system "yarn install --no-progress --production"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Compile JavaScript packs using webpack for production with digests"
|
24
|
-
task compile: [:yarn_install, :environment] do
|
25
|
-
Webpacker.with_node_env("production") do
|
26
|
-
ensure_log_goes_to_stdout do
|
27
|
-
if CmAdmin.webpacker.commands.compile
|
28
|
-
# Successful compilation!
|
29
|
-
else
|
30
|
-
# Failed compilation
|
31
|
-
exit!
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def yarn_install_available?
|
40
|
-
rails_major = Rails::VERSION::MAJOR
|
41
|
-
rails_minor = Rails::VERSION::MINOR
|
42
|
-
|
43
|
-
rails_major > 5 || (rails_major == 5 && rails_minor >= 1)
|
44
|
-
end
|
45
|
-
|
46
|
-
def enhance_assets_precompile
|
47
|
-
# yarn:install was added in Rails 5.1
|
48
|
-
deps = yarn_install_available? ? [] : ["cm_admin:webpacker:yarn_install"]
|
49
|
-
Rake::Task["assets:precompile"].enhance(deps) do
|
50
|
-
Rake::Task["cm_admin:webpacker:compile"].invoke
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
if CmAdmin::VersionManager.rails6?
|
55
|
-
# Compile packs after we've compiled all other assets during precompilation
|
56
|
-
skip_webpacker_precompile = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
|
57
|
-
|
58
|
-
unless skip_webpacker_precompile
|
59
|
-
if Rake::Task.task_defined?("assets:precompile")
|
60
|
-
enhance_assets_precompile
|
61
|
-
else
|
62
|
-
Rake::Task.define_task("assets:precompile" =>"cm_admin:webpacker:compile")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|