plutonium 0.19.6 → 0.19.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: feee9c606abae32c2ebd4f32a59fffa47372d45c43791b1a74fe23d131651e2f
4
- data.tar.gz: 18dc4877bc6139941cf369738266e09211174e6c06b134cb059d261bb97c1da8
3
+ metadata.gz: 304744c1553f36ea4c0a56bbbf84fef96125ea0ec6b4280eccaa7d362934ae43
4
+ data.tar.gz: 3f0ec23b889380ec257766338a3c1e3dc4f247484a57aa7b62ed6e789d7346d4
5
5
  SHA512:
6
- metadata.gz: c6739a45198d4e71b870dbdede7c7ab3760f1ed4d83500a0931a39a0331cf362aa700acdf9a4f99ca3f01aa8b849a1ac61c3ac2b4dd4fb1343c1a817d2b989ea
7
- data.tar.gz: aabc0815e110094801b02231b25e6413f021031b7bd835dce5cc41695f3a74e322be3ece16c0ca79582bbf4e15137d8317e1a89396dd3937dad1173b76d4edfb
6
+ metadata.gz: 4a4af1fca2179de9d88c247b10d717a40ca17702dd8342f3045794dee5bd4343eef9af555b8144753143581f4b27ee7988bc6d4817876a9e49864b2d3e75a0f1
7
+ data.tar.gz: 11f274a12630a2bc240743bdf05a0eacd4cdb79d02a010deb5d04f6d97e8213561f1bd0e81afdfcd2d84b4b7491d2ee0055be33869dc44aef270a679d29bdd32
@@ -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
@@ -53,11 +53,16 @@ module Plutonium
53
53
 
54
54
  field_options = resource_definition.defined_fields[name] ? resource_definition.defined_fields[name][:options].dup : {}
55
55
 
56
+ display_definition = resource_definition.defined_displays[name] || {}
57
+ display_options = display_definition[:options] || {}
58
+
56
59
  column_definition = resource_definition.defined_columns[name] || {}
57
60
  column_options = column_definition[:options] || {}
58
61
 
59
- tag = column_options[:as] || field_options[:as]
60
- tag_attributes = column_options.except(:wrapper, :as, :align)
62
+ tag = column_options[:as] || display_definition[:as] || field_options[:as]
63
+ display_tag_attributes = display_options.except(:wrapper, :as)
64
+ column_tag_attributes = column_options.except(:wrapper, :as, :align)
65
+ tag_attributes = display_tag_attributes.merge(column_tag_attributes)
61
66
  tag_block = column_definition[:block] || ->(wrapped_object, key) {
62
67
  f = wrapped_object.field(key)
63
68
  tag ||= f.inferred_field_component
@@ -1,5 +1,5 @@
1
1
  module Plutonium
2
- VERSION = "0.19.6"
2
+ VERSION = "0.19.8"
3
3
  NEXT_MAJOR_VERSION = VERSION.split(".").tap { |v|
4
4
  v[1] = v[1].to_i + 1
5
5
  v[2] = 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.6
4
+ version: 0.19.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
@@ -808,6 +808,7 @@ files:
808
808
  - lib/plutonium/ui/display/components/association.rb
809
809
  - lib/plutonium/ui/display/components/attachment.rb
810
810
  - lib/plutonium/ui/display/components/markdown.rb
811
+ - lib/plutonium/ui/display/components/phlexi_render.rb
811
812
  - lib/plutonium/ui/display/options/inferred_types.rb
812
813
  - lib/plutonium/ui/display/resource.rb
813
814
  - lib/plutonium/ui/display/theme.rb