iron-cms 0.17.1 → 0.17.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/builds/iron.css +5 -177
- data/app/assets/tailwind/iron/components/drawer.css +1 -1
- data/app/assets/tailwind/iron/components/selection-list.css +1 -0
- data/app/helpers/iron/application_helper.rb +1 -1
- data/app/helpers/iron/field_definitions_helper.rb +30 -0
- data/app/helpers/iron/fields_helper.rb +12 -0
- data/app/helpers/iron/ui_helper.rb +0 -33
- data/app/javascript/iron/controllers/file_upload_controller.js +25 -13
- data/app/views/iron/entries/fields/_file.html.erb +20 -11
- data/app/views/iron/field_definitions/_field_definition.html.erb +2 -4
- data/app/views/iron/field_definitions/_type_picker.html.erb +4 -6
- data/app/views/iron/field_definitions/edit.html.erb +2 -4
- data/lib/iron/version.rb +1 -1
- metadata +24 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7441460ff6c611510525a11808f5fe2deb724574380f91b5ffab5edbb1c571a0
|
|
4
|
+
data.tar.gz: 157944fd97ba5e0b6aba79409fd0b456bd6bef4cb802ed836eba2dc9b693de15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fd0f51df8afd88331e30b3349eee6e1dfb6df988ab1f17b5a5362d2e94f71d6fbabfb2e62001c8627c6e2a2c5c0a0ad998c4ae9b192319b6cf37d392ef13fe2
|
|
7
|
+
data.tar.gz: a6a1b3169c158dae96b9190b0553b0e83eaf450df510cefcc70915aca31087284d495fc28269c271a9827f3a59f2d04cca87657b00e22e0e392cd3eedbec8ae7
|
data/app/assets/builds/iron.css
CHANGED
|
@@ -2328,6 +2328,9 @@
|
|
|
2328
2328
|
.max-w-80 {
|
|
2329
2329
|
max-width: calc(var(--spacing) * 80);
|
|
2330
2330
|
}
|
|
2331
|
+
.max-w-full {
|
|
2332
|
+
max-width: 100%;
|
|
2333
|
+
}
|
|
2331
2334
|
.max-w-lg {
|
|
2332
2335
|
max-width: var(--container-lg);
|
|
2333
2336
|
}
|
|
@@ -2663,74 +2666,6 @@
|
|
|
2663
2666
|
.border-t-stone-600 {
|
|
2664
2667
|
border-top-color: var(--color-stone-600);
|
|
2665
2668
|
}
|
|
2666
|
-
.badge-amber {
|
|
2667
|
-
background-color: color-mix(in srgb, oklch(82.8% 0.189 84.429) 20%, transparent);
|
|
2668
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2669
|
-
background-color: color-mix(in oklab, var(--color-amber-400) 20%, transparent);
|
|
2670
|
-
}
|
|
2671
|
-
color: var(--color-amber-700);
|
|
2672
|
-
&:is(:where(.group):hover *) {
|
|
2673
|
-
@media (hover: hover) {
|
|
2674
|
-
background-color: color-mix(in srgb, oklch(82.8% 0.189 84.429) 30%, transparent);
|
|
2675
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2676
|
-
background-color: color-mix(in oklab, var(--color-amber-400) 30%, transparent);
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
|
-
@media (prefers-color-scheme: dark) {
|
|
2681
|
-
background-color: color-mix(in srgb, oklch(82.8% 0.189 84.429) 10%, transparent);
|
|
2682
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2683
|
-
background-color: color-mix(in oklab, var(--color-amber-400) 10%, transparent);
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
@media (prefers-color-scheme: dark) {
|
|
2687
|
-
color: var(--color-amber-400);
|
|
2688
|
-
}
|
|
2689
|
-
@media (prefers-color-scheme: dark) {
|
|
2690
|
-
&:is(:where(.group):hover *) {
|
|
2691
|
-
@media (hover: hover) {
|
|
2692
|
-
background-color: color-mix(in srgb, oklch(82.8% 0.189 84.429) 15%, transparent);
|
|
2693
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2694
|
-
background-color: color-mix(in oklab, var(--color-amber-400) 15%, transparent);
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2699
|
-
}
|
|
2700
|
-
.badge-cyan {
|
|
2701
|
-
background-color: color-mix(in srgb, oklch(78.9% 0.154 211.53) 20%, transparent);
|
|
2702
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2703
|
-
background-color: color-mix(in oklab, var(--color-cyan-400) 20%, transparent);
|
|
2704
|
-
}
|
|
2705
|
-
color: var(--color-cyan-700);
|
|
2706
|
-
&:is(:where(.group):hover *) {
|
|
2707
|
-
@media (hover: hover) {
|
|
2708
|
-
background-color: color-mix(in srgb, oklch(78.9% 0.154 211.53) 30%, transparent);
|
|
2709
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2710
|
-
background-color: color-mix(in oklab, var(--color-cyan-400) 30%, transparent);
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
}
|
|
2714
|
-
@media (prefers-color-scheme: dark) {
|
|
2715
|
-
background-color: color-mix(in srgb, oklch(78.9% 0.154 211.53) 10%, transparent);
|
|
2716
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2717
|
-
background-color: color-mix(in oklab, var(--color-cyan-400) 10%, transparent);
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
@media (prefers-color-scheme: dark) {
|
|
2721
|
-
color: var(--color-cyan-300);
|
|
2722
|
-
}
|
|
2723
|
-
@media (prefers-color-scheme: dark) {
|
|
2724
|
-
&:is(:where(.group):hover *) {
|
|
2725
|
-
@media (hover: hover) {
|
|
2726
|
-
background-color: color-mix(in srgb, oklch(78.9% 0.154 211.53) 15%, transparent);
|
|
2727
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2728
|
-
background-color: color-mix(in oklab, var(--color-cyan-400) 15%, transparent);
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
2669
|
.badge-green {
|
|
2735
2670
|
background-color: color-mix(in srgb, oklch(72.3% 0.219 149.579) 15%, transparent);
|
|
2736
2671
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -2765,40 +2700,6 @@
|
|
|
2765
2700
|
}
|
|
2766
2701
|
}
|
|
2767
2702
|
}
|
|
2768
|
-
.badge-orange {
|
|
2769
|
-
background-color: color-mix(in srgb, oklch(70.5% 0.213 47.604) 15%, transparent);
|
|
2770
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2771
|
-
background-color: color-mix(in oklab, var(--color-orange-500) 15%, transparent);
|
|
2772
|
-
}
|
|
2773
|
-
color: var(--color-orange-700);
|
|
2774
|
-
&:is(:where(.group):hover *) {
|
|
2775
|
-
@media (hover: hover) {
|
|
2776
|
-
background-color: color-mix(in srgb, oklch(70.5% 0.213 47.604) 25%, transparent);
|
|
2777
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2778
|
-
background-color: color-mix(in oklab, var(--color-orange-500) 25%, transparent);
|
|
2779
|
-
}
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
@media (prefers-color-scheme: dark) {
|
|
2783
|
-
background-color: color-mix(in srgb, oklch(70.5% 0.213 47.604) 10%, transparent);
|
|
2784
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2785
|
-
background-color: color-mix(in oklab, var(--color-orange-500) 10%, transparent);
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
@media (prefers-color-scheme: dark) {
|
|
2789
|
-
color: var(--color-orange-400);
|
|
2790
|
-
}
|
|
2791
|
-
@media (prefers-color-scheme: dark) {
|
|
2792
|
-
&:is(:where(.group):hover *) {
|
|
2793
|
-
@media (hover: hover) {
|
|
2794
|
-
background-color: color-mix(in srgb, oklch(70.5% 0.213 47.604) 20%, transparent);
|
|
2795
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2796
|
-
background-color: color-mix(in oklab, var(--color-orange-500) 20%, transparent);
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
}
|
|
2801
|
-
}
|
|
2802
2703
|
.badge-red {
|
|
2803
2704
|
background-color: color-mix(in srgb, oklch(63.7% 0.237 25.331) 15%, transparent);
|
|
2804
2705
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -2857,24 +2758,6 @@
|
|
|
2857
2758
|
}
|
|
2858
2759
|
}
|
|
2859
2760
|
}
|
|
2860
|
-
.badge-stone {
|
|
2861
|
-
background-color: var(--color-stone-100);
|
|
2862
|
-
color: var(--color-stone-500);
|
|
2863
|
-
@media (prefers-color-scheme: dark) {
|
|
2864
|
-
background-color: var(--color-stone-800);
|
|
2865
|
-
}
|
|
2866
|
-
@media (prefers-color-scheme: dark) {
|
|
2867
|
-
color: var(--color-stone-400);
|
|
2868
|
-
}
|
|
2869
|
-
@media (hover: hover) {
|
|
2870
|
-
a&:hover, button&:hover {
|
|
2871
|
-
background-color: var(--color-stone-200);
|
|
2872
|
-
@media (prefers-color-scheme: dark) {
|
|
2873
|
-
background-color: var(--color-stone-700);
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
2761
|
.badge-blue {
|
|
2879
2762
|
background-color: color-mix(in srgb, oklch(62.3% 0.214 259.815) 15%, transparent);
|
|
2880
2763
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -2903,62 +2786,6 @@
|
|
|
2903
2786
|
}
|
|
2904
2787
|
}
|
|
2905
2788
|
}
|
|
2906
|
-
.badge-indigo {
|
|
2907
|
-
background-color: color-mix(in srgb, oklch(58.5% 0.233 277.117) 15%, transparent);
|
|
2908
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2909
|
-
background-color: color-mix(in oklab, var(--color-indigo-500) 15%, transparent);
|
|
2910
|
-
}
|
|
2911
|
-
color: var(--color-indigo-700);
|
|
2912
|
-
&:is(:where(.group):hover *) {
|
|
2913
|
-
@media (hover: hover) {
|
|
2914
|
-
background-color: color-mix(in srgb, oklch(58.5% 0.233 277.117) 25%, transparent);
|
|
2915
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2916
|
-
background-color: color-mix(in oklab, var(--color-indigo-500) 25%, transparent);
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
}
|
|
2920
|
-
@media (prefers-color-scheme: dark) {
|
|
2921
|
-
color: var(--color-indigo-400);
|
|
2922
|
-
}
|
|
2923
|
-
@media (prefers-color-scheme: dark) {
|
|
2924
|
-
&:is(:where(.group):hover *) {
|
|
2925
|
-
@media (hover: hover) {
|
|
2926
|
-
background-color: color-mix(in srgb, oklch(58.5% 0.233 277.117) 20%, transparent);
|
|
2927
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2928
|
-
background-color: color-mix(in oklab, var(--color-indigo-500) 20%, transparent);
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
}
|
|
2934
|
-
.badge-violet {
|
|
2935
|
-
background-color: color-mix(in srgb, oklch(60.6% 0.25 292.717) 15%, transparent);
|
|
2936
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2937
|
-
background-color: color-mix(in oklab, var(--color-violet-500) 15%, transparent);
|
|
2938
|
-
}
|
|
2939
|
-
color: var(--color-violet-700);
|
|
2940
|
-
&:is(:where(.group):hover *) {
|
|
2941
|
-
@media (hover: hover) {
|
|
2942
|
-
background-color: color-mix(in srgb, oklch(60.6% 0.25 292.717) 25%, transparent);
|
|
2943
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2944
|
-
background-color: color-mix(in oklab, var(--color-violet-500) 25%, transparent);
|
|
2945
|
-
}
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
@media (prefers-color-scheme: dark) {
|
|
2949
|
-
color: var(--color-violet-400);
|
|
2950
|
-
}
|
|
2951
|
-
@media (prefers-color-scheme: dark) {
|
|
2952
|
-
&:is(:where(.group):hover *) {
|
|
2953
|
-
@media (hover: hover) {
|
|
2954
|
-
background-color: color-mix(in srgb, oklch(60.6% 0.25 292.717) 20%, transparent);
|
|
2955
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
2956
|
-
background-color: color-mix(in oklab, var(--color-violet-500) 20%, transparent);
|
|
2957
|
-
}
|
|
2958
|
-
}
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
2789
|
.bg-amber-100 {
|
|
2963
2790
|
background-color: var(--color-amber-100);
|
|
2964
2791
|
}
|
|
@@ -6381,7 +6208,7 @@ dialog.drawer {
|
|
|
6381
6208
|
}
|
|
6382
6209
|
display: flex;
|
|
6383
6210
|
flex-direction: column;
|
|
6384
|
-
overflow:
|
|
6211
|
+
overflow: clip;
|
|
6385
6212
|
--tw-outline-style: none;
|
|
6386
6213
|
outline-style: none;
|
|
6387
6214
|
& > turbo-frame {
|
|
@@ -6850,6 +6677,7 @@ dialog.modal {
|
|
|
6850
6677
|
}
|
|
6851
6678
|
}
|
|
6852
6679
|
.selection-list-item {
|
|
6680
|
+
position: relative;
|
|
6853
6681
|
display: flex;
|
|
6854
6682
|
align-items: center;
|
|
6855
6683
|
gap: calc(var(--spacing) * 3);
|
|
@@ -3,7 +3,7 @@ dialog.drawer {
|
|
|
3
3
|
@apply bg-white dark:bg-stone-900;
|
|
4
4
|
@apply border-l border-stone-200 dark:border-stone-700;
|
|
5
5
|
@apply shadow-xl dark:shadow-none;
|
|
6
|
-
@apply flex flex-col overflow-
|
|
6
|
+
@apply flex flex-col overflow-clip;
|
|
7
7
|
@apply outline-none;
|
|
8
8
|
|
|
9
9
|
& > turbo-frame {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "tailwind_merge"
|
|
2
2
|
module Iron
|
|
3
3
|
module ApplicationHelper
|
|
4
|
-
include IconsHelper, AvatarHelper, UiHelper, EntriesHelper, ContentTypesHelper, TransfersHelper
|
|
4
|
+
include IconsHelper, AvatarHelper, UiHelper, EntriesHelper, ContentTypesHelper, TransfersHelper, FieldDefinitionsHelper, FieldsHelper
|
|
5
5
|
|
|
6
6
|
TAILWIND_MERGER = TailwindMerge::Merger.new.freeze
|
|
7
7
|
|
|
@@ -2,4 +2,34 @@ module Iron::FieldDefinitionsHelper
|
|
|
2
2
|
def field_definition_type_options
|
|
3
3
|
Iron::FieldDefinition::TYPES.map { |type| [ type.humanize, type ] }
|
|
4
4
|
end
|
|
5
|
+
|
|
6
|
+
def field_definition_icon(field_definition)
|
|
7
|
+
case field_definition.type_handle
|
|
8
|
+
when "text_field" then "type"
|
|
9
|
+
when "text_area" then "text"
|
|
10
|
+
when "rich_text_area" then "text-quote"
|
|
11
|
+
when "number" then "hash"
|
|
12
|
+
when "file" then "file"
|
|
13
|
+
when "boolean" then "toggle-right"
|
|
14
|
+
when "date" then "calendar"
|
|
15
|
+
when "block" then "blocks"
|
|
16
|
+
when "block_list" then "list"
|
|
17
|
+
when "reference", "reference_list" then "link"
|
|
18
|
+
else "circle-help"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def field_definition_color(field_definition)
|
|
23
|
+
case field_definition.type_handle
|
|
24
|
+
when "text_field", "text_area" then "stone"
|
|
25
|
+
when "rich_text_area" then "indigo"
|
|
26
|
+
when "number" then "amber"
|
|
27
|
+
when "file" then "sky"
|
|
28
|
+
when "boolean" then "green"
|
|
29
|
+
when "date" then "orange"
|
|
30
|
+
when "block", "block_list" then "violet"
|
|
31
|
+
when "reference", "reference_list" then "cyan"
|
|
32
|
+
else "stone"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
5
35
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Iron
|
|
2
|
+
module FieldsHelper
|
|
3
|
+
def file_field_fallback_icon(field)
|
|
4
|
+
case field.file.blob.content_type
|
|
5
|
+
when "application/pdf" then "file-text"
|
|
6
|
+
when %r{\Aaudio/} then "file-audio"
|
|
7
|
+
when %r{\Avideo/} then "file-video"
|
|
8
|
+
else "file"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -18,38 +18,5 @@ module Iron
|
|
|
18
18
|
block_given? ? capture(&block) : content
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
|
|
22
|
-
def field_type_meta(field_definition)
|
|
23
|
-
case field_definition.type_handle
|
|
24
|
-
when "text_field" then { icon: "type", color: "stone" }
|
|
25
|
-
when "text_area" then { icon: "text", color: "stone" }
|
|
26
|
-
when "rich_text_area" then { icon: "text-quote", color: "indigo" }
|
|
27
|
-
when "number" then { icon: "hash", color: "amber" }
|
|
28
|
-
when "file" then { icon: "file", color: "sky" }
|
|
29
|
-
when "boolean" then { icon: "toggle-right", color: "green" }
|
|
30
|
-
when "date" then { icon: "calendar", color: "orange" }
|
|
31
|
-
when "block" then { icon: "blocks", color: "violet" }
|
|
32
|
-
when "block_list" then { icon: "list", color: "violet" }
|
|
33
|
-
when "reference" then { icon: "link", color: "cyan" }
|
|
34
|
-
when "reference_list" then { icon: "link", color: "cyan" }
|
|
35
|
-
else { icon: "circle-help", color: "stone" }
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
FIELD_TYPE_BADGE_CLASSES = {
|
|
40
|
-
"stone" => "badge-stone",
|
|
41
|
-
"indigo" => "badge-indigo",
|
|
42
|
-
"amber" => "badge-amber",
|
|
43
|
-
"sky" => "badge-sky",
|
|
44
|
-
"green" => "badge-green",
|
|
45
|
-
"orange" => "badge-orange",
|
|
46
|
-
"violet" => "badge-violet",
|
|
47
|
-
"cyan" => "badge-cyan"
|
|
48
|
-
}.freeze
|
|
49
|
-
|
|
50
|
-
def field_type_badge(field_definition)
|
|
51
|
-
meta = field_type_meta(field_definition)
|
|
52
|
-
badge field_definition.humanized_type, class: FIELD_TYPE_BADGE_CLASSES[meta[:color]]
|
|
53
|
-
end
|
|
54
21
|
end
|
|
55
22
|
end
|
|
@@ -1,33 +1,45 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus";
|
|
2
2
|
|
|
3
3
|
export default class FileUploadController extends Controller {
|
|
4
|
-
static targets = ["preview", "placeholder"];
|
|
4
|
+
static targets = ["preview", "placeholder", "previewWrapper"];
|
|
5
5
|
|
|
6
6
|
connect() {
|
|
7
|
-
this.
|
|
8
|
-
|
|
7
|
+
if (this.hasPreviewTarget) {
|
|
8
|
+
this.originalSrc = this.previewTarget.src;
|
|
9
|
+
}
|
|
10
|
+
this.originalHidden = this.previewElement
|
|
11
|
+
? this.previewElement.classList.contains("hidden")
|
|
12
|
+
: false;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
preview(event) {
|
|
12
16
|
const file = event.target.files[0];
|
|
13
|
-
if (file)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
17
|
+
if (!file) return;
|
|
18
|
+
|
|
19
|
+
if (this.hasPreviewTarget) {
|
|
20
|
+
this.previewTarget.src = URL.createObjectURL(file);
|
|
21
|
+
}
|
|
22
|
+
if (this.hasPlaceholderTarget) {
|
|
23
|
+
this.placeholderTarget.classList.add("hidden");
|
|
20
24
|
}
|
|
25
|
+
this.previewElement?.classList.remove("hidden");
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
reset() {
|
|
24
|
-
this.
|
|
29
|
+
if (this.hasPreviewTarget) {
|
|
30
|
+
this.previewTarget.src = this.originalSrc;
|
|
31
|
+
}
|
|
25
32
|
if (this.originalHidden) {
|
|
26
|
-
this.
|
|
33
|
+
this.previewElement?.classList.add("hidden");
|
|
27
34
|
if (this.hasPlaceholderTarget) {
|
|
28
35
|
this.placeholderTarget.classList.remove("hidden");
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
|
-
}
|
|
33
39
|
|
|
40
|
+
get previewElement() {
|
|
41
|
+
if (this.hasPreviewWrapperTarget) return this.previewWrapperTarget;
|
|
42
|
+
if (this.hasPreviewTarget) return this.previewTarget;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -17,11 +17,18 @@
|
|
|
17
17
|
|
|
18
18
|
<% if field.file.attached? && field.file.blob.persisted? && field.valid? %>
|
|
19
19
|
<div class="relative group w-full max-w-lg aspect-video rounded-xl overflow-hidden bg-stone-100 dark:bg-stone-800">
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
<% if field.image? %>
|
|
21
|
+
<%= image_tag main_app.url_for(field.file),
|
|
22
|
+
class: "h-full w-full object-cover object-center",
|
|
23
|
+
data: {
|
|
24
|
+
file_upload_target: "preview",
|
|
25
|
+
} %>
|
|
26
|
+
<% else %>
|
|
27
|
+
<div class="flex h-full w-full flex-col items-center justify-center gap-2 p-4 text-stone-500 dark:text-stone-400">
|
|
28
|
+
<%= icon file_field_fallback_icon(field), class: "size-10" %>
|
|
29
|
+
<p class="text-sm font-medium truncate max-w-full"><%= field.file.blob.filename %></p>
|
|
30
|
+
</div>
|
|
31
|
+
<% end %>
|
|
25
32
|
<%= builder.label :file, class: "absolute inset-0 flex items-center justify-center bg-stone-900/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer" do %>
|
|
26
33
|
<span class="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-white text-sm font-medium text-stone-900">
|
|
27
34
|
<%= icon "upload", class: "size-4" %>
|
|
@@ -35,12 +42,14 @@
|
|
|
35
42
|
<p class="mt-2 text-sm text-stone-600 dark:text-stone-400"><%= t("iron.entries.fields.file.upload_prompt") %></p>
|
|
36
43
|
<p class="mt-1 text-xs text-stone-500 dark:text-stone-500"><%= t("iron.entries.fields.file.upload_hint") %></p>
|
|
37
44
|
<% end %>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
<div class="relative group w-full max-w-lg aspect-video rounded-xl overflow-hidden bg-stone-100 dark:bg-stone-800 hidden" data-file-upload-target="previewWrapper">
|
|
46
|
+
<img
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
alt="<%= field.definition.name %> preview"
|
|
49
|
+
class="h-full w-full object-cover object-center"
|
|
50
|
+
data-file-upload-target="preview"
|
|
51
|
+
>
|
|
52
|
+
</div>
|
|
44
53
|
<% end %>
|
|
45
54
|
|
|
46
55
|
<%= builder.file_field :file,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
<% meta = field_type_meta(field_definition) %>
|
|
2
|
-
|
|
3
1
|
<li
|
|
4
2
|
id="<%= dom_id field_definition %>"
|
|
5
3
|
class="group field-definition-row"
|
|
6
|
-
data-field-color="<%=
|
|
4
|
+
data-field-color="<%= field_definition_color(field_definition) %>"
|
|
7
5
|
data-sortable-list-target="item"
|
|
8
6
|
>
|
|
9
7
|
<%= form_with model: field_definition.becomes(Iron::FieldDefinition),
|
|
@@ -24,7 +22,7 @@
|
|
|
24
22
|
data: { turbo_frame: :drawer } do %>
|
|
25
23
|
|
|
26
24
|
<div class="field-icon">
|
|
27
|
-
<%= icon
|
|
25
|
+
<%= icon field_definition_icon(field_definition), class: "size-5" %>
|
|
28
26
|
</div>
|
|
29
27
|
|
|
30
28
|
<div class="flex-1 min-w-0">
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<%# locals: (schemable:, selected_type:) -%>
|
|
2
2
|
|
|
3
3
|
<% selected_definition = Iron::FieldDefinition.new(type: Iron::FieldDefinition.classify_type(selected_type)) %>
|
|
4
|
-
<% selected_meta = field_type_meta(selected_definition) %>
|
|
5
4
|
|
|
6
5
|
<details class="field-type-details" data-controller="type-picker">
|
|
7
|
-
<summary class="field-type-summary" data-type-picker-target="summary" data-field-color="<%=
|
|
6
|
+
<summary class="field-type-summary" data-type-picker-target="summary" data-field-color="<%= field_definition_color(selected_definition) %>">
|
|
8
7
|
<div class="field-type-icon" data-type-picker-target="summaryIcon">
|
|
9
|
-
<%= icon
|
|
8
|
+
<%= icon field_definition_icon(selected_definition), class: "size-5" %>
|
|
10
9
|
</div>
|
|
11
10
|
<span class="flex-1 text-sm font-medium text-stone-900 dark:text-white" data-type-picker-target="summaryName"><%= selected_type.humanize %></span>
|
|
12
11
|
<%= icon "chevron-down", class: "size-4 text-stone-400 transition-transform duration-150 details-open:rotate-180" %>
|
|
@@ -15,7 +14,6 @@
|
|
|
15
14
|
<div class="field-type-picker">
|
|
16
15
|
<% Iron::FieldDefinition::TYPES.each do |type| %>
|
|
17
16
|
<% temp_definition = Iron::FieldDefinition.new(type: Iron::FieldDefinition.classify_type(type)) %>
|
|
18
|
-
<% meta = field_type_meta(temp_definition) %>
|
|
19
17
|
<% selected = selected_type == type %>
|
|
20
18
|
|
|
21
19
|
<%= link_to new_polymorphic_path([schemable, Iron::FieldDefinition.new], type: type),
|
|
@@ -24,11 +22,11 @@
|
|
|
24
22
|
turbo_frame: "field_settings",
|
|
25
23
|
type_picker_target: "option",
|
|
26
24
|
action: "type-picker#select",
|
|
27
|
-
field_color:
|
|
25
|
+
field_color: field_definition_color(temp_definition),
|
|
28
26
|
ui: ("selected" if selected)
|
|
29
27
|
} do %>
|
|
30
28
|
<div class="field-type-icon">
|
|
31
|
-
<%= icon
|
|
29
|
+
<%= icon field_definition_icon(temp_definition), class: "size-5" %>
|
|
32
30
|
</div>
|
|
33
31
|
<span class="field-type-name"><%= type.humanize %></span>
|
|
34
32
|
<%= icon "check", class: "field-type-check" %>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
<% meta = field_type_meta(@field_definition) %>
|
|
2
|
-
|
|
3
1
|
<%= turbo_frame_tag :drawer do %>
|
|
4
2
|
<div class="drawer-header">
|
|
5
3
|
<div class="flex items-center gap-3">
|
|
6
|
-
<div class="field-type-indicator size-8 rounded-lg" data-field-color="<%=
|
|
7
|
-
<%= icon
|
|
4
|
+
<div class="field-type-indicator size-8 rounded-lg" data-field-color="<%= field_definition_color(@field_definition) %>">
|
|
5
|
+
<%= icon field_definition_icon(@field_definition), class: "size-4" %>
|
|
8
6
|
</div>
|
|
9
7
|
<h2 class="drawer-title"><%= @field_definition.name %></h2>
|
|
10
8
|
</div>
|
data/lib/iron/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iron-cms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.17.
|
|
4
|
+
version: 0.17.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Massimo De Marchi
|
|
@@ -153,16 +153,36 @@ dependencies:
|
|
|
153
153
|
name: image_processing
|
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
|
155
155
|
requirements:
|
|
156
|
-
- - "
|
|
156
|
+
- - ">="
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
158
|
version: '1.13'
|
|
159
|
+
- - "<"
|
|
160
|
+
- !ruby/object:Gem::Version
|
|
161
|
+
version: '3.0'
|
|
159
162
|
type: :runtime
|
|
160
163
|
prerelease: false
|
|
161
164
|
version_requirements: !ruby/object:Gem::Requirement
|
|
162
165
|
requirements:
|
|
163
|
-
- - "
|
|
166
|
+
- - ">="
|
|
164
167
|
- !ruby/object:Gem::Version
|
|
165
168
|
version: '1.13'
|
|
169
|
+
- - "<"
|
|
170
|
+
- !ruby/object:Gem::Version
|
|
171
|
+
version: '3.0'
|
|
172
|
+
- !ruby/object:Gem::Dependency
|
|
173
|
+
name: ruby-vips
|
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
|
175
|
+
requirements:
|
|
176
|
+
- - "~>"
|
|
177
|
+
- !ruby/object:Gem::Version
|
|
178
|
+
version: '2.2'
|
|
179
|
+
type: :runtime
|
|
180
|
+
prerelease: false
|
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
182
|
+
requirements:
|
|
183
|
+
- - "~>"
|
|
184
|
+
- !ruby/object:Gem::Version
|
|
185
|
+
version: '2.2'
|
|
166
186
|
- !ruby/object:Gem::Dependency
|
|
167
187
|
name: csv
|
|
168
188
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -329,6 +349,7 @@ files:
|
|
|
329
349
|
- app/helpers/iron/content_types_helper.rb
|
|
330
350
|
- app/helpers/iron/entries_helper.rb
|
|
331
351
|
- app/helpers/iron/field_definitions_helper.rb
|
|
352
|
+
- app/helpers/iron/fields_helper.rb
|
|
332
353
|
- app/helpers/iron/form_builder.rb
|
|
333
354
|
- app/helpers/iron/icons_helper.rb
|
|
334
355
|
- app/helpers/iron/image_helper.rb
|