plutonium 0.10.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/app/assets/application.js.bk +31419 -0
- data/app/assets/plutonium-logo-original.png +0 -0
- data/app/assets/plutonium-logo-white.png +0 -0
- data/app/assets/plutonium-logo.png +0 -0
- data/app/assets/plutonium.css +1 -0
- data/app/assets/plutonium.ico +0 -0
- data/app/assets/plutonium.js +12416 -0
- data/app/assets/plutonium.js.map +7 -0
- data/app/assets/plutonium.min.js +39 -0
- data/app/assets/plutonium.min.js.map +7 -0
- data/app/views/application/_flash_alerts.html.erb +2 -2
- data/app/views/application/_resource_header.html.erb +263 -697
- data/app/views/application/_resource_sidebar.html.erb +14 -12
- data/app/views/components/action_button/action_button_component.rb +3 -3
- data/app/views/components/attributes.rb +184 -0
- data/app/views/components/base.rb +19 -40
- data/app/views/components/block/block_component.html.erb +1 -1
- data/app/views/components/block/block_component.rb +11 -7
- data/app/views/components/breadcrumbs/breadcrumbs_component.rb +3 -3
- data/app/views/components/button/button_component.html.erb +2 -2
- data/app/views/components/button/button_component.rb +10 -5
- data/app/views/components/dyna_frame_content/dyna_frame_content_component.html.erb +1 -0
- data/app/views/components/dyna_frame_content/dyna_frame_content_component.rb +3 -3
- data/app/views/components/dyna_frame_host/dyna_frame_host_component.html.erb +1 -2
- data/app/views/components/dyna_frame_host/dyna_frame_host_component.rb +12 -5
- data/app/views/components/empty_card/empty_card_component.rb +3 -3
- data/app/views/components/form/form_builder.rb +1 -1
- data/app/views/components/form/form_component.rb +3 -3
- data/app/views/components/has_many_panel/has_many_panel_component.html.erb +25 -0
- data/app/views/components/has_many_panel/has_many_panel_component.rb +16 -0
- data/app/views/components/header/header_component.rb +3 -3
- data/app/views/components/interactive_action_form/interactive_action_form_component.rb +3 -3
- data/app/views/components/nav_grid_menu/nav_grid_menu_component.html.erb +24 -0
- data/app/views/components/nav_grid_menu/nav_grid_menu_component.rb +23 -0
- data/app/views/components/nav_grid_menu_item/nav_grid_menu_item_component.html.erb +4 -0
- data/app/views/components/nav_grid_menu_item/nav_grid_menu_item_component.rb +20 -0
- data/app/views/components/nav_user/nav_user_component.html.erb +50 -0
- data/app/views/components/nav_user/nav_user_component.rb +32 -0
- data/app/views/components/nav_user_link/nav_user_link_component.html.erb +7 -0
- data/app/views/components/nav_user_link/nav_user_link_component.rb +23 -0
- data/app/views/components/nav_user_section/nav_user_section_component.html.erb +7 -0
- data/app/views/components/nav_user_section/nav_user_section_component.rb +18 -0
- data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.html.erb +1 -3
- data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.rb +11 -5
- data/app/views/components/pagination/pagination_component.html.erb +1 -1
- data/app/views/components/pagination/pagination_component.rb +10 -7
- data/app/views/components/panel/panel_component.html.erb +13 -6
- data/app/views/components/panel/panel_component.rb +11 -5
- data/app/views/components/resource_header/resource_header_component.html.erb +81 -0
- data/app/views/components/resource_header/resource_header_component.rb +20 -0
- data/app/views/components/resource_layout/resource_layout_component.html.erb +32 -0
- data/app/views/components/resource_layout/resource_layout_component.rb +39 -0
- data/app/views/components/sidebar/sidebar_component.html.erb +3 -33
- data/app/views/components/sidebar/sidebar_component.rb +3 -3
- data/app/views/components/sidebar_menu/sidebar_menu_component.html.erb +4 -2
- data/app/views/components/sidebar_menu/sidebar_menu_component.rb +10 -6
- data/app/views/components/sidebar_menu_item/sidebar_menu_item_component.html.erb +63 -71
- data/app/views/components/sidebar_menu_item/sidebar_menu_item_component.rb +27 -8
- data/app/views/components/skeleton/table/table_component.html.erb +1 -1
- data/app/views/components/skeleton/table/table_component.rb +3 -3
- data/app/views/components/table/table_component.html.erb +40 -89
- data/app/views/components/table/table_component.rb +124 -28
- data/app/views/components/table_search_input/table_search_input_component.html.erb +1 -1
- data/app/views/components/table_search_input/table_search_input_component.rb +11 -6
- data/app/views/components/table_toolbar/table_toolbar_component.html.erb +1 -1
- data/app/views/components/table_toolbar/table_toolbar_component.rb +11 -3
- data/app/views/components/toolbar/toolbar_component.html.erb +2 -2
- data/app/views/components/toolbar/toolbar_component.rb +16 -8
- data/app/views/layouts/resource.html.erb +21 -37
- data/app/views/layouts/rodauth.html.erb +32 -30
- data/app/views/resource/_interactive_resource_action_form.html.erb +1 -1
- data/app/views/resource/_resource_details.html.erb +8 -5
- data/app/views/resource/_resource_table.html.erb +70 -1
- data/app/views/resource/interactive_resource_collection_action.html.erb +1 -0
- data/app/views/resource/interactive_resource_record_action.html.erb +1 -0
- data/app/views/resource/interactive_resource_recordless_action.html.erb +1 -0
- data/app/views/resource/new.html.erb +1 -0
- data/config/initializers/simple_form.rb +22 -2
- data/esbuild.config.js +35 -31
- data/lib/generators/pu/core/assets/assets_generator.rb +41 -0
- data/lib/generators/pu/core/assets/templates/tailwind.config.js +18 -0
- data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +3 -0
- data/lib/generators/pu/gem/dotenv/templates/config/initializers/001_ensure_required_env.rb +6 -0
- data/lib/generators/pu/gen/component/component_generator.rb +13 -10
- data/lib/generators/pu/gen/component/templates/component.html.erb.tt +1 -1
- data/lib/generators/pu/gen/component/templates/component.rb.tt +10 -4
- data/lib/generators/pu/pkg/app/app_generator.rb +4 -4
- data/lib/generators/pu/pkg/app/templates/app/controllers/concerns/controller.rb.tt +28 -0
- data/lib/generators/pu/pkg/app/templates/app/controllers/controller.rb.tt +5 -0
- data/lib/generators/pu/pkg/app/templates/app/controllers/dashboard_controller.rb.tt +1 -1
- data/lib/generators/pu/res/conn/conn_generator.rb +4 -4
- data/lib/generators/pu/res/conn/templates/app/controllers/resource_controller.rb.tt +1 -1
- data/lib/generators/pu/res/model/model_generator.rb +3 -3
- data/lib/generators/pu/res/scaffold/templates/policy.rb.tt +6 -0
- data/lib/generators/pu/service/sidekiq/sidekiq_generator.rb +0 -5
- data/lib/generators/pu/service/sidekiq/templates/app/sidekiq/sidekiq_job.rb +0 -2
- data/lib/plutonium/config.rb +2 -14
- data/lib/plutonium/core/associations/renderers/basic_renderer.rb +28 -0
- data/lib/plutonium/core/associations/renderers/factory.rb +36 -0
- data/lib/plutonium/core/associations/renderers/has_many_renderer.rb +16 -0
- data/lib/plutonium/core/autodiscovery/association_renderer_discoverer.rb +31 -0
- data/lib/plutonium/core/controllers/authorizable.rb +13 -17
- data/lib/plutonium/core/controllers/base.rb +3 -7
- data/lib/plutonium/core/controllers/presentable.rb +6 -1
- data/lib/plutonium/core/definers/association_renderer_definer.rb +33 -0
- data/lib/plutonium/core/fields/inputs/checkbox_input.rb +13 -0
- data/lib/plutonium/core/fields/inputs/factory.rb +1 -0
- data/lib/plutonium/core/fields/inputs/polymorphic_belongs_to_association_input.rb +1 -1
- data/lib/plutonium/core/ui/detail.rb +1 -0
- data/lib/plutonium/helpers/application_helper.rb +8 -9
- data/lib/plutonium/helpers/assets_helper.rb +33 -0
- data/lib/plutonium/helpers/display_helper.rb +13 -0
- data/lib/plutonium/helpers/form_helper.rb +1 -1
- data/lib/plutonium/helpers.rb +1 -0
- data/lib/plutonium/icons.rb +12 -5
- data/lib/plutonium/pkg/app.rb +10 -0
- data/lib/plutonium/pundit/context.rb +18 -0
- data/lib/plutonium/pundit/policy_finder.rb +25 -0
- data/lib/plutonium/railtie.rb +20 -8
- data/lib/plutonium/reloader.rb +18 -7
- data/lib/plutonium/resource/controller.rb +4 -0
- data/lib/plutonium/resource/policy.rb +69 -47
- data/lib/plutonium/resource/presenter.rb +1 -0
- data/lib/plutonium/resource/query_object.rb +139 -130
- data/lib/plutonium/rodauth/controller_methods.rb +7 -3
- data/lib/plutonium/version.rb +1 -1
- data/lib/plutonium.rb +9 -57
- data/package-lock.json +782 -17
- data/package.json +31 -8
- data/postcss.config.js +17 -7
- data/src/.npmignore +2 -0
- data/src/js/controllers/color_mode_controller.js +41 -0
- data/src/js/controllers/frame_navigator_controller.js +99 -0
- data/src/js/controllers/has_many_panel_controller.js +8 -0
- data/src/js/controllers/nav_grid_menu_controller.js +8 -0
- data/src/js/controllers/nav_grid_menu_item_controller.js +8 -0
- data/{app/views/components/tab_bar/tab_bar_controller.js → src/js/controllers/nav_user_controller.js} +2 -2
- data/src/js/controllers/nav_user_link_controller.js +8 -0
- data/src/js/controllers/nav_user_section_controller.js +8 -0
- data/src/js/controllers/register_controllers.js +45 -0
- data/{app/assets/javascripts → src/js}/controllers/resource_dismiss_controller.js +2 -0
- data/{app/assets/javascripts → src/js}/controllers/resource_drop_down_controller.js +2 -0
- data/src/js/controllers/resource_header_controller.js +8 -0
- data/src/js/controllers/resource_layout_controller.js +8 -0
- data/src/js/controllers/sidebar_menu_controller.js +8 -0
- data/src/js/controllers/sidebar_menu_item_controller.js +8 -0
- data/src/js/core.js +4 -0
- data/{app/assets/javascripts/plutonium-app.js → src/js/plutonium.js} +1 -1
- data/{app/assets/javascripts → src/js}/turbo/turbo_debug.js +2 -4
- data/tailwind.config.js +85 -84
- metadata +73 -39
- data/app/assets/build/plutonium.js +0 -5122
- data/app/assets/javascripts/controllers/index.js +0 -34
- data/app/assets/javascripts/plutonium.js +0 -1
- data/app/views/application/_color_modes.html.erb +0 -57
- data/app/views/components/tab_bar/tab_bar_component.html.erb +0 -11
- data/app/views/components/tab_bar/tab_bar_component.rb +0 -9
- data/app/views/resource/_nav_user.html.erb +0 -4
- data/app/views/resource/_tab_menu.html.erb +0 -13
- data/css.manifest +0 -3
- data/js.manifest +0 -4
- data/lib/generators/pu/pkg/app/templates/app/controllers/app_controller.rb.tt +0 -5
- data/lib/generators/pu/pkg/app/templates/app/controllers/package_controller.rb.tt +0 -26
- data/public/plutonium-assets/application.css +0 -25086
- data/public/plutonium-assets/plutonium-app-36KN5FVJ.js +0 -6
- data/public/plutonium-assets/plutonium-app-36KN5FVJ.js.map +0 -7
- data/public/plutonium-assets/plutonium-app-6WILQCTT.js +0 -39
- data/public/plutonium-assets/plutonium-app-6WILQCTT.js.map +0 -7
- data/public/plutonium-assets/plutonium.2d4f0c333cd000051d3b.css +0 -3424
- data/public/plutonium-assets/plutonium.50232e35b5495f5ad90d.css +0 -3415
- data/public/plutonium-assets/plutonium.8bee7a8482988b0360e3.css +0 -3420
- /data/{app/assets/build → lib/generators/pu/core/assets/templates}/.keep +0 -0
- /data/{app/assets/stylesheets → src/css}/plutonium.css +0 -0
- /data/{app/views/components/form → src/js/controllers}/form_controller.js +0 -0
- /data/{app/views/components/interactive_action_form → src/js/controllers}/interactive_action_form_controller.js +0 -0
- /data/{app/views/components/nested_resource_form_fields → src/js/controllers}/nested_resource_form_fields_controller.js +0 -0
- /data/{app/views/components/table → src/js/controllers}/table_controller.js +0 -0
- /data/{app/views/components/table_search_input → src/js/controllers}/table_search_input_controller.js +0 -0
- /data/{app/views/components/table_toolbar → src/js/controllers}/table_toolbar_controller.js +0 -0
- /data/{app/views/components/toolbar → src/js/controllers}/toolbar_controller.js +0 -0
- /data/{app/assets/javascripts → src/js}/turbo/index.js +0 -0
- /data/{app/assets/javascripts → src/js}/turbo/turbo_actions.js +0 -0
- /data/{app/assets/javascripts → src/js}/turbo/turbo_frame_monkey_patch.js +0 -0
data/package.json
CHANGED
@@ -1,24 +1,47 @@
|
|
1
1
|
{
|
2
|
-
"
|
2
|
+
"name": "@radioactive-labs/plutonium",
|
3
|
+
"version": "0.1.2",
|
4
|
+
"description": "Core assets for the Plutonium gem",
|
5
|
+
"type": "module",
|
6
|
+
"main": "src/js/core.js",
|
7
|
+
"files": [
|
8
|
+
"src/"
|
9
|
+
],
|
10
|
+
"author": "Stefan Froelich (@thedumbtechguy)",
|
11
|
+
"license": "MIT",
|
12
|
+
"bugs": {
|
13
|
+
"url": "https://github.com/radioactive-labs/plutonium-core/issues"
|
14
|
+
},
|
15
|
+
"repository": {
|
16
|
+
"type": "git",
|
17
|
+
"url": "git+https://github.com/radioactive-labs/plutonium-core.git"
|
18
|
+
},
|
19
|
+
"homepage": "https://github.com/radioactive-labs/plutonium-core#readme",
|
20
|
+
"dependencies": {
|
3
21
|
"@hotwired/stimulus": "^3.2.2",
|
22
|
+
"lodash.debounce": "^4.0.8",
|
4
23
|
"@hotwired/turbo": "^8.0.4",
|
24
|
+
"flowbite": "^2.3.0"
|
25
|
+
},
|
26
|
+
"devDependencies": {
|
5
27
|
"@tailwindcss/forms": "^0.5.7",
|
6
28
|
"autoprefixer": "^10.4.18",
|
7
29
|
"concurrently": "^8.2.2",
|
8
30
|
"esbuild": "^0.20.1",
|
9
31
|
"esbuild-plugin-manifest": "^1.0.3",
|
10
|
-
"flowbite": "^2.3.0",
|
11
|
-
"lodash.debounce": "^4.0.8",
|
12
32
|
"postcss": "^8.4.35",
|
13
33
|
"postcss-cli": "^11.0.0",
|
14
34
|
"postcss-hash": "^3.0.0",
|
15
|
-
"tailwindcss": "^3.4.1"
|
35
|
+
"tailwindcss": "^3.4.1",
|
36
|
+
"cssnano": "^7.0.2"
|
16
37
|
},
|
17
38
|
"scripts": {
|
39
|
+
"build": "npm run js:prod && npm run css:prod",
|
18
40
|
"dev": "concurrently \"npm run css:dev\" \"npm run js:dev\"",
|
19
|
-
"css:dev": "postcss
|
20
|
-
"js:dev": "node esbuild.config.js",
|
21
|
-
"css:prod": "postcss app/assets/
|
22
|
-
"js:prod": "node esbuild.config.js
|
41
|
+
"css:dev": "postcss src/css/plutonium.css -o src/build/plutonium.css --watch --dev",
|
42
|
+
"js:dev": "node esbuild.config.js --dev",
|
43
|
+
"css:prod": "postcss src/css/plutonium.css -o app/assets/plutonium.css && postcss src/css/plutonium.css -o src/dist/css/plutonium.css",
|
44
|
+
"js:prod": "node esbuild.config.js",
|
45
|
+
"prepare": "npm run build"
|
23
46
|
}
|
24
47
|
}
|
data/postcss.config.js
CHANGED
@@ -1,11 +1,21 @@
|
|
1
|
-
|
1
|
+
const config = {
|
2
2
|
plugins: {
|
3
3
|
tailwindcss: {},
|
4
|
-
autoprefixer: {}
|
5
|
-
'postcss-hash': {
|
6
|
-
algorithm: 'sha256',
|
7
|
-
trim: 20,
|
8
|
-
manifest: process.argv.includes("--prod") ? './css.manifest' : './css.dev.manifest'
|
9
|
-
},
|
4
|
+
autoprefixer: {}
|
10
5
|
}
|
11
6
|
}
|
7
|
+
|
8
|
+
if (process.argv.includes("--dev")) {
|
9
|
+
config.plugins['postcss-hash'] = {
|
10
|
+
algorithm: 'sha256',
|
11
|
+
trim: 20,
|
12
|
+
manifest: './src/build/css.manifest'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
config.plugins['cssnano'] = {
|
17
|
+
preset: 'default',
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
export default config
|
data/src/.npmignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
|
4
|
+
// Connects to data-controller="color-mode"
|
5
|
+
export default class extends Controller {
|
6
|
+
// static targets = ["trigger", "menu"]
|
7
|
+
|
8
|
+
connect() {
|
9
|
+
console.log(`color-mode connected: ${this.element}`)
|
10
|
+
this.updateColorMode()
|
11
|
+
}
|
12
|
+
|
13
|
+
disconnect() {
|
14
|
+
}
|
15
|
+
|
16
|
+
updateColorMode() {
|
17
|
+
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
18
|
+
document.documentElement.classList.add('dark')
|
19
|
+
} else {
|
20
|
+
document.documentElement.classList.remove('dark')
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
setLightColorMode() {
|
25
|
+
// Whenever the user explicitly chooses light mode
|
26
|
+
localStorage.theme = 'light'
|
27
|
+
this.updateColorMode()
|
28
|
+
}
|
29
|
+
|
30
|
+
setDarkColorMode() {
|
31
|
+
// Whenever the user explicitly chooses dark mode
|
32
|
+
localStorage.theme = 'dark'
|
33
|
+
this.updateColorMode()
|
34
|
+
}
|
35
|
+
|
36
|
+
setSystemColorMode() {
|
37
|
+
// Whenever the user explicitly chooses to respect the OS preference
|
38
|
+
localStorage.removeItem('theme')
|
39
|
+
this.updateColorMode()
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
// Connects to data-controller="frame-navigator"
|
4
|
+
export default class extends Controller {
|
5
|
+
static targets = ["frame", "refreshButton", "backButton", "homeButton"];
|
6
|
+
|
7
|
+
connect() {
|
8
|
+
console.log(`frame-navigator connected: ${this.element}`)
|
9
|
+
|
10
|
+
this.srcHistory = []
|
11
|
+
this.originalFrameSrc = this.frameTarget.src
|
12
|
+
|
13
|
+
if (this.hasRefreshButtonTarget) {
|
14
|
+
this.refreshButtonTarget.style.display = ''
|
15
|
+
this.refreshButtonClicked = this.refreshButtonClicked.bind(this);
|
16
|
+
this.refreshButtonTarget.addEventListener("click", this.refreshButtonClicked);
|
17
|
+
}
|
18
|
+
|
19
|
+
if (this.hasBackButtonTarget) {
|
20
|
+
this.backButtonClicked = this.backButtonClicked.bind(this);
|
21
|
+
this.backButtonTarget.addEventListener("click", this.backButtonClicked);
|
22
|
+
}
|
23
|
+
|
24
|
+
if (this.hasHomeButtonTarget) {
|
25
|
+
this.homeButtonClicked = this.homeButtonClicked.bind(this);
|
26
|
+
this.homeButtonTarget.addEventListener("click", this.homeButtonClicked);
|
27
|
+
}
|
28
|
+
|
29
|
+
this.frameLoaded = this.frameLoaded.bind(this);
|
30
|
+
this.frameTarget.addEventListener("turbo:frame-load", this.frameLoaded);
|
31
|
+
|
32
|
+
this.frameLoading = this.frameLoading.bind(this);
|
33
|
+
this.frameTarget.addEventListener("turbo:click", this.frameLoading);
|
34
|
+
this.frameTarget.addEventListener("turbo:submit-start", this.frameLoading);
|
35
|
+
}
|
36
|
+
|
37
|
+
disconnect() {
|
38
|
+
if (this.hasRefreshButtonTarget) this.refreshButtonTarget.removeEventListener("click", this.refreshButtonClicked);
|
39
|
+
if (this.hasBackButtonTarget) this.backButtonTarget.removeEventListener("click", this.backButtonClicked);
|
40
|
+
if (this.hasHomeButtonTarget) this.homeButtonTarget.removeEventListener("click", this.homeButtonClicked);
|
41
|
+
|
42
|
+
this.frameTarget.removeEventListener("turbo:frame-load", this.frameLoaded);
|
43
|
+
this.frameTarget.removeEventListener("turbo:click", this.frameLoading);
|
44
|
+
this.frameTarget.removeEventListener("turbo:submit-start", this.frameLoading);
|
45
|
+
}
|
46
|
+
|
47
|
+
frameLoading(event) {
|
48
|
+
if (this.hasRefreshButtonTarget) this.refreshButtonTarget.classList.add("motion-safe:animate-spin")
|
49
|
+
this.frameTarget.classList.add("motion-safe:animate-pulse")
|
50
|
+
}
|
51
|
+
|
52
|
+
frameLoaded(event) {
|
53
|
+
if (this.hasRefreshButtonTarget) this.refreshButtonTarget.classList.remove("motion-safe:animate-spin")
|
54
|
+
this.frameTarget.classList.remove("motion-safe:animate-pulse")
|
55
|
+
|
56
|
+
let src = event.target.src
|
57
|
+
if (src == this.currentSrc) {
|
58
|
+
// this must be a refresh
|
59
|
+
// do nothing
|
60
|
+
}
|
61
|
+
else if (src == this.originalFrameSrc)
|
62
|
+
this.srcHistory = [src]
|
63
|
+
else
|
64
|
+
this.srcHistory.push(src)
|
65
|
+
|
66
|
+
this.updateNavigationButtonsDisplay()
|
67
|
+
}
|
68
|
+
|
69
|
+
refreshButtonClicked(event) {
|
70
|
+
this.frameLoading(null)
|
71
|
+
|
72
|
+
this.frameTarget.reload()
|
73
|
+
}
|
74
|
+
|
75
|
+
backButtonClicked(event) {
|
76
|
+
this.frameLoading(null)
|
77
|
+
|
78
|
+
this.srcHistory.pop()
|
79
|
+
this.frameTarget.src = this.currentSrc
|
80
|
+
}
|
81
|
+
|
82
|
+
homeButtonClicked(event) {
|
83
|
+
this.frameLoading(null)
|
84
|
+
|
85
|
+
this.frameTarget.src = this.originalFrameSrc
|
86
|
+
}
|
87
|
+
|
88
|
+
get currentSrc() { return this.srcHistory[this.srcHistory.length - 1] }
|
89
|
+
|
90
|
+
updateNavigationButtonsDisplay() {
|
91
|
+
if (this.hasHomeButtonTarget) {
|
92
|
+
this.homeButtonTarget.style.display = this.srcHistory.length > 1 ? '' : 'none'
|
93
|
+
}
|
94
|
+
|
95
|
+
if (this.hasBackButtonTarget) {
|
96
|
+
this.backButtonTarget.style.display = this.srcHistory.length > 2 ? '' : 'none'
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
|
-
// Connects to data-controller="
|
3
|
+
// Connects to data-controller="nav-user"
|
4
4
|
export default class extends Controller {
|
5
5
|
connect() {
|
6
|
-
console.log(`
|
6
|
+
console.log(`nav-user connected: ${this.element}`)
|
7
7
|
}
|
8
8
|
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// Import controllers here
|
2
|
+
import ResourceLayoutController from "./resource_layout_controller.js"
|
3
|
+
import NavGridMenuItemController from "./nav_grid_menu_item_controller.js"
|
4
|
+
import NavGridMenuController from "./nav_grid_menu_controller.js"
|
5
|
+
import NavUserSectionController from "./nav_user_section_controller.js"
|
6
|
+
import NavUserLinkController from "./nav_user_link_controller.js"
|
7
|
+
import NavUserController from "./nav_user_controller.js"
|
8
|
+
import ResourceHeaderController from "./resource_header_controller.js"
|
9
|
+
import SidebarMenuItemController from "./sidebar_menu_item_controller.js"
|
10
|
+
import SidebarMenuController from "./sidebar_menu_controller.js"
|
11
|
+
import HasManyPanelController from "./has_many_panel_controller.js"
|
12
|
+
import NestedResourceFormFieldsController from "./nested_resource_form_fields_controller.js"
|
13
|
+
import ToolbarController from "./toolbar_controller.js"
|
14
|
+
import TableSearchInputController from "./table_search_input_controller.js"
|
15
|
+
import TableToolbarController from "./table_toolbar_controller.js"
|
16
|
+
import TableController from "./table_controller.js"
|
17
|
+
import FormController from "./form_controller.js"
|
18
|
+
import ResourceDropDownController from "./resource_drop_down_controller.js"
|
19
|
+
import ResourceDismissController from "./resource_dismiss_controller.js"
|
20
|
+
import FrameNavigatorController from "./frame_navigator_controller.js"
|
21
|
+
import ColorModeController from "./color_mode_controller.js"
|
22
|
+
|
23
|
+
export default function (application) {
|
24
|
+
// Register controllers here
|
25
|
+
application.register("resource-layout", ResourceLayoutController)
|
26
|
+
application.register("nav-grid-menu-item", NavGridMenuItemController)
|
27
|
+
application.register("nav-grid-menu", NavGridMenuController)
|
28
|
+
application.register("nav-user-section", NavUserSectionController)
|
29
|
+
application.register("nav-user-link", NavUserLinkController)
|
30
|
+
application.register("nav-user", NavUserController)
|
31
|
+
application.register("resource-header", ResourceHeaderController)
|
32
|
+
application.register("sidebar-menu-item", SidebarMenuItemController)
|
33
|
+
application.register("sidebar-menu", SidebarMenuController)
|
34
|
+
application.register("has-many-panel", HasManyPanelController)
|
35
|
+
application.register("nested-resource-form-fields", NestedResourceFormFieldsController)
|
36
|
+
application.register("toolbar", ToolbarController)
|
37
|
+
application.register("table-search-input", TableSearchInputController)
|
38
|
+
application.register("table-toolbar", TableToolbarController)
|
39
|
+
application.register("table", TableController)
|
40
|
+
application.register("form", FormController)
|
41
|
+
application.register("resource-drop-down", ResourceDropDownController)
|
42
|
+
application.register("resource-dismiss", ResourceDismissController)
|
43
|
+
application.register("frame-navigator", FrameNavigatorController)
|
44
|
+
application.register("color-mode", ColorModeController)
|
45
|
+
}
|
@@ -11,6 +11,8 @@ export default class extends Controller {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
connect() {
|
14
|
+
console.log(`resource-dismiss connected: ${this.element}`)
|
15
|
+
|
14
16
|
// https://flowbite.com/docs/components/alerts/#javascript-behaviour
|
15
17
|
this.dismiss = new Dismiss(this.targetTarget, this.triggerTarget);
|
16
18
|
|
@@ -7,6 +7,8 @@ export default class extends Controller {
|
|
7
7
|
static targets = ["trigger", "menu"]
|
8
8
|
|
9
9
|
connect() {
|
10
|
+
console.log(`resource-drop-down connected: ${this.element}`)
|
11
|
+
|
10
12
|
// https://flowbite.com/docs/components/dropdowns/#javascript-behaviour
|
11
13
|
this.dropdown = new Dropdown(this.menuTarget, this.triggerTarget);
|
12
14
|
}
|
data/src/js/core.js
ADDED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
[
|
2
2
|
'turbo:click',
|
3
3
|
'turbo:before-visit',
|
4
4
|
'turbo:visit',
|
@@ -21,9 +21,7 @@ eventNames = [
|
|
21
21
|
'turbo:before-morph-element',
|
22
22
|
'turbo:morph-attribute',
|
23
23
|
'turbo:morph',
|
24
|
-
]
|
25
|
-
|
26
|
-
eventNames.forEach(eventName => {
|
24
|
+
].forEach(eventName => {
|
27
25
|
document.addEventListener(eventName, (event) => {
|
28
26
|
console.log(event.type, event);
|
29
27
|
});
|
data/tailwind.config.js
CHANGED
@@ -1,90 +1,91 @@
|
|
1
|
-
|
2
1
|
/** @type {import('tailwindcss').Config} */
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
// safelist.push(`bg-${color}-${shade}`);
|
9
|
-
// safelist.push(`text-${color}-${shade}`);
|
10
|
-
// // Add other utilities as needed
|
11
|
-
// });
|
12
|
-
// }
|
13
|
-
// });
|
3
|
+
export const content = [
|
4
|
+
`${__dirname}/src/**/*.{css,js}`,
|
5
|
+
`${__dirname}/app/views/**/*.{rb,erb,js}`,
|
6
|
+
`${__dirname}/config/initializers/simple_form.rb`,
|
14
7
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
'800': '#274ea6',
|
44
|
-
'900': '#244484',
|
45
|
-
'950': '#1b2b50',
|
46
|
-
},
|
47
|
-
},
|
48
|
-
screens: {
|
49
|
-
'xs': '475px',
|
8
|
+
// node modules are not packaged as part of the gem.
|
9
|
+
// requires users to have flowbite installed in their own project.
|
10
|
+
'./node_modules/flowbite/**/*.js',
|
11
|
+
// TODO: temporary workaround for legacy components.
|
12
|
+
// To be removed after converting buttons_helper and other files containing tailwind to components .
|
13
|
+
// `${__dirname}/lib/plutonium/**/*.{rb,erb}`
|
14
|
+
];
|
15
|
+
export const darkMode = "selector";
|
16
|
+
export const plugins = [
|
17
|
+
// requires users to have the required packages installed in their own project.
|
18
|
+
require('@tailwindcss/forms'),
|
19
|
+
require('flowbite/plugin'),
|
20
|
+
];
|
21
|
+
export const theme = {
|
22
|
+
extend: {
|
23
|
+
colors: {
|
24
|
+
primary: {
|
25
|
+
'50': '#f0f7fe',
|
26
|
+
'100': '#ddecfc',
|
27
|
+
'200': '#c3dffa',
|
28
|
+
'300': '#99ccf7',
|
29
|
+
'400': '#69b0f1',
|
30
|
+
'500': '#4691eb',
|
31
|
+
'600': '#3174df',
|
32
|
+
'700': '#285fcc',
|
33
|
+
'800': '#274ea6',
|
34
|
+
'900': '#244484',
|
35
|
+
'950': '#1b2b50',
|
50
36
|
},
|
51
37
|
},
|
52
|
-
|
53
|
-
'
|
54
|
-
|
55
|
-
'ui-sans-serif',
|
56
|
-
'system-ui',
|
57
|
-
'-apple-system',
|
58
|
-
'system-ui',
|
59
|
-
'Segoe UI',
|
60
|
-
'Roboto',
|
61
|
-
'Helvetica Neue',
|
62
|
-
'Arial',
|
63
|
-
'Noto Sans',
|
64
|
-
'sans-serif',
|
65
|
-
'Apple Color Emoji',
|
66
|
-
'Segoe UI Emoji',
|
67
|
-
'Segoe UI Symbol',
|
68
|
-
'Noto Color Emoji'
|
69
|
-
],
|
70
|
-
'sans': [
|
71
|
-
'Lato',
|
72
|
-
'ui-sans-serif',
|
73
|
-
'system-ui',
|
74
|
-
'-apple-system',
|
75
|
-
'system-ui',
|
76
|
-
'Segoe UI',
|
77
|
-
'Roboto',
|
78
|
-
'Helvetica Neue',
|
79
|
-
'Arial',
|
80
|
-
'Noto Sans',
|
81
|
-
'sans-serif',
|
82
|
-
'Apple Color Emoji',
|
83
|
-
'Segoe UI Emoji',
|
84
|
-
'Segoe UI Symbol',
|
85
|
-
'Noto Color Emoji'
|
86
|
-
]
|
87
|
-
}
|
38
|
+
screens: {
|
39
|
+
'xs': '475px',
|
40
|
+
},
|
88
41
|
},
|
89
|
-
|
90
|
-
|
42
|
+
fontFamily: {
|
43
|
+
'body': [
|
44
|
+
'Lato',
|
45
|
+
'ui-sans-serif',
|
46
|
+
'system-ui',
|
47
|
+
'-apple-system',
|
48
|
+
'system-ui',
|
49
|
+
'Segoe UI',
|
50
|
+
'Roboto',
|
51
|
+
'Helvetica Neue',
|
52
|
+
'Arial',
|
53
|
+
'Noto Sans',
|
54
|
+
'sans-serif',
|
55
|
+
'Apple Color Emoji',
|
56
|
+
'Segoe UI Emoji',
|
57
|
+
'Segoe UI Symbol',
|
58
|
+
'Noto Color Emoji'
|
59
|
+
],
|
60
|
+
'sans': [
|
61
|
+
'Lato',
|
62
|
+
'ui-sans-serif',
|
63
|
+
'system-ui',
|
64
|
+
'-apple-system',
|
65
|
+
'system-ui',
|
66
|
+
'Segoe UI',
|
67
|
+
'Roboto',
|
68
|
+
'Helvetica Neue',
|
69
|
+
'Arial',
|
70
|
+
'Noto Sans',
|
71
|
+
'sans-serif',
|
72
|
+
'Apple Color Emoji',
|
73
|
+
'Segoe UI Emoji',
|
74
|
+
'Segoe UI Symbol',
|
75
|
+
'Noto Color Emoji'
|
76
|
+
]
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
|
81
|
+
// const _safelist = [];
|
82
|
+
// // Object.keys(colors).forEach((color) => {
|
83
|
+
// // if (typeof colors[color] === 'object') {
|
84
|
+
// // Object.keys(colors[color]).forEach((shade) => {
|
85
|
+
// // safelist.push(`bg-${color}-${shade}`);
|
86
|
+
// // safelist.push(`text-${color}-${shade}`);
|
87
|
+
// // // Add other utilities as needed
|
88
|
+
// // });
|
89
|
+
// // }
|
90
|
+
// // });
|
91
|
+
// export const safelist = _safelist;
|