plutonium 0.23.0 → 0.23.2
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/app/assets/plutonium.css +2 -2
- data/app/views/resource/interactive_resource_action.html.erb +1 -5
- data/app/views/rodauth/create_account.html.erb +1 -2
- data/config/initializers/sqlite_json_alias.rb +8 -0
- data/lib/plutonium/ui/form/theme.rb +2 -1
- data/lib/plutonium/ui/layout/base.rb +8 -0
- data/lib/plutonium/ui/panel.rb +2 -6
- data/lib/plutonium/version.rb +1 -1
- data/src/css/core.css +13 -10
- data/src/css/easymde.css +166 -720
- data/src/css/plutonium.entry.css +6 -15
- data/src/css/slim_select.css +227 -247
- data/tailwind.options.js +0 -1
- metadata +7 -37
- data/config/initializers/simple_form.rb +0 -74
- data/lib/plutonium/simple_form/attachment_component.rb +0 -85
- data/lib/plutonium/simple_form/input_group_component.rb +0 -17
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plutonium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Froelich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -66,34 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '9.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simple_form
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '5.3'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '5.3'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: dry-initializer
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.1'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.1'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: rabl
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,16 +252,16 @@ dependencies:
|
|
280
252
|
name: phlex-slotable
|
281
253
|
requirement: !ruby/object:Gem::Requirement
|
282
254
|
requirements:
|
283
|
-
- - "
|
255
|
+
- - "~>"
|
284
256
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
257
|
+
version: 1.0.0
|
286
258
|
type: :runtime
|
287
259
|
prerelease: false
|
288
260
|
version_requirements: !ruby/object:Gem::Requirement
|
289
261
|
requirements:
|
290
|
-
- - "
|
262
|
+
- - "~>"
|
291
263
|
- !ruby/object:Gem::Version
|
292
|
-
version:
|
264
|
+
version: 1.0.0
|
293
265
|
- !ruby/object:Gem::Dependency
|
294
266
|
name: redcarpet
|
295
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -516,7 +488,7 @@ files:
|
|
516
488
|
- config/initializers/hotwire_turbo_monkey_patches.rb
|
517
489
|
- config/initializers/pagy.rb
|
518
490
|
- config/initializers/rabl.rb
|
519
|
-
- config/initializers/
|
491
|
+
- config/initializers/sqlite_json_alias.rb
|
520
492
|
- docs/.vitepress/config.ts
|
521
493
|
- docs/.vitepress/theme/custom.css
|
522
494
|
- docs/.vitepress/theme/index.ts
|
@@ -813,8 +785,6 @@ files:
|
|
813
785
|
- lib/plutonium/routing/mapper_extensions.rb
|
814
786
|
- lib/plutonium/routing/resource_registration.rb
|
815
787
|
- lib/plutonium/routing/route_set_extensions.rb
|
816
|
-
- lib/plutonium/simple_form/attachment_component.rb
|
817
|
-
- lib/plutonium/simple_form/input_group_component.rb
|
818
788
|
- lib/plutonium/support/parameters.rb
|
819
789
|
- lib/plutonium/ui.rb
|
820
790
|
- lib/plutonium/ui/action_button.rb
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require "simple_form"
|
2
|
-
|
3
|
-
# Register components
|
4
|
-
Dir.glob(Plutonium.lib_root.join("form_component", "*.rb")) { |component| load component }
|
5
|
-
|
6
|
-
# Use this setup block to configure all options available in SimpleForm.
|
7
|
-
SimpleForm.setup do |config|
|
8
|
-
# Disable country select
|
9
|
-
# TODO: handle this in plutonium
|
10
|
-
config.input_mappings = {/country/ => :select}
|
11
|
-
|
12
|
-
config.wrappers :default_resource_form, class: "flex flex-col md:flex-row items-start space-y-2 md:space-y-0 md:space-x-2 mb-4" do |b|
|
13
|
-
b.use :html5
|
14
|
-
b.use :placeholder
|
15
|
-
b.use :maxlength
|
16
|
-
b.use :minlength
|
17
|
-
b.optional :pattern
|
18
|
-
b.use :min_max
|
19
|
-
b.optional :readonly
|
20
|
-
|
21
|
-
b.use :label, class: "md:w-1/6 mt-2 text-sm font-medium"
|
22
|
-
|
23
|
-
b.wrapper tag: :div, html: {class: "md:w-5/6 w-full"} do |ba|
|
24
|
-
ba.use :input, class: "w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 font-medium text-sm dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white",
|
25
|
-
error_class: "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
|
26
|
-
valid_class: "bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 rounded-lg focus:ring-green-500 focus:border-green-500 dark:bg-gray-700 dark:border-green-500"
|
27
|
-
ba.use :full_error, wrap_with: {tag: "p", class: "mt-2 text-sm text-red-600 dark:text-red-500"}
|
28
|
-
ba.use :hint, wrap_with: {tag: "p", class: "mt-2 text-sm text-gray-500 dark:text-gray-200"}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# vertical multi select
|
33
|
-
config.wrappers :resource_multi_select, class: "flex flex-col md:flex-row items-start space-y-2 md:space-y-0 md:space-x-2 mb-4" do |b|
|
34
|
-
b.use :html5
|
35
|
-
b.use :placeholder
|
36
|
-
b.use :maxlength
|
37
|
-
b.use :minlength
|
38
|
-
b.optional :pattern
|
39
|
-
b.use :min_max
|
40
|
-
b.optional :readonly
|
41
|
-
|
42
|
-
b.use :label, class: "md:w-1/6 mt-2 text-sm font-medium"
|
43
|
-
|
44
|
-
b.wrapper tag: :div, html: {class: "md:w-5/6 w-full"} do |ba|
|
45
|
-
ba.wrapper tag: :div, html: {class: "flex gap-2 flex-col md:flex-row items-center"} do |bc|
|
46
|
-
bc.use :input, class: "w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 font-medium text-sm dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white",
|
47
|
-
error_class: "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
|
48
|
-
valid_class: "bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 rounded-lg focus:ring-green-500 focus:border-green-500 dark:bg-gray-700 dark:border-green-500"
|
49
|
-
end
|
50
|
-
ba.use :full_error, wrap_with: {tag: "p", class: "mt-2 text-sm text-red-600 dark:text-red-500"}
|
51
|
-
ba.use :hint, wrap_with: {tag: "p", class: "mt-2 text-sm text-gray-500 dark:text-gray-200"}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
config.wrappers :resource_checkbox, class: "flex flex-col md:flex-row items-start space-y-2 md:space-y-0 md:space-x-2 mb-4" do |b|
|
56
|
-
b.use :html5
|
57
|
-
b.use :placeholder
|
58
|
-
b.use :maxlength
|
59
|
-
b.use :minlength
|
60
|
-
b.optional :pattern
|
61
|
-
b.use :min_max
|
62
|
-
b.optional :readonly
|
63
|
-
|
64
|
-
b.use :label, class: "md:w-1/6 mt-2 text-sm font-medium"
|
65
|
-
|
66
|
-
b.wrapper tag: :div, html: {class: "md:w-5/6 w-full"} do |ba|
|
67
|
-
ba.use :input, class: "w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",
|
68
|
-
error_class: "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 rounded focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
|
69
|
-
valid_class: "bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 rounded focus:ring-green-500 focus:border-green-500 dark:bg-gray-700 dark:border-green-500"
|
70
|
-
ba.use :full_error, wrap_with: {tag: "p", class: "mt-2 text-sm text-red-600 dark:text-red-500"}
|
71
|
-
ba.use :hint, wrap_with: {tag: "p", class: "mt-2 text-sm text-gray-500 dark:text-gray-200"}
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require "simple_form"
|
2
|
-
|
3
|
-
module Plutonium
|
4
|
-
module SimpleForm
|
5
|
-
module AttachmentComponent
|
6
|
-
def attachment(_wrapper_options = nil)
|
7
|
-
maybe_setup_direct_uploads
|
8
|
-
|
9
|
-
template.content_tag :div, class: "attachment-input-previews" do
|
10
|
-
# This is a hack to support the removal of has_one_attached attachments
|
11
|
-
# Usually, no hidden field is inserted for these
|
12
|
-
# By inserting one, with a value of nil, when the form is submitted,
|
13
|
-
# the autogenerated setter will remove the attachment for us.
|
14
|
-
template.concat @builder.hidden_field(attribute_name, value: nil, multiple: multiple?)
|
15
|
-
|
16
|
-
next if value.nil?
|
17
|
-
|
18
|
-
template.concat begin
|
19
|
-
template.display_attachment_value value, identity_class: input_class, caption: caption? do |attachment|
|
20
|
-
[
|
21
|
-
# These hidden fields allow us to preserve the already uploaded files.
|
22
|
-
# For has_one_attached, it overrides the hidden field previously added
|
23
|
-
# (if the same input exists, the more recent one wins)
|
24
|
-
#
|
25
|
-
# For has_many_attached, the generated setter replaces all the existing files when the form is submitted
|
26
|
-
# By adding hidden fields for the existing files, it allows us to append the new files
|
27
|
-
@builder.hidden_field(attribute_name, multiple: multiple?, value: attachment.signed_id),
|
28
|
-
|
29
|
-
# By removing this component, the hidden field is gone, which allows us to remove the files from active storage
|
30
|
-
template.content_tag(:p, class: "text-danger m-0", role: :button,
|
31
|
-
data: {action: "click->attachment-preview#remove"}) do
|
32
|
-
template.content_tag :span, " Delete", class: "bi bi-trash"
|
33
|
-
end
|
34
|
-
]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def value
|
43
|
-
@value ||= object.public_send(attribute_name) if object&.respond_to?(attribute_name)
|
44
|
-
end
|
45
|
-
|
46
|
-
def multiple?
|
47
|
-
options[:input_html] && options[:input_html][:multiple]
|
48
|
-
end
|
49
|
-
|
50
|
-
def caption?
|
51
|
-
options.key?(:caption) ? options[:caption] : true
|
52
|
-
end
|
53
|
-
|
54
|
-
def maybe_setup_direct_uploads
|
55
|
-
return unless options[:direct_upload]
|
56
|
-
|
57
|
-
direct_upload_options = {
|
58
|
-
data: {
|
59
|
-
controller: :"attachment-input",
|
60
|
-
attachment_input_identifier_value: input_class,
|
61
|
-
attachment_input_attachment_preview_outlet: ".#{input_class}.attachment-preview",
|
62
|
-
attachment_input_attachment_preview_container_outlet: ".#{input_class}.attachment-preview-container"
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
{
|
67
|
-
max_file_size: nil,
|
68
|
-
min_file_size: nil,
|
69
|
-
max_total_size: nil,
|
70
|
-
max_file_num: multiple? ? nil : 1,
|
71
|
-
min_file_num: nil,
|
72
|
-
allowed_file_types: nil,
|
73
|
-
required_meta_fields: nil
|
74
|
-
}.each do |key, default_value|
|
75
|
-
value = options.key?(key) ? options.delete(key) : default_value
|
76
|
-
direct_upload_options[:data][:"attachment_input_#{key}_value"] = value
|
77
|
-
end
|
78
|
-
|
79
|
-
input_html_options.merge! direct_upload_options
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
# Register with simple_form
|
85
|
-
SimpleForm.include_component(Plutonium::SimpleForm::AttachmentComponent)
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "simple_form"
|
2
|
-
|
3
|
-
module Plutonium
|
4
|
-
module SimpleForm
|
5
|
-
module InputGroupComponent
|
6
|
-
def prepend(_wrapper_options = nil)
|
7
|
-
template.content_tag(:span, options[:prepend], class: "input-group-text")
|
8
|
-
end
|
9
|
-
|
10
|
-
def append(_wrapper_options = nil)
|
11
|
-
template.content_tag(:span, options[:append], class: "input-group-text")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
# Register with simple_form
|
17
|
-
SimpleForm.include_component(Plutonium::SimpleForm::InputGroupComponent)
|