b4um_generators 0.2.11 → 0.2.14
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/.rubocop.yml +2 -2
- data/README.de.md +127 -1
- data/README.md +126 -1
- data/lib/b4um_generators/version.rb +1 -1
- data/lib/generators/b4um/attachment/attachment_generator.rb +83 -23
- data/lib/generators/b4um/authentication/authentication_generator.rb +63 -0
- data/lib/generators/b4um/help/help_generator.rb +100 -3
- data/lib/generators/b4um/in_place/in_place_generator.rb +1231 -0
- data/lib/generators/b4um/in_place/templates/_flash.html.erb +15 -0
- data/lib/generators/b4um/in_place/templates/b4um_in_place_helper.rb +7 -0
- data/lib/generators/b4um/in_place/templates/display_attachment.html.erb.tt +154 -0
- data/lib/generators/b4um/in_place/templates/display_attachments.html.erb.tt +165 -0
- data/lib/generators/b4um/in_place/templates/display_boolean.html.erb.tt +18 -0
- data/lib/generators/b4um/in_place/templates/display_number.html.erb.tt +18 -0
- data/lib/generators/b4um/in_place/templates/display_radio.html.erb.tt +23 -0
- data/lib/generators/b4um/in_place/templates/display_rich_text.html.erb.tt +123 -0
- data/lib/generators/b4um/in_place/templates/display_select.html.erb.tt +23 -0
- data/lib/generators/b4um/in_place/templates/display_text.html.erb.tt +18 -0
- data/lib/generators/b4um/in_place/templates/edit_attachment.html.erb.tt +83 -0
- data/lib/generators/b4um/in_place/templates/edit_attachments.html.erb.tt +65 -0
- data/lib/generators/b4um/in_place/templates/edit_boolean.html.erb.tt +32 -0
- data/lib/generators/b4um/in_place/templates/edit_number.html.erb.tt +26 -0
- data/lib/generators/b4um/in_place/templates/edit_radio.html.erb.tt +32 -0
- data/lib/generators/b4um/in_place/templates/edit_rich_text.html.erb.tt +25 -0
- data/lib/generators/b4um/in_place/templates/edit_select.html.erb.tt +28 -0
- data/lib/generators/b4um/in_place/templates/edit_text.html.erb.tt +25 -0
- data/lib/generators/b4um/in_place/templates/in_place.css +935 -0
- data/lib/generators/b4um/in_place/templates/in_place_controller.js +115 -0
- data/lib/generators/b4um/install/install_generator.rb +18 -13
- data/lib/generators/b4um/install/templates/_flash.html.erb +15 -0
- data/lib/generators/b4um/install/templates/_footer.html.erb +6 -1
- data/lib/generators/b4um/install/templates/b4um/forms.css +127 -0
- data/lib/generators/b4um/install/templates/image_lightbox_controller.js +29 -0
- data/lib/generators/b4um/install/templates/rich_text_controller.js +22 -0
- data/lib/generators/b4um/install/templates/scroll_to_top_controller.js +12 -0
- data/lib/generators/b4um/scaffold/scaffold_generator.rb +106 -0
- data/lib/generators/b4um/scaffold/templates/_form.html.erb.tt +29 -0
- data/lib/generators/b4um/scaffold/templates/_resource.html.erb.tt +35 -0
- data/lib/generators/b4um/scaffold/templates/_table.html.erb.tt +31 -0
- data/lib/generators/b4um/trix/trix_generator.rb +104 -6
- metadata +25 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div id="flash-messages">
|
|
2
|
+
<% flash.each do |type, message| %>
|
|
3
|
+
<div class="flash <%= "flash--" + type.to_s %>"
|
|
4
|
+
data-controller="dismissible">
|
|
5
|
+
<%= message %>
|
|
6
|
+
|
|
7
|
+
<button type="button"
|
|
8
|
+
class="flash__close"
|
|
9
|
+
data-action="dismissible#dismiss"
|
|
10
|
+
aria-label="Close">
|
|
11
|
+
×
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<%% if <%= singular_table_name %>.<%= @field %>.attached? %>
|
|
3
|
+
<div
|
|
4
|
+
class="in-place-image-container"
|
|
5
|
+
data-controller="image-lightbox"
|
|
6
|
+
data-action="keydown->image-lightbox#keydown"
|
|
7
|
+
>
|
|
8
|
+
<button
|
|
9
|
+
type="button"
|
|
10
|
+
class="in-place-attachment__button"
|
|
11
|
+
data-image-lightbox-target="item"
|
|
12
|
+
data-image-lightbox-url="<%%= url_for(<%= singular_table_name %>.<%= @field %>) %>"
|
|
13
|
+
data-image-lightbox-alt="<%%= <%= singular_table_name %>.<%= @field %>.filename.to_s %>"
|
|
14
|
+
data-action="click->image-lightbox#open"
|
|
15
|
+
>
|
|
16
|
+
<%%= image_tag <%= singular_table_name %>.<%= @field %>,
|
|
17
|
+
class: "in-place-attachment__image",
|
|
18
|
+
alt: <%= singular_table_name %>.<%= @field %>.filename.to_s %>
|
|
19
|
+
</button>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class="image-lightbox"
|
|
23
|
+
data-image-lightbox-target="overlay"
|
|
24
|
+
data-action="click->image-lightbox#closeOnBackground"
|
|
25
|
+
tabindex="-1"
|
|
26
|
+
role="dialog"
|
|
27
|
+
aria-modal="true"
|
|
28
|
+
aria-label="Image preview"
|
|
29
|
+
hidden
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
class="image-lightbox__counter"
|
|
33
|
+
data-image-lightbox-target="counter"
|
|
34
|
+
></div>
|
|
35
|
+
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
class="image-lightbox__close"
|
|
39
|
+
aria-label="Close image"
|
|
40
|
+
data-action="click->image-lightbox#close"
|
|
41
|
+
>
|
|
42
|
+
×
|
|
43
|
+
</button>
|
|
44
|
+
|
|
45
|
+
<div
|
|
46
|
+
class="image-lightbox__stage"
|
|
47
|
+
data-image-lightbox-target="stage"
|
|
48
|
+
data-action="
|
|
49
|
+
pointerdown->image-lightbox#pointerDown
|
|
50
|
+
pointermove->image-lightbox#pointerMove
|
|
51
|
+
pointerup->image-lightbox#pointerUp
|
|
52
|
+
pointercancel->image-lightbox#pointerCancel
|
|
53
|
+
"
|
|
54
|
+
>
|
|
55
|
+
<img
|
|
56
|
+
class="image-lightbox__image"
|
|
57
|
+
data-image-lightbox-target="image"
|
|
58
|
+
alt=""
|
|
59
|
+
>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
class="image-lightbox__thumbnails"
|
|
64
|
+
data-image-lightbox-target="thumbnails"
|
|
65
|
+
></div>
|
|
66
|
+
|
|
67
|
+
<div
|
|
68
|
+
class="image-lightbox__caption"
|
|
69
|
+
data-image-lightbox-target="caption"
|
|
70
|
+
></div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
74
|
+
<div
|
|
75
|
+
class="in-place-image-action"
|
|
76
|
+
data-controller="in-place"
|
|
77
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
78
|
+
>
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
class="in-place-edit-button"
|
|
82
|
+
data-action="click->in-place#edit"
|
|
83
|
+
title="Edit image"
|
|
84
|
+
aria-label="Edit image"
|
|
85
|
+
>
|
|
86
|
+
<svg
|
|
87
|
+
class="in-place-edit-button__icon"
|
|
88
|
+
viewBox="0 0 24 24"
|
|
89
|
+
aria-hidden="true"
|
|
90
|
+
>
|
|
91
|
+
<path
|
|
92
|
+
d="M12 20h9"
|
|
93
|
+
fill="none"
|
|
94
|
+
stroke="currentColor"
|
|
95
|
+
stroke-width="2"
|
|
96
|
+
stroke-linecap="round"
|
|
97
|
+
/>
|
|
98
|
+
<path
|
|
99
|
+
d="M16.5 3.5a2.121 2.121 0 0 1 3 3L8 18l-4 1 1-4Z"
|
|
100
|
+
fill="none"
|
|
101
|
+
stroke="currentColor"
|
|
102
|
+
stroke-width="2"
|
|
103
|
+
stroke-linecap="round"
|
|
104
|
+
stroke-linejoin="round"
|
|
105
|
+
/>
|
|
106
|
+
</svg>
|
|
107
|
+
</button>
|
|
108
|
+
</div>
|
|
109
|
+
<%% end %>
|
|
110
|
+
</div>
|
|
111
|
+
<%% else %>
|
|
112
|
+
<div class="in-place-image-container in-place-image-container--empty">
|
|
113
|
+
<span class="in-place-attachment__empty">No image</span>
|
|
114
|
+
|
|
115
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
116
|
+
<div
|
|
117
|
+
class="in-place-image-action"
|
|
118
|
+
data-controller="in-place"
|
|
119
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
120
|
+
>
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
class="in-place-edit-button"
|
|
124
|
+
data-action="click->in-place#edit"
|
|
125
|
+
title="Add image"
|
|
126
|
+
aria-label="Add image"
|
|
127
|
+
>
|
|
128
|
+
<svg
|
|
129
|
+
class="in-place-edit-button__icon"
|
|
130
|
+
viewBox="0 0 24 24"
|
|
131
|
+
aria-hidden="true"
|
|
132
|
+
>
|
|
133
|
+
<path
|
|
134
|
+
d="M12 20h9"
|
|
135
|
+
fill="none"
|
|
136
|
+
stroke="currentColor"
|
|
137
|
+
stroke-width="2"
|
|
138
|
+
stroke-linecap="round"
|
|
139
|
+
/>
|
|
140
|
+
<path
|
|
141
|
+
d="M16.5 3.5a2.121 2.121 0 0 1 3 3L8 18l-4 1 1-4Z"
|
|
142
|
+
fill="none"
|
|
143
|
+
stroke="currentColor"
|
|
144
|
+
stroke-width="2"
|
|
145
|
+
stroke-linecap="round"
|
|
146
|
+
stroke-linejoin="round"
|
|
147
|
+
/>
|
|
148
|
+
</svg>
|
|
149
|
+
</button>
|
|
150
|
+
</div>
|
|
151
|
+
<%% end %>
|
|
152
|
+
</div>
|
|
153
|
+
<%% end %>
|
|
154
|
+
<%% end %>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<%% if <%= singular_table_name %>.<%= @field %>.attached? %>
|
|
3
|
+
<div class="resource-field">
|
|
4
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
5
|
+
|
|
6
|
+
<div class="in-place-gallery-display <%%= local_assigns[:compact] ? "in-place-gallery-display--compact" : "in-place-gallery-display--full" %>">
|
|
7
|
+
<div
|
|
8
|
+
class="resource-images"
|
|
9
|
+
data-controller="image-lightbox"
|
|
10
|
+
data-action="keydown->image-lightbox#keydown"
|
|
11
|
+
>
|
|
12
|
+
<%% <%= singular_table_name %>.<%= @field %>.each do |image| %>
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
class="resource-images__button"
|
|
16
|
+
data-image-lightbox-target="item"
|
|
17
|
+
data-image-lightbox-url="<%%= url_for(image) %>"
|
|
18
|
+
data-image-lightbox-alt="<%%= image.filename.to_s %>"
|
|
19
|
+
data-action="click->image-lightbox#open"
|
|
20
|
+
>
|
|
21
|
+
<%%= image_tag image,
|
|
22
|
+
class: "resource-images__image",
|
|
23
|
+
alt: image.filename.to_s %>
|
|
24
|
+
</button>
|
|
25
|
+
<%% end %>
|
|
26
|
+
|
|
27
|
+
<div
|
|
28
|
+
class="image-lightbox"
|
|
29
|
+
data-image-lightbox-target="overlay"
|
|
30
|
+
data-action="click->image-lightbox#closeOnBackground"
|
|
31
|
+
tabindex="-1"
|
|
32
|
+
role="dialog"
|
|
33
|
+
aria-modal="true"
|
|
34
|
+
aria-label="Image gallery"
|
|
35
|
+
hidden
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
class="image-lightbox__counter"
|
|
39
|
+
data-image-lightbox-target="counter"
|
|
40
|
+
></div>
|
|
41
|
+
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
class="image-lightbox__close"
|
|
45
|
+
aria-label="Close image"
|
|
46
|
+
data-action="click->image-lightbox#close"
|
|
47
|
+
>
|
|
48
|
+
×
|
|
49
|
+
</button>
|
|
50
|
+
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
class="image-lightbox__navigation image-lightbox__navigation--previous"
|
|
54
|
+
aria-label="Previous image"
|
|
55
|
+
data-image-lightbox-target="previousButton"
|
|
56
|
+
data-action="click->image-lightbox#previous"
|
|
57
|
+
>
|
|
58
|
+
‹
|
|
59
|
+
</button>
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
class="image-lightbox__stage"
|
|
63
|
+
data-image-lightbox-target="stage"
|
|
64
|
+
data-action="
|
|
65
|
+
pointerdown->image-lightbox#pointerDown
|
|
66
|
+
pointermove->image-lightbox#pointerMove
|
|
67
|
+
pointerup->image-lightbox#pointerUp
|
|
68
|
+
pointercancel->image-lightbox#pointerCancel
|
|
69
|
+
"
|
|
70
|
+
>
|
|
71
|
+
<img
|
|
72
|
+
class="image-lightbox__image"
|
|
73
|
+
data-image-lightbox-target="image"
|
|
74
|
+
alt=""
|
|
75
|
+
>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
class="image-lightbox__navigation image-lightbox__navigation--next"
|
|
81
|
+
aria-label="Next image"
|
|
82
|
+
data-image-lightbox-target="nextButton"
|
|
83
|
+
data-action="click->image-lightbox#next"
|
|
84
|
+
>
|
|
85
|
+
›
|
|
86
|
+
</button>
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
class="image-lightbox__thumbnails"
|
|
90
|
+
data-image-lightbox-target="thumbnails"
|
|
91
|
+
></div>
|
|
92
|
+
|
|
93
|
+
<div
|
|
94
|
+
class="image-lightbox__caption"
|
|
95
|
+
data-image-lightbox-target="caption"
|
|
96
|
+
></div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
101
|
+
<div
|
|
102
|
+
class="in-place-gallery-action"
|
|
103
|
+
data-controller="in-place"
|
|
104
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
105
|
+
>
|
|
106
|
+
<button
|
|
107
|
+
type="button"
|
|
108
|
+
class="in-place-edit-button"
|
|
109
|
+
data-action="click->in-place#edit"
|
|
110
|
+
title="Edit gallery"
|
|
111
|
+
aria-label="Edit gallery"
|
|
112
|
+
>
|
|
113
|
+
<svg
|
|
114
|
+
class="in-place-edit-button__icon"
|
|
115
|
+
viewBox="0 0 24 24"
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
>
|
|
118
|
+
<path
|
|
119
|
+
d="M12 20h9"
|
|
120
|
+
fill="none"
|
|
121
|
+
stroke="currentColor"
|
|
122
|
+
stroke-width="2"
|
|
123
|
+
stroke-linecap="round"
|
|
124
|
+
/>
|
|
125
|
+
<path
|
|
126
|
+
d="M16.5 3.5a2.121 2.121 0 0 1 3 3L8 18l-4 1 1-4Z"
|
|
127
|
+
fill="none"
|
|
128
|
+
stroke="currentColor"
|
|
129
|
+
stroke-width="2"
|
|
130
|
+
stroke-linecap="round"
|
|
131
|
+
stroke-linejoin="round"
|
|
132
|
+
/>
|
|
133
|
+
</svg>
|
|
134
|
+
</button>
|
|
135
|
+
</div>
|
|
136
|
+
<%% end %>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
<%% else %>
|
|
140
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
141
|
+
<div
|
|
142
|
+
class="resource-field<%%= " in-place-edit" if b4um_in_place_editing_allowed? %>"
|
|
143
|
+
data-controller="in-place"
|
|
144
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
145
|
+
data-action="click->in-place#edit keydown.enter->in-place#edit keydown.space->in-place#edit"
|
|
146
|
+
role="button"
|
|
147
|
+
tabindex="0"
|
|
148
|
+
>
|
|
149
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
150
|
+
|
|
151
|
+
<span class="resource-value resource-value--empty">
|
|
152
|
+
Add images
|
|
153
|
+
</span>
|
|
154
|
+
</div>
|
|
155
|
+
<%% else %>
|
|
156
|
+
<div class="resource-field">
|
|
157
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
158
|
+
|
|
159
|
+
<span class="resource-value resource-value--empty">
|
|
160
|
+
No images
|
|
161
|
+
</span>
|
|
162
|
+
</div>
|
|
163
|
+
<%% end %>
|
|
164
|
+
<%% end %>
|
|
165
|
+
<%% end %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<div
|
|
3
|
+
class="resource-field<%%= " in-place-edit" if b4um_in_place_editing_allowed? %>"
|
|
4
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
5
|
+
data-controller="in-place"
|
|
6
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
7
|
+
data-action="click->in-place#edit keydown.enter->in-place#edit keydown.space->in-place#edit"
|
|
8
|
+
role="button"
|
|
9
|
+
tabindex="0"
|
|
10
|
+
<%% end %>
|
|
11
|
+
>
|
|
12
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
13
|
+
|
|
14
|
+
<span class="resource-value">
|
|
15
|
+
<%%= <%= singular_table_name %>.<%= @field %>? ? "Yes" : "No" %>
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
<%% end %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<div
|
|
3
|
+
class="resource-field<%%= " in-place-edit" if b4um_in_place_editing_allowed? %>"
|
|
4
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
5
|
+
data-controller="in-place"
|
|
6
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
7
|
+
data-action="click->in-place#edit keydown.enter->in-place#edit keydown.space->in-place#edit"
|
|
8
|
+
role="button"
|
|
9
|
+
tabindex="0"
|
|
10
|
+
<%% end %>
|
|
11
|
+
>
|
|
12
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
13
|
+
|
|
14
|
+
<span class="resource-value">
|
|
15
|
+
<%%= <%= singular_table_name %>.<%= @field %>.presence || "—" %>
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
<%% end %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<%% choices = <%= radio_configuration[:values].inspect %> %>
|
|
3
|
+
<%% current_choice = choices.find do |choice|
|
|
4
|
+
choice[:value].to_s == <%= singular_table_name %>.<%= @field %>.to_s
|
|
5
|
+
end %>
|
|
6
|
+
|
|
7
|
+
<div
|
|
8
|
+
class="resource-field<%%= " in-place-edit" if b4um_in_place_editing_allowed? %>"
|
|
9
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
10
|
+
data-controller="in-place"
|
|
11
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
12
|
+
data-action="click->in-place#edit keydown.enter->in-place#edit keydown.space->in-place#edit"
|
|
13
|
+
role="button"
|
|
14
|
+
tabindex="0"
|
|
15
|
+
<%% end %>
|
|
16
|
+
>
|
|
17
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
18
|
+
|
|
19
|
+
<span class="resource-value">
|
|
20
|
+
<%%= current_choice ? current_choice[:label] : (<%= singular_table_name %>.<%= @field %>.presence || "-") %>
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
<%% end %>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<div class="resource-field in-place-rich-text">
|
|
3
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
4
|
+
|
|
5
|
+
<div
|
|
6
|
+
class="in-place-rich-text__content"
|
|
7
|
+
data-controller="image-lightbox rich-text"
|
|
8
|
+
data-action="keydown->image-lightbox#keydown"
|
|
9
|
+
>
|
|
10
|
+
<%%= <%= singular_table_name %>.<%= @field %> %>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
class="image-lightbox"
|
|
14
|
+
data-image-lightbox-target="overlay"
|
|
15
|
+
data-action="click->image-lightbox#closeOnBackground"
|
|
16
|
+
tabindex="-1"
|
|
17
|
+
role="dialog"
|
|
18
|
+
aria-modal="true"
|
|
19
|
+
aria-label="Image gallery"
|
|
20
|
+
hidden
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class="image-lightbox__counter"
|
|
24
|
+
data-image-lightbox-target="counter"
|
|
25
|
+
></div>
|
|
26
|
+
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
class="image-lightbox__close"
|
|
30
|
+
aria-label="Close image"
|
|
31
|
+
data-action="click->image-lightbox#close"
|
|
32
|
+
>
|
|
33
|
+
×
|
|
34
|
+
</button>
|
|
35
|
+
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
class="image-lightbox__navigation image-lightbox__navigation--previous"
|
|
39
|
+
aria-label="Previous image"
|
|
40
|
+
data-image-lightbox-target="previousButton"
|
|
41
|
+
data-action="click->image-lightbox#previous"
|
|
42
|
+
>
|
|
43
|
+
‹
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
<div
|
|
47
|
+
class="image-lightbox__stage"
|
|
48
|
+
data-image-lightbox-target="stage"
|
|
49
|
+
data-action="
|
|
50
|
+
pointerdown->image-lightbox#pointerDown
|
|
51
|
+
pointermove->image-lightbox#pointerMove
|
|
52
|
+
pointerup->image-lightbox#pointerUp
|
|
53
|
+
pointercancel->image-lightbox#pointerCancel
|
|
54
|
+
"
|
|
55
|
+
>
|
|
56
|
+
<img
|
|
57
|
+
class="image-lightbox__image"
|
|
58
|
+
data-image-lightbox-target="image"
|
|
59
|
+
alt=""
|
|
60
|
+
>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
class="image-lightbox__navigation image-lightbox__navigation--next"
|
|
66
|
+
aria-label="Next image"
|
|
67
|
+
data-image-lightbox-target="nextButton"
|
|
68
|
+
data-action="click->image-lightbox#next"
|
|
69
|
+
>
|
|
70
|
+
›
|
|
71
|
+
</button>
|
|
72
|
+
|
|
73
|
+
<div
|
|
74
|
+
class="image-lightbox__thumbnails"
|
|
75
|
+
data-image-lightbox-target="thumbnails"
|
|
76
|
+
></div>
|
|
77
|
+
|
|
78
|
+
<div
|
|
79
|
+
class="image-lightbox__caption"
|
|
80
|
+
data-image-lightbox-target="caption"
|
|
81
|
+
></div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
86
|
+
<div
|
|
87
|
+
class="in-place-rich-text__action"
|
|
88
|
+
data-controller="in-place"
|
|
89
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
90
|
+
>
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
class="in-place-edit-button"
|
|
94
|
+
data-action="click->in-place#edit"
|
|
95
|
+
title="Edit <%= @field.humanize.downcase %>"
|
|
96
|
+
aria-label="Edit <%= @field.humanize.downcase %>"
|
|
97
|
+
>
|
|
98
|
+
<svg
|
|
99
|
+
class="in-place-edit-button__icon"
|
|
100
|
+
viewBox="0 0 24 24"
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
>
|
|
103
|
+
<path
|
|
104
|
+
d="M12 20h9"
|
|
105
|
+
fill="none"
|
|
106
|
+
stroke="currentColor"
|
|
107
|
+
stroke-width="2"
|
|
108
|
+
stroke-linecap="round"
|
|
109
|
+
/>
|
|
110
|
+
<path
|
|
111
|
+
d="M16.5 3.5a2.121 2.121 0 0 1 3 3L8 18l-4 1 1-4Z"
|
|
112
|
+
fill="none"
|
|
113
|
+
stroke="currentColor"
|
|
114
|
+
stroke-width="2"
|
|
115
|
+
stroke-linecap="round"
|
|
116
|
+
stroke-linejoin="round"
|
|
117
|
+
/>
|
|
118
|
+
</svg>
|
|
119
|
+
</button>
|
|
120
|
+
</div>
|
|
121
|
+
<%% end %>
|
|
122
|
+
</div>
|
|
123
|
+
<%% end %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<%% choices = <%= select_configuration[:values].inspect %> %>
|
|
3
|
+
<%% current_choice = choices.find do |choice|
|
|
4
|
+
choice[:value].to_s == <%= singular_table_name %>.<%= @field %>.to_s
|
|
5
|
+
end %>
|
|
6
|
+
|
|
7
|
+
<div
|
|
8
|
+
class="resource-field<%%= " in-place-edit" if b4um_in_place_editing_allowed? %>"
|
|
9
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
10
|
+
data-controller="in-place"
|
|
11
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
12
|
+
data-action="click->in-place#edit keydown.enter->in-place#edit keydown.space->in-place#edit"
|
|
13
|
+
role="button"
|
|
14
|
+
tabindex="0"
|
|
15
|
+
<%% end %>
|
|
16
|
+
>
|
|
17
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
18
|
+
|
|
19
|
+
<span class="resource-value">
|
|
20
|
+
<%%= current_choice ? current_choice[:label] : (<%= singular_table_name %>.<%= @field %>.presence || "-") %>
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
<%% end %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<div
|
|
3
|
+
class="resource-field<%%= " in-place-edit" if b4um_in_place_editing_allowed? %>"
|
|
4
|
+
<%% if b4um_in_place_editing_allowed? %>
|
|
5
|
+
data-controller="in-place"
|
|
6
|
+
data-in-place-url-value="<%%= edit_<%= @field %>_<%= singular_table_name %>_path(<%= singular_table_name %>) %>"
|
|
7
|
+
data-action="click->in-place#edit keydown.enter->in-place#edit keydown.space->in-place#edit"
|
|
8
|
+
role="button"
|
|
9
|
+
tabindex="0"
|
|
10
|
+
<%% end %>
|
|
11
|
+
>
|
|
12
|
+
<strong class="resource-label"><%= @field.humanize %>:</strong>
|
|
13
|
+
|
|
14
|
+
<span class="resource-value">
|
|
15
|
+
<%%= <%= singular_table_name %>.<%= @field %>.presence || "—" %>
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
<%% end %>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<%%= turbo_frame_tag dom_id(@<%= singular_table_name %>, :<%= @field %>) do %>
|
|
2
|
+
<div
|
|
3
|
+
class="in-place-image-editor"
|
|
4
|
+
data-controller="in-place"
|
|
5
|
+
data-in-place-outside-save-value="false"
|
|
6
|
+
data-in-place-cancel-url-value="<%%= <%= singular_table_name %>_path(@<%= singular_table_name %>) %>"
|
|
7
|
+
>
|
|
8
|
+
<div class="in-place-image-editor__preview">
|
|
9
|
+
<%% if @<%= singular_table_name %>.<%= @field %>.attached? %>
|
|
10
|
+
<%%= image_tag @<%= singular_table_name %>.<%= @field %>,
|
|
11
|
+
class: "in-place-image-editor__image",
|
|
12
|
+
alt: @<%= singular_table_name %>.<%= @field %>.filename.to_s %>
|
|
13
|
+
|
|
14
|
+
<%%= form_with model: @<%= singular_table_name %>,
|
|
15
|
+
class: "in-place-image-remove-form" do |form| %>
|
|
16
|
+
|
|
17
|
+
<%%= hidden_field_tag :in_place_field, "<%= @field %>" %>
|
|
18
|
+
<%%= hidden_field_tag(
|
|
19
|
+
"<%= singular_table_name %>[remove_<%= @field %>]",
|
|
20
|
+
"1"
|
|
21
|
+
) %>
|
|
22
|
+
|
|
23
|
+
<button
|
|
24
|
+
type="submit"
|
|
25
|
+
class="in-place-image-remove"
|
|
26
|
+
title="Remove image"
|
|
27
|
+
aria-label="Remove image"
|
|
28
|
+
>
|
|
29
|
+
<span class="in-place-image-remove__icon" aria-hidden="true">
|
|
30
|
+
×
|
|
31
|
+
</span>
|
|
32
|
+
</button>
|
|
33
|
+
<%% end %>
|
|
34
|
+
<%% else %>
|
|
35
|
+
<div class="in-place-image-editor__empty">
|
|
36
|
+
No image
|
|
37
|
+
</div>
|
|
38
|
+
<%% end %>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="in-place-image-editor__controls">
|
|
42
|
+
<%%= form_with model: @<%= singular_table_name %>,
|
|
43
|
+
class: "in-place-image-form",
|
|
44
|
+
multipart: true do |form| %>
|
|
45
|
+
|
|
46
|
+
<%%= hidden_field_tag :in_place_field, "<%= @field %>" %>
|
|
47
|
+
|
|
48
|
+
<%% if @<%= singular_table_name %>.errors[:<%= @field %>].any? %>
|
|
49
|
+
<div class="in-place-error">
|
|
50
|
+
<%%= @<%= singular_table_name %>.errors.full_messages_for(:<%= @field %>).to_sentence %>
|
|
51
|
+
</div>
|
|
52
|
+
<%% end %>
|
|
53
|
+
|
|
54
|
+
<%%= form.file_field :<%= @field %>,
|
|
55
|
+
accept: "image/*",
|
|
56
|
+
class: "in-place-file-input",
|
|
57
|
+
data: { action: "change->in-place#save" } %>
|
|
58
|
+
|
|
59
|
+
<%% if @<%= singular_table_name %>.<%= @field %>.attached? %>
|
|
60
|
+
<label
|
|
61
|
+
for="<%= singular_table_name %>_<%= @field %>"
|
|
62
|
+
class="in-place-file-button in-place-file-button--replace"
|
|
63
|
+
>
|
|
64
|
+
<span class="in-place-file-button__icon" aria-hidden="true">
|
|
65
|
+
📷
|
|
66
|
+
</span>
|
|
67
|
+
Replace image
|
|
68
|
+
</label>
|
|
69
|
+
<%% else %>
|
|
70
|
+
<label
|
|
71
|
+
for="<%= singular_table_name %>_<%= @field %>"
|
|
72
|
+
class="in-place-file-button in-place-file-button--choose"
|
|
73
|
+
>
|
|
74
|
+
<span class="in-place-file-button__icon" aria-hidden="true">
|
|
75
|
+
+
|
|
76
|
+
</span>
|
|
77
|
+
Choose image
|
|
78
|
+
</label>
|
|
79
|
+
<%% end %>
|
|
80
|
+
<%% end %>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<%% end %>
|