loco_motion-rails 0.5.1 → 0.5.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/README.md +4 -0
- data/app/components/daisy/data_display/figure_component.rb +25 -4
- data/lib/loco_motion/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45493a564ee06b46d005e1b8fd3d0b6494ca86fed95644180b037e03d9929187
|
|
4
|
+
data.tar.gz: 0235c74fb512553dc2876491adcde9bbbf67df912c08da4576950f6017bf829e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a9eeacda41e80c0bcc9be24ad40b6b678974b5991259fcf023d3f63763cf595b2de010fe75b34e68e7ad38edf854229d0e55ddfea6d81e3a62038bb836dffe8
|
|
7
|
+
data.tar.gz: 807ac93a53b5b8ca6cc4e7775f0e5c1f554f0d0ce9abf2781247fa2ff5b30f92f1d485c3bd1db88d49eb65bf628ef2c828d2117ca45b0e1efff751df7b4822d8
|
data/README.md
CHANGED
|
@@ -994,6 +994,10 @@ the GitHub Discussions feature and let us know!
|
|
|
994
994
|
the `lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb`
|
|
995
995
|
- [ ] Make the tooltips documentation button a component and use it for the
|
|
996
996
|
Labelable concern docs too
|
|
997
|
+
- [x] Update LLM.txt with better examples showing actual usage scenarios
|
|
998
|
+
- Right now, LLMs don't see enough things like HREFs in buttons / links
|
|
999
|
+
- Cards still try to do a `card.with_body` or even `card.with_title` for
|
|
1000
|
+
just a string
|
|
997
1001
|
|
|
998
1002
|
[1]: https://loco-motion.profoundry.us/
|
|
999
1003
|
[2]: https://loco-motion-demo-staging.profoundry.us/
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
# = daisy_figure do
|
|
16
16
|
# Content when no image is provided
|
|
17
17
|
#
|
|
18
|
+
# @loco_example Image Position Bottom
|
|
19
|
+
# = daisy_figure(src: "example.jpg", position: :bottom) do
|
|
20
|
+
# Caption appears above the image
|
|
21
|
+
#
|
|
18
22
|
class Daisy::DataDisplay::FigureComponent < LocoMotion::BaseComponent
|
|
19
23
|
include LocoMotion::Concerns::LinkableComponent
|
|
20
24
|
|
|
@@ -26,12 +30,18 @@ class Daisy::DataDisplay::FigureComponent < LocoMotion::BaseComponent
|
|
|
26
30
|
#
|
|
27
31
|
# @option kws src [String] URL of the image to display in the figure.
|
|
28
32
|
#
|
|
33
|
+
# @option kws position [Symbol] Position of the image relative to content.
|
|
34
|
+
# Must be :top (default) or :bottom.
|
|
35
|
+
#
|
|
29
36
|
# @option kws css [String] Additional CSS classes for styling.
|
|
30
37
|
#
|
|
31
38
|
def initialize(**kws, &block)
|
|
32
39
|
super
|
|
33
40
|
|
|
34
41
|
@src = kws[:src]
|
|
42
|
+
@position = kws[:position] || :top
|
|
43
|
+
|
|
44
|
+
validate_position!
|
|
35
45
|
end
|
|
36
46
|
|
|
37
47
|
def before_render
|
|
@@ -43,12 +53,23 @@ class Daisy::DataDisplay::FigureComponent < LocoMotion::BaseComponent
|
|
|
43
53
|
|
|
44
54
|
def call
|
|
45
55
|
part(:component) do
|
|
46
|
-
if @
|
|
47
|
-
|
|
56
|
+
if @position == :bottom
|
|
57
|
+
# Show content first, then image
|
|
58
|
+
concat(content)
|
|
59
|
+
concat(part(:image)) if @src
|
|
60
|
+
else
|
|
61
|
+
# Default: show image first, then content
|
|
62
|
+
concat(part(:image)) if @src
|
|
63
|
+
concat(content)
|
|
48
64
|
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
49
69
|
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
def validate_position!
|
|
71
|
+
unless %i[top bottom].include?(@position)
|
|
72
|
+
raise ArgumentError, "position must be :top or :bottom, got '#{@position}'"
|
|
52
73
|
end
|
|
53
74
|
end
|
|
54
75
|
end
|
data/lib/loco_motion/version.rb
CHANGED