plutonium 0.19.7 → 0.19.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/plutonium/core/controller.rb +7 -2
- data/lib/plutonium/definition/base.rb +9 -0
- data/lib/plutonium/definition/inheritable_config_attr.rb +33 -0
- data/lib/plutonium/ui/display/base.rb +5 -0
- data/lib/plutonium/ui/display/components/phlexi_render.rb +37 -0
- data/lib/plutonium/ui/display/theme.rb +2 -1
- data/lib/plutonium/ui/form/interaction.rb +1 -1
- data/lib/plutonium/ui/page/base.rb +10 -0
- data/lib/plutonium/ui/page/edit.rb +2 -0
- data/lib/plutonium/ui/page/index.rb +2 -0
- data/lib/plutonium/ui/page/interactive_action.rb +2 -0
- data/lib/plutonium/ui/page/new.rb +2 -0
- data/lib/plutonium/ui/page/show.rb +2 -0
- data/lib/plutonium/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8abd5778444672b73c3d753ff3cabb345b3ce4df072be785fa4b26e7bf467f95
|
4
|
+
data.tar.gz: 2d98edacc5cacf6b30c8b5feaf77c3c5c6a4397e39650003ea0216bf15cc6757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93f0c4e6f53206fc2ff1390b24812637b00e6dd930574304729847222d39d323228991084105f64635da44961132c4c3b241c2d81fb8ffe47c777c02957897f8
|
7
|
+
data.tar.gz: 1a0c4f493282a182fe264001b69c4dfd09788e81a2d38ee665edcf10365f369bc638f67d2a7386edcb8e4dff828d26f4b9e5bc686ac4e1174ce0a4bdfced0cb8
|
@@ -16,7 +16,8 @@ module Plutonium
|
|
16
16
|
end
|
17
17
|
|
18
18
|
helper Plutonium::Helpers
|
19
|
-
helper_method :make_page_title, :resource_url_for,
|
19
|
+
helper_method :make_page_title, :resource_url_for,
|
20
|
+
:resource_url_args_for, :root_path, :app_name
|
20
21
|
|
21
22
|
append_view_path File.expand_path("app/views", Plutonium.root)
|
22
23
|
layout -> { turbo_frame_request? ? false : "resource" }
|
@@ -30,7 +31,11 @@ module Plutonium
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def make_page_title(title)
|
33
|
-
[title.presence,
|
34
|
+
[title.presence, app_name].compact.join(" | ")
|
35
|
+
end
|
36
|
+
|
37
|
+
def app_name
|
38
|
+
helpers.application_name
|
34
39
|
end
|
35
40
|
|
36
41
|
#
|
@@ -26,6 +26,7 @@ module Plutonium
|
|
26
26
|
class Base
|
27
27
|
include DefineableProps
|
28
28
|
include ConfigAttr
|
29
|
+
include InheritableConfigAttr
|
29
30
|
include Actions
|
30
31
|
include Sorting
|
31
32
|
include Search
|
@@ -64,6 +65,14 @@ module Plutonium
|
|
64
65
|
:new_page_title, :new_page_description,
|
65
66
|
:edit_page_title, :edit_page_description
|
66
67
|
|
68
|
+
# breadcrumbs
|
69
|
+
inheritable_config_attr :breadcrumbs,
|
70
|
+
:index_page_breadcrumbs, :new_page_breadcrumbs,
|
71
|
+
:edit_page_breadcrumbs, :show_page_breadcrumbs,
|
72
|
+
:interactive_action_page_breadcrumbs
|
73
|
+
# global default
|
74
|
+
breadcrumbs true
|
75
|
+
|
67
76
|
def initialize
|
68
77
|
super
|
69
78
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Plutonium
|
2
|
+
module Definition
|
3
|
+
module InheritableConfigAttr
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
class_methods do
|
7
|
+
def inheritable_config_attr(*names)
|
8
|
+
names.each do |name|
|
9
|
+
# Create the underlying class_attribute
|
10
|
+
attr_name = :"#{name}_config"
|
11
|
+
class_attribute attr_name, instance_reader: true, instance_accessor: false, default: nil
|
12
|
+
|
13
|
+
# Define class-level method that acts as both getter/setter
|
14
|
+
define_singleton_method(name) do |value = :__not_set__|
|
15
|
+
if value == :__not_set__
|
16
|
+
# Getter behavior
|
17
|
+
public_send(:"#{attr_name}")
|
18
|
+
else
|
19
|
+
# Setter behavior
|
20
|
+
public_send(:"#{attr_name}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Instance-level method
|
25
|
+
define_method(name) do
|
26
|
+
self.class.send(name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -20,6 +20,11 @@ module Plutonium
|
|
20
20
|
def attachment_tag(**, &)
|
21
21
|
create_component(Plutonium::UI::Display::Components::Attachment, :attachment, **, &)
|
22
22
|
end
|
23
|
+
|
24
|
+
def phlexi_render_tag(**, &)
|
25
|
+
create_component(Plutonium::UI::Display::Components::PhlexiRender, :phlexi_render, **, &)
|
26
|
+
end
|
27
|
+
alias_method :phlexi_tag, :phlexi_render_tag
|
23
28
|
end
|
24
29
|
|
25
30
|
private
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "redcarpet"
|
4
|
+
|
5
|
+
module Plutonium
|
6
|
+
module UI
|
7
|
+
module Display
|
8
|
+
module Components
|
9
|
+
class PhlexiRender < Phlexi::Display::Components::Base
|
10
|
+
include Phlexi::Display::Components::Concerns::DisplaysValue
|
11
|
+
include Plutonium::UI::Component::Behaviour
|
12
|
+
|
13
|
+
def render_value(value)
|
14
|
+
phlexi_render(build_phlexi_component(value)) {
|
15
|
+
p(**attributes) {
|
16
|
+
value
|
17
|
+
}
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
def build_attributes
|
24
|
+
super
|
25
|
+
@builder = attributes.delete(:with)
|
26
|
+
end
|
27
|
+
|
28
|
+
def build_phlexi_component(value)
|
29
|
+
raise "Required option, :with not passed" unless @builder
|
30
|
+
|
31
|
+
@builder.call(value, attributes)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -22,7 +22,8 @@ module Plutonium
|
|
22
22
|
json: "text-sm text-gray-900 dark:text-white mb-1 whitespace-pre font-mono shadow-inner p-4",
|
23
23
|
prefixed_icon: "w-8 h-8 mr-2",
|
24
24
|
markdown: "format dark:format-invert format-primary",
|
25
|
-
attachment_value_wrapper: "grid grid-cols-[repeat(auto-fill,minmax(0,180px))]"
|
25
|
+
attachment_value_wrapper: "grid grid-cols-[repeat(auto-fill,minmax(0,180px))]",
|
26
|
+
phlexi_render: :string
|
26
27
|
})
|
27
28
|
end
|
28
29
|
end
|
@@ -43,9 +43,17 @@ module Plutonium
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def render_breadcrumbs
|
46
|
+
return unless render_breadcrumbs?
|
47
|
+
|
46
48
|
Breadcrumbs()
|
47
49
|
end
|
48
50
|
|
51
|
+
def render_breadcrumbs?
|
52
|
+
# Check specific page setting first, fall back to global setting
|
53
|
+
page_specific_setting = current_definition.send(:"#{page_type}_breadcrumbs")
|
54
|
+
page_specific_setting.nil? ? current_definition.breadcrumbs : page_specific_setting
|
55
|
+
end
|
56
|
+
|
49
57
|
def render_page_header
|
50
58
|
return unless page_title
|
51
59
|
|
@@ -106,6 +114,8 @@ module Plutonium
|
|
106
114
|
|
107
115
|
def render_after_footer
|
108
116
|
end
|
117
|
+
|
118
|
+
def page_type = raise NotImplementedError, "#{self.class}#page_type"
|
109
119
|
end
|
110
120
|
end
|
111
121
|
end
|
data/lib/plutonium/version.rb
CHANGED
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.19.
|
4
|
+
version: 0.19.9
|
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-
|
11
|
+
date: 2025-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -726,6 +726,7 @@ files:
|
|
726
726
|
- lib/plutonium/definition/base.rb
|
727
727
|
- lib/plutonium/definition/config_attr.rb
|
728
728
|
- lib/plutonium/definition/defineable_props.rb
|
729
|
+
- lib/plutonium/definition/inheritable_config_attr.rb
|
729
730
|
- lib/plutonium/definition/nested_inputs.rb
|
730
731
|
- lib/plutonium/definition/presentable.rb
|
731
732
|
- lib/plutonium/definition/search.rb
|
@@ -808,6 +809,7 @@ files:
|
|
808
809
|
- lib/plutonium/ui/display/components/association.rb
|
809
810
|
- lib/plutonium/ui/display/components/attachment.rb
|
810
811
|
- lib/plutonium/ui/display/components/markdown.rb
|
812
|
+
- lib/plutonium/ui/display/components/phlexi_render.rb
|
811
813
|
- lib/plutonium/ui/display/options/inferred_types.rb
|
812
814
|
- lib/plutonium/ui/display/resource.rb
|
813
815
|
- lib/plutonium/ui/display/theme.rb
|