plutonium 0.15.5 → 0.15.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/plutonium.css +1 -1
  3. data/app/assets/plutonium.ico +0 -0
  4. data/app/assets/plutonium.js +25 -11
  5. data/app/assets/plutonium.js.map +2 -2
  6. data/app/assets/plutonium.min.js +4 -4
  7. data/app/assets/plutonium.min.js.map +3 -3
  8. data/app/assets/plutonium.png +0 -0
  9. data/app/views/layouts/rodauth.html.erb +2 -2
  10. data/docs/.vitepress/config.ts +61 -0
  11. data/docs/.vitepress/theme/custom.css +61 -0
  12. data/docs/.vitepress/theme/index.ts +4 -0
  13. data/docs/api-examples.md +49 -0
  14. data/docs/guide/getting-started/authorization.md +296 -0
  15. data/docs/guide/getting-started/core-concepts.md +432 -0
  16. data/docs/guide/getting-started/index.md +18 -0
  17. data/docs/guide/getting-started/installation.md +270 -0
  18. data/docs/guide/getting-started/resources.md +250 -0
  19. data/docs/guide/what-is-plutonium.md +211 -0
  20. data/docs/index.md +43 -0
  21. data/docs/markdown-examples.md +85 -0
  22. data/docs/public/android-chrome-192x192.png +0 -0
  23. data/docs/public/android-chrome-512x512.png +0 -0
  24. data/docs/public/apple-touch-icon.png +0 -0
  25. data/docs/public/favicon-16x16.png +0 -0
  26. data/docs/public/favicon-32x32.png +0 -0
  27. data/docs/public/favicon.ico +0 -0
  28. data/docs/public/plutonium.png +0 -0
  29. data/docs/public/site.webmanifest +1 -0
  30. data/docs/public/templates/plutonium.rb +29 -0
  31. data/lib/generators/pu/core/assets/assets_generator.rb +2 -3
  32. data/lib/generators/pu/core/assets/templates/tailwind.config.js +2 -2
  33. data/lib/generators/pu/core/install/install_generator.rb +9 -1
  34. data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +0 -1
  35. data/lib/generators/pu/eject/layout/layout_generator.rb +3 -3
  36. data/lib/generators/pu/eject/shell/shell_generator.rb +3 -3
  37. data/lib/generators/pu/gem/dotenv/dotenv_generator.rb +1 -1
  38. data/lib/generators/pu/gem/letter_opener/letter_opener_generator.rb +21 -0
  39. data/lib/generators/pu/gem/redis/redis_generator.rb +0 -2
  40. data/lib/generators/pu/gem/standard/standard_generator.rb +19 -0
  41. data/lib/generators/pu/lib/plutonium_generators/generator.rb +1 -1
  42. data/lib/generators/pu/res/conn/conn_generator.rb +1 -1
  43. data/lib/plutonium/core/controllers/authorizable.rb +1 -1
  44. data/lib/plutonium/definition/actions.rb +6 -2
  45. data/lib/plutonium/definition/base.rb +1 -0
  46. data/lib/plutonium/definition/nested_inputs.rb +19 -0
  47. data/lib/plutonium/railtie.rb +0 -10
  48. data/lib/plutonium/resource/controller.rb +1 -1
  49. data/lib/plutonium/resource/controllers/crud_actions.rb +1 -1
  50. data/lib/plutonium/resource/controllers/interactive_actions.rb +1 -1
  51. data/lib/plutonium/resource/controllers/presentable.rb +1 -5
  52. data/lib/plutonium/resource/policy.rb +4 -5
  53. data/lib/plutonium/resource/register.rb +3 -0
  54. data/lib/plutonium/ui/action_button.rb +34 -19
  55. data/lib/plutonium/ui/block.rb +13 -0
  56. data/lib/plutonium/ui/component/kit.rb +10 -0
  57. data/lib/plutonium/ui/display/resource.rb +29 -11
  58. data/lib/plutonium/ui/display/theme.rb +1 -1
  59. data/lib/plutonium/ui/dyna_frame/content.rb +2 -2
  60. data/lib/plutonium/ui/dyna_frame/host.rb +20 -0
  61. data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +282 -0
  62. data/lib/plutonium/ui/form/resource.rb +40 -29
  63. data/lib/plutonium/ui/form/theme.rb +1 -1
  64. data/lib/plutonium/ui/frame_navigator_panel.rb +53 -0
  65. data/lib/plutonium/ui/panel.rb +63 -0
  66. data/lib/plutonium/ui/skeleton_table.rb +29 -0
  67. data/lib/plutonium/ui/table/components/search_bar.rb +1 -1
  68. data/lib/plutonium/ui/table/resource.rb +1 -1
  69. data/lib/plutonium/version.rb +1 -1
  70. data/package-lock.json +5767 -1851
  71. data/package.json +10 -4
  72. data/src/js/controllers/frame_navigator_controller.js +25 -8
  73. data/src/js/controllers/nested_resource_form_fields_controller.js +2 -2
  74. data/src/js/core.js +0 -1
  75. data/tailwind.options.js +89 -11
  76. metadata +36 -12
  77. data/app/assets/plutonium-original.png +0 -0
  78. data/app/assets/plutonium-white.png +0 -0
  79. data/lib/generators/pu/gem/redis/templates/.keep +0 -0
  80. data/public/plutonium-assets/fonts/bootstrap-icons.woff +0 -0
  81. data/public/plutonium-assets/fonts/bootstrap-icons.woff2 +0 -0
  82. /data/{templates → docs/public/templates}/base.rb +0 -0
@@ -15,7 +15,7 @@ module Pu
15
15
  class_option :rodauth, type: :boolean
16
16
 
17
17
  def start
18
- destination_dir = (destination_app == "main_app") ? "app/views/" : "packages/#{destination_app}/app/views/"
18
+ destination_dir = (destination_portal == "main_app") ? "app/views/" : "packages/#{destination_portal}/app/views/"
19
19
  [
20
20
  "layouts/resource.html.erb"
21
21
  ].each do |file|
@@ -27,8 +27,8 @@ module Pu
27
27
 
28
28
  private
29
29
 
30
- def destination_app
31
- @destination_app || select_app(options[:dest], msg: "Select destination app")
30
+ def destination_portal
31
+ @destination_portal || select_portal(options[:dest], msg: "Select destination portal")
32
32
  end
33
33
 
34
34
  def copy_file(source_path, destination_path)
@@ -14,7 +14,7 @@ module Pu
14
14
  class_option :dest, type: :string
15
15
 
16
16
  def start
17
- destination_dir = (destination_app == "main_app") ? "app/views/" : "packages/#{destination_app}/app/views"
17
+ destination_dir = (destination_portal == "main_app") ? "app/views/" : "packages/#{destination_portal}/app/views"
18
18
  [
19
19
  "plutonium/_resource_header.html.erb",
20
20
  "plutonium/_resource_sidebar.html.erb"
@@ -27,8 +27,8 @@ module Pu
27
27
 
28
28
  private
29
29
 
30
- def destination_app
31
- @destination_app || select_app(options[:dest], msg: "Select destination app")
30
+ def destination_portal
31
+ @destination_portal || select_portal(options[:dest], msg: "Select destination portal")
32
32
  end
33
33
 
34
34
  def copy_file(source_path, destination_path)
@@ -21,7 +21,7 @@ module Pu
21
21
 
22
22
  gitignore "!/.env.template", "!/.env.local.template", "!/.env"
23
23
 
24
- insert_into_file "Gemfile", "\ngem \"dotenv\", :groups => [:development, :test]\n", after: /^gem ["']rails["'].*\n/
24
+ insert_into_file "Gemfile", "\ngem \"dotenv\", groups: %i[development test]\n", after: /^gem ["']rails["'].*\n/
25
25
  bundle!
26
26
  end
27
27
  rescue => e
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../lib/plutonium_generators"
4
+
5
+ module Pu
6
+ module Gem
7
+ class LetterOpenerGenerator < Rails::Generators::Base
8
+ include PlutoniumGenerators::Generator
9
+
10
+ desc "Set up letter_opener"
11
+
12
+ def start
13
+ bundle "letter_opener", group: :development
14
+ environment "config.action_mailer.delivery_method = :letter_opener", env: :development
15
+ environment "config.action_mailer.perform_deliveries = true", env: :development
16
+ rescue => e
17
+ exception "#{self.class} failed:", e
18
+ end
19
+ end
20
+ end
21
+ end
@@ -7,8 +7,6 @@ module Pu
7
7
  class RedisGenerator < Rails::Generators::Base
8
8
  include PlutoniumGenerators::Generator
9
9
 
10
- source_root File.expand_path("templates", __dir__)
11
-
12
10
  desc "Set up redis"
13
11
 
14
12
  def start
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../lib/plutonium_generators"
4
+
5
+ module Pu
6
+ module Gem
7
+ class StandardGenerator < Rails::Generators::Base
8
+ include PlutoniumGenerators::Generator
9
+
10
+ desc "Set up standardrb"
11
+
12
+ def start
13
+ bundle "standardrb"
14
+ rescue => e
15
+ exception "#{self.class} failed:", e
16
+ end
17
+ end
18
+ end
19
+ end
@@ -52,7 +52,7 @@ module PlutoniumGenerators
52
52
  end
53
53
  end
54
54
 
55
- def select_app(selected_package = nil, msg: "Select app")
55
+ def select_portal(selected_package = nil, msg: "Select portal")
56
56
  select_package(selected_package, msg: msg, pkgs: available_apps)
57
57
  end
58
58
 
@@ -22,7 +22,7 @@ module Pu
22
22
  error "No resources found" if available_resources.blank?
23
23
  selected_resources = prompt.multi_select("Select resources", available_resources)
24
24
 
25
- @app_namespace = select_app.camelize
25
+ @app_namespace = select_portal.camelize
26
26
 
27
27
  selected_resources.each do |resource|
28
28
  @resource_class = resource
@@ -9,7 +9,7 @@ module Plutonium
9
9
 
10
10
  included do
11
11
  authorize :user, through: :current_user
12
- authorize :scope, through: :entity_scope_for_authorize
12
+ authorize :entity_scope, through: :entity_scope_for_authorize
13
13
 
14
14
  helper_method :policy_for, :authorized_resource_scope
15
15
  end
@@ -14,8 +14,12 @@ module Plutonium
14
14
  end
15
15
  end
16
16
 
17
- def action(name, **)
18
- instance_defined_actions[name] = Plutonium::Action::Simple.new(name, **)
17
+ def action(name, interaction: nil, **)
18
+ instance_defined_actions[name] = if interaction
19
+ Plutonium::Action::Interactive::Factory.create(name, interaction:, **)
20
+ else
21
+ Plutonium::Action::Simple.new(name, **)
22
+ end
19
23
  end
20
24
 
21
25
  def defined_actions
@@ -29,6 +29,7 @@ module Plutonium
29
29
  include Actions
30
30
  include Sorting
31
31
  include Search
32
+ include NestedInputs
32
33
 
33
34
  class IndexPage < Plutonium::UI::Page::Index; end
34
35
 
@@ -0,0 +1,19 @@
1
+ module Plutonium
2
+ module Definition
3
+ module NestedInputs
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ defineable_prop :nested_input
8
+
9
+ # def self.nested_input(name, with: nil, **)
10
+ # defined_nested_inputs[name] = {}
11
+ # end
12
+
13
+ # def nested_input(name, with: nil, **)
14
+ # instance_defined_nested_inputs[name] = {}
15
+ # end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -53,10 +53,6 @@ module Plutonium
53
53
  extend_action_dispatch
54
54
  end
55
55
 
56
- initializer "plutonium.active_record_extensions" do
57
- extend_active_record
58
- end
59
-
60
56
  initializer "plutonium.phlexi_themes" do
61
57
  setup_phlexi_themes
62
58
  end
@@ -114,11 +110,5 @@ module Plutonium
114
110
  ActionDispatch::Routing::RouteSet.prepend Plutonium::Routing::RouteSetExtensions
115
111
  Rails::Engine.include Plutonium::Routing::ResourceRegistration
116
112
  end
117
-
118
- def extend_active_record
119
- ActiveSupport.on_load(:active_record) do
120
- include Plutonium::Resource::Record
121
- end
122
- end
123
113
  end
124
114
  end
@@ -59,7 +59,7 @@ module Plutonium
59
59
  # Returns the submitted resource parameters
60
60
  # @return [Hash] The submitted resource parameters
61
61
  def submitted_resource_params
62
- @submitted_resource_params ||= build_form(resource_class.new).extract_input(params)[resource_param_key.to_sym]
62
+ @submitted_resource_params ||= build_form(resource_class.new).extract_input(params, view_context:)[resource_param_key.to_sym]
63
63
  end
64
64
 
65
65
  # Returns the resource parameters, including scoped and parent parameters
@@ -148,7 +148,7 @@ module Plutonium
148
148
  end
149
149
 
150
150
  def redirect_url_after_destroy
151
- if (return_to = url_from(params[:return_to]))
151
+ if (return_to = url_from(params[:return_to])) && return_to != request.url
152
152
  return return_to
153
153
  end
154
154
 
@@ -232,7 +232,7 @@ module Plutonium
232
232
  @submitted_interaction_params ||= current_interactive_action
233
233
  .interaction
234
234
  .build_form(nil)
235
- .extract_input(params)[:interaction]
235
+ .extract_input(params, view_context:)[:interaction]
236
236
  end
237
237
 
238
238
  def redirect_url_after_action_on(resource_record_or_resource_class)
@@ -5,7 +5,7 @@ module Plutonium
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- helper_method :presentable_attributes, :present_associations?
8
+ helper_method :presentable_attributes
9
9
  helper_method :build_form, :build_detail, :build_collection
10
10
  end
11
11
 
@@ -31,10 +31,6 @@ module Plutonium
31
31
  def build_form(record = resource_record)
32
32
  current_definition.form_class.new(record, resource_fields: presentable_attributes, resource_definition: current_definition)
33
33
  end
34
-
35
- def present_associations?
36
- current_parent.nil?
37
- end
38
34
  end
39
35
  end
40
36
  end
@@ -7,13 +7,12 @@ module Plutonium
7
7
  # and to retrieve permitted attributes for these actions.
8
8
  class Policy < ActionPolicy::Base
9
9
  authorize :user, allow_nil: false
10
- authorize :scope, allow_nil: true
10
+ authorize :entity_scope, allow_nil: true
11
11
 
12
12
  relation_scope do |relation|
13
- if scope.present?
14
- relation = relation.associated_with(scope)
15
- end
16
- relation
13
+ next relation unless entity_scope
14
+
15
+ relation.associated_with(entity_scope)
17
16
  end
18
17
 
19
18
  # Sends a method and raises an error if the method is not implemented.
@@ -21,6 +21,9 @@ module Plutonium
21
21
  # @return [void]
22
22
  def register(resource)
23
23
  raise FrozenRegisterError, "Cannot modify frozen resource register" if @frozen
24
+ unless resource.include?(Plutonium::Resource::Record)
25
+ raise ArgumentError, "#{resource} must include Plutonium::Resource::Record before being registered"
26
+ end
24
27
 
25
28
  @resources.add(resource.to_s)
26
29
  end
@@ -80,7 +80,7 @@ module Plutonium
80
80
  if @variant == :table
81
81
  "h-4 w-4 mr-1"
82
82
  else
83
- "h-3.5 w-3.5 mr-2 -ml-1"
83
+ "h-3.5 w-3.5 -ml-1"
84
84
  end
85
85
  end
86
86
 
@@ -91,35 +91,50 @@ module Plutonium
91
91
  def color_classes
92
92
  case @action.color || @action.category.to_sym
93
93
  when :primary
94
- table_variant_class(
95
- "bg-primary-100 text-primary-700 hover:bg-primary-200 focus:ring-primary-300 dark:bg-primary-700 dark:text-primary-100 dark:hover:bg-primary-600 dark:focus:ring-primary-600",
96
- "bg-primary-700 text-white hover:bg-primary-800 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
94
+ variant_class(
95
+ "bg-primary-700 text-white hover:bg-primary-800 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800",
96
+ table: "bg-primary-100 text-primary-700 hover:bg-primary-200 focus:ring-primary-300 dark:bg-primary-700 dark:text-primary-100 dark:hover:bg-primary-600 dark:focus:ring-primary-600"
97
+ )
98
+ when :success
99
+ variant_class(
100
+ "bg-success-700 text-white hover:bg-success-800 focus:ring-success-300 dark:bg-success-600 dark:hover:bg-success-700 dark:focus:ring-success-800",
101
+ table: "bg-success-100 text-success-700 hover:bg-success-200 focus:ring-success-300 dark:bg-success-700 dark:text-success-100 dark:hover:bg-success-600 dark:focus:ring-success-600"
102
+ )
103
+ when :info
104
+ variant_class(
105
+ "bg-info-700 text-white hover:bg-info-800 focus:ring-info-300 dark:bg-info-600 dark:hover:bg-info-700 dark:focus:ring-info-800",
106
+ table: "bg-info-100 text-info-700 hover:bg-info-200 focus:ring-info-300 dark:bg-info-700 dark:text-info-100 dark:hover:bg-info-600 dark:focus:ring-info-600"
97
107
  )
98
108
  when :warning
99
- table_variant_class(
100
- "bg-yellow-100 text-yellow-700 hover:bg-yellow-200 focus:ring-yellow-300 dark:bg-yellow-700 dark:text-yellow-100 dark:hover:bg-yellow-600 dark:focus:ring-yellow-600",
101
- "bg-yellow-400 text-white hover:bg-yellow-500 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800"
109
+ variant_class(
110
+ "bg-warning-700 text-white hover:bg-warning-800 focus:ring-warning-300 dark:bg-warning-600 dark:hover:bg-warning-700 dark:focus:ring-warning-800",
111
+ table: "bg-warning-100 text-warning-700 hover:bg-warning-200 focus:ring-warning-300 dark:bg-warning-700 dark:text-warning-100 dark:hover:bg-warning-600 dark:focus:ring-warning-600"
102
112
  )
103
113
  when :danger
104
- table_variant_class(
105
- "bg-red-100 text-red-700 hover:bg-red-200 focus:ring-red-300 dark:bg-red-700 dark:text-red-100 dark:hover:bg-red-600 dark:focus:ring-red-600",
106
- "bg-red-700 text-white hover:bg-red-800 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"
114
+ variant_class(
115
+ "bg-danger-700 text-white hover:bg-danger-800 focus:ring-danger-300 dark:bg-danger-600 dark:hover:bg-danger-700 dark:focus:ring-danger-800",
116
+ table: "bg-danger-100 text-danger-700 hover:bg-danger-200 focus:ring-danger-300 dark:bg-danger-700 dark:text-danger-100 dark:hover:bg-danger-600 dark:focus:ring-danger-600"
107
117
  )
108
- when :success
109
- table_variant_class(
110
- "bg-green-100 text-green-700 hover:bg-green-200 focus:ring-green-300 dark:bg-green-700 dark:text-green-100 dark:hover:bg-green-600 dark:focus:ring-green-600",
111
- "bg-green-700 text-white hover:bg-green-800 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800"
118
+ when :accent
119
+ variant_class(
120
+ "bg-accent-700 text-white hover:bg-accent-800 focus:ring-accent-300 dark:bg-accent-600 dark:hover:bg-accent-700 dark:focus:ring-accent-800",
121
+ table: "bg-accent-100 text-accent-700 hover:bg-accent-200 focus:ring-accent-300 dark:bg-accent-700 dark:text-accent-100 dark:hover:bg-accent-600 dark:focus:ring-accent-600"
112
122
  )
113
123
  else
114
- table_variant_class(
115
- "bg-gray-100 text-gray-700 hover:bg-gray-200 focus:ring-gray-300 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600 dark:focus:ring-gray-600",
116
- "border border-gray-200 bg-white text-gray-900 hover:bg-gray-100 hover:text-primary-700 focus:z-10 focus:ring-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
124
+ variant_class(
125
+ "bg-secondary-700 text-white hover:bg-secondary-800 focus:ring-secondary-300 dark:bg-secondary-600 dark:hover:bg-secondary-700 dark:focus:ring-secondary-800",
126
+ table: "bg-secondary-100 text-secondary-700 hover:bg-secondary-200 focus:ring-secondary-300 dark:bg-secondary-700 dark:text-secondary-100 dark:hover:bg-secondary-600 dark:focus:ring-secondary-600"
117
127
  )
118
128
  end
119
129
  end
120
130
 
121
- def table_variant_class(table_class, default_class)
122
- (@variant == :table) ? table_class : default_class
131
+ def variant_class(default, table:)
132
+ case @variant
133
+ when :table
134
+ table
135
+ else
136
+ default
137
+ end
123
138
  end
124
139
  end
125
140
  end
@@ -0,0 +1,13 @@
1
+ module Plutonium
2
+ module UI
3
+ class Block < Plutonium::UI::Component::Base
4
+ def view_template(&)
5
+ raise ArgumentError, "Block requires a content block" unless block_given?
6
+
7
+ div class: "relative bg-white dark:bg-gray-800 shadow-md sm:rounded-lg my-3" do
8
+ yield
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -10,6 +10,16 @@ module Plutonium
10
10
 
11
11
  def Breadcrumbs(...) = render Plutonium::UI::Breadcrumbs.new(...)
12
12
 
13
+ def SkeletonTable(...) = render Plutonium::UI::SkeletonTable.new(...)
14
+
15
+ def Block(...) = render Plutonium::UI::Block.new(...)
16
+
17
+ def Panel(...) = render Plutonium::UI::Panel.new(...)
18
+
19
+ def FrameNavigatorPanel(...) = render Plutonium::UI::FrameNavigatorPanel.new(...)
20
+
21
+ def DynaFrameHost(...) = render Plutonium::UI::DynaFrame::Host.new(...)
22
+
13
23
  def DynaFrameContent(...) = render Plutonium::UI::DynaFrame::Content.new(...)
14
24
 
15
25
  def PageHeader(...) = render Plutonium::UI::PageHeader.new(...)
@@ -21,19 +21,37 @@ module Plutonium
21
21
  private
22
22
 
23
23
  def render_fields
24
- fields_wrapper {
25
- resource_fields.each { |name|
26
- render_resource_field name
27
- }
28
- }
24
+ Block do
25
+ fields_wrapper do
26
+ resource_fields.each do |name|
27
+ render_resource_field name
28
+ end
29
+ end
30
+ end
29
31
  end
30
32
 
31
33
  def render_associations
32
- nil
33
- # TODO
34
- # resource_associations.each do |name, renderer|
35
- # # <%= render renderer.with(record: details.record) %>
36
- # end
34
+ resource_associations.each do |name|
35
+ reflection = object.class.reflect_on_association name
36
+
37
+ if !reflection
38
+ raise ArgumentError,
39
+ "unknown association #{object.class}##{name} defined in #permitted_associations"
40
+ elsif !registered_resources.include?(reflection.klass)
41
+ raise ArgumentError,
42
+ "#{object.class}##{name} defined in #permitted_associations, but #{reflection.klass} is not a registered resource"
43
+ end
44
+
45
+ title = object.class.human_attribute_name(name)
46
+ src = case reflection.macro
47
+ when :belongs_to
48
+ associated = object.public_send name
49
+ resource_url_for(associated, parent: nil) if associated
50
+ when :has_many
51
+ resource_url_for(reflection.klass, parent: object)
52
+ end
53
+ FrameNavigatorPanel(title:, src:) if src
54
+ end
37
55
  end
38
56
 
39
57
  def render_resource_field(name)
@@ -73,7 +91,7 @@ module Plutonium
73
91
  end
74
92
 
75
93
  def present_associations?
76
- current_parent.nil?
94
+ current_turbo_frame.nil?
77
95
  end
78
96
  end
79
97
  end
@@ -6,7 +6,7 @@ module Plutonium
6
6
  class Theme < Phlexi::Display::Theme
7
7
  def self.theme
8
8
  super.merge({
9
- base: "relative bg-white dark:bg-gray-800 shadow-md sm:rounded-lg my-3",
9
+ base: "",
10
10
  value_wrapper: "max-h-[300px] overflow-y-auto",
11
11
  fields_wrapper: "p-6 grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-6 gap-y-10 grid-flow-row-dense",
12
12
  label: "text-base font-bold text-gray-500 dark:text-gray-400 mb-1",
@@ -6,10 +6,10 @@ module Plutonium
6
6
 
7
7
  def view_template
8
8
  if current_turbo_frame.present?
9
- render turbo_frame_tag(current_turbo_frame) {
9
+ turbo_frame_tag(current_turbo_frame) do
10
10
  render "flash"
11
11
  yield
12
- }
12
+ end
13
13
  else
14
14
  yield
15
15
  end
@@ -0,0 +1,20 @@
1
+ module Plutonium
2
+ module UI
3
+ module DynaFrame
4
+ class Host < Plutonium::UI::Component::Base
5
+ include Phlex::Rails::Helpers::TurboFrameTag
6
+
7
+ def initialize(src:, loading:, id: SecureRandom.hex, **attributes)
8
+ @id = id
9
+ @src = src
10
+ @loading = loading
11
+ @attributes = attributes
12
+ end
13
+
14
+ def view_template(&)
15
+ turbo_frame_tag(@id, src: @src, loading: @loading, **@attributes, &)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end