formstrap 0.4.10 → 0.4.11
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/javascripts/formstrap/controllers/media_controller.js +8 -4
- data/app/assets/javascripts/formstrap.js +5 -4
- data/app/models/concerns/formstrap/labelable.rb +2 -1
- data/app/views/formstrap/_association.html.erb +1 -0
- data/app/views/formstrap/_checkbox.html.erb +1 -0
- data/app/views/formstrap/_color.html.erb +1 -0
- data/app/views/formstrap/_date.html.erb +1 -0
- data/app/views/formstrap/_email.html.erb +1 -0
- data/app/views/formstrap/_file.html.erb +1 -0
- data/app/views/formstrap/_label.html.erb +5 -0
- data/app/views/formstrap/_media.html.erb +2 -1
- data/app/views/formstrap/_number.html.erb +1 -0
- data/app/views/formstrap/_password.html.erb +1 -0
- data/app/views/formstrap/_redactor.html.erb +1 -0
- data/app/views/formstrap/_select.html.erb +1 -0
- data/app/views/formstrap/_switch.html.erb +2 -1
- data/app/views/formstrap/_text.html.erb +2 -1
- data/app/views/formstrap/_textarea.html.erb +1 -0
- data/app/views/formstrap/_wysiwyg.html.erb +1 -0
- data/config/locales/formstrap/de.yml +2 -0
- data/config/locales/formstrap/en.yml +2 -0
- data/config/locales/formstrap/fr.yml +2 -0
- data/config/locales/formstrap/nl.yml +2 -0
- data/lib/formstrap/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -3
- data/app/views/formstrap/shared/_notifications.html.erb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '092659fd672c3482f8ce50515feaf7e8540b682f9c2a15e3d220eec68f4edb8d'
|
4
|
+
data.tar.gz: 5806e86e581d66fa53eb0898c6ae6e03e346a8ffbc99931806105143cdbfba57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6453e0b910ac76064ac3cade4dfbb460402da1f7ed3dc5887dca7c2babfdd69dbe60fca67826f299f6759b00c5c656341429e53def70302371f8bec3daf514cd
|
7
|
+
data.tar.gz: 93161397d6203acae26fd442b1a9babdb4a83cb842d33409ba149a703ece5425458fef99cf0a58da1f382b880204de0e3c4977621d14989e0fe22b54ad67cb2a
|
@@ -175,10 +175,12 @@ export default class extends Controller {
|
|
175
175
|
}
|
176
176
|
|
177
177
|
togglePlaceholder () {
|
178
|
-
|
179
|
-
|
180
|
-
|
178
|
+
const count = this.activeItems().length
|
179
|
+
|
180
|
+
if (count < this.maxActiveItems()) {
|
181
181
|
this.showPlaceholder()
|
182
|
+
} else {
|
183
|
+
this.hidePlaceholder()
|
182
184
|
}
|
183
185
|
}
|
184
186
|
|
@@ -199,7 +201,9 @@ export default class extends Controller {
|
|
199
201
|
// Copy template
|
200
202
|
let templateHtml = this.templateTarget
|
201
203
|
templateHtml = this.randomizeIds(templateHtml)
|
202
|
-
|
204
|
+
|
205
|
+
// Add new thumbnail before the last element (thumbnail)
|
206
|
+
this.thumbnailsTarget.children[this.thumbnailsTarget.children.length - 1].insertAdjacentHTML('beforebegin', templateHtml)
|
203
207
|
|
204
208
|
// Set new values
|
205
209
|
const newItem = this.itemTargets.pop()
|
@@ -11204,10 +11204,11 @@ var media_controller_default = class extends Controller {
|
|
11204
11204
|
}
|
11205
11205
|
}
|
11206
11206
|
togglePlaceholder() {
|
11207
|
-
|
11208
|
-
|
11209
|
-
} else {
|
11207
|
+
const count = this.activeItems().length;
|
11208
|
+
if (count < this.maxActiveItems()) {
|
11210
11209
|
this.showPlaceholder();
|
11210
|
+
} else {
|
11211
|
+
this.hidePlaceholder();
|
11211
11212
|
}
|
11212
11213
|
}
|
11213
11214
|
showPlaceholder() {
|
@@ -11223,7 +11224,7 @@ var media_controller_default = class extends Controller {
|
|
11223
11224
|
createItem(item) {
|
11224
11225
|
let templateHtml = this.templateTarget;
|
11225
11226
|
templateHtml = this.randomizeIds(templateHtml);
|
11226
|
-
this.thumbnailsTarget.insertAdjacentHTML("
|
11227
|
+
this.thumbnailsTarget.children[this.thumbnailsTarget.children.length - 1].insertAdjacentHTML("beforebegin", templateHtml);
|
11227
11228
|
const newItem = this.itemTargets.pop();
|
11228
11229
|
newItem.querySelector('input[name*="[blob_id]"]').value = item.blobId;
|
11229
11230
|
newItem.querySelector('input[name*="[_destroy]"]').value = false;
|
@@ -15,6 +15,7 @@
|
|
15
15
|
# * +prepend+ - Display as input group with text on the left-hand side
|
16
16
|
# * +remote+ - Hash with all options for remote data fetching
|
17
17
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
18
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
18
19
|
#
|
19
20
|
# ==== Remote options
|
20
21
|
# * +url+ -- JSON endpoint to fetch data from
|
@@ -11,6 +11,7 @@
|
|
11
11
|
# * +label+ - Text to display inside label tag. Defaults to the attribute name. Set to false if you don"t want to show a label.
|
12
12
|
# * +unchecked_value+ - Value for unchecked state
|
13
13
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
14
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
14
15
|
#
|
15
16
|
# ==== References
|
16
17
|
# https://headmin.dev/docs/forms/checkbox
|
@@ -9,6 +9,7 @@
|
|
9
9
|
# * +hint+ - Informative text to assist with data input. HTML markup is allowed.
|
10
10
|
# * +label+ - Text to display inside label tag. Defaults to the attribute name. Set to false if you don"t want to show a label.
|
11
11
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
12
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
12
13
|
#
|
13
14
|
# ==== References
|
14
15
|
# https://headmin.dev/docs/forms/color
|
@@ -14,6 +14,7 @@
|
|
14
14
|
# * +plaintext+ - Render input as plain text.
|
15
15
|
# * +prepend+ - Display as input group with text on the left-hand side
|
16
16
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
17
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
17
18
|
#
|
18
19
|
# ==== References
|
19
20
|
# https://headmin.dev/docs/forms/date
|
@@ -15,6 +15,7 @@
|
|
15
15
|
# * +plaintext+ - Render input as plain text.
|
16
16
|
# * +prepend+ - Display as input group with text on the left-hand side
|
17
17
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
18
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
18
19
|
#
|
19
20
|
# ==== References
|
20
21
|
# https://headmin.dev/docs/forms/email
|
@@ -15,6 +15,7 @@
|
|
15
15
|
# * +label+ - Text to display inside label tag. Defaults to the attribute name. Set to false if you don"t want to show a label.
|
16
16
|
# * +prepend+ - Display as input group with text on the left-hand side
|
17
17
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
18
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
18
19
|
#
|
19
20
|
# ==== References
|
20
21
|
# https://headmin.dev/docs/forms/file
|
@@ -1,9 +1,11 @@
|
|
1
1
|
<%
|
2
2
|
# name: formstrap/label
|
3
3
|
#
|
4
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
4
5
|
# ==== Required parameters
|
5
6
|
# * +form+ - Form object
|
6
7
|
# * +attribute+ - Name of the attribute of the form model
|
8
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
7
9
|
#
|
8
10
|
# ==== Optional parameters
|
9
11
|
# * +text+ - Custom label to be used instead of the attribute
|
@@ -20,3 +22,6 @@
|
|
20
22
|
|
21
23
|
<% label = Formstrap::LabelView.new(local_assigns) %>
|
22
24
|
<%= form.label label.attribute, label.text, label.options %>
|
25
|
+
<% if label.translatable %>
|
26
|
+
<%= bootstrap_icon "translate", class: "ms-1 text-black text-opacity-50", title: t(".translatable_tooltip") %>
|
27
|
+
<% end %>
|
@@ -17,6 +17,7 @@
|
|
17
17
|
# * +height+ - Height of the thumbnail
|
18
18
|
# * +exclude_models+ - Array of model names to exclude from selection (e.g. ["User", "Company"])
|
19
19
|
# * +edit_url+ - Placeholder link for the edit page of the attachment. Needs to contain a ":id" part, e.g. "admin_media_edit_url(":id"). This url be opened in a modal
|
20
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
20
21
|
#
|
21
22
|
# ==== References
|
22
23
|
# https://headmin.dev/docs/forms/media
|
@@ -41,7 +42,7 @@
|
|
41
42
|
<% end %>
|
42
43
|
|
43
44
|
<!-- Placeholder -->
|
44
|
-
<div
|
45
|
+
<div data-media-target="placeholder">
|
45
46
|
<a href="<%= media.modal_url %>" data-turbo-frame="modal" data-media-target="modalButton">
|
46
47
|
<%= render "formstrap/shared/thumbnail", media.thumbnail_options %>
|
47
48
|
</a>
|
@@ -14,6 +14,7 @@
|
|
14
14
|
# * +plaintext+ - Render input as plain text.
|
15
15
|
# * +prepend+ - Display as input group with text on the left-hand side
|
16
16
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
17
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
17
18
|
#
|
18
19
|
# ==== References
|
19
20
|
# https://headmin.dev/docs/forms/number
|
@@ -13,6 +13,7 @@
|
|
13
13
|
# * +plaintext+ - Render input as plain text.
|
14
14
|
# * +prepend+ - Display as input group with text on the left-hand side
|
15
15
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
16
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
16
17
|
#
|
17
18
|
# ==== References
|
18
19
|
# https://headmin.dev/docs/forms/password
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# * +prepend+ - Display as input group with text on the left-hand side
|
13
13
|
# * +redactor+ - Hash with all options you can pass to redactor JS config
|
14
14
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
15
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
15
16
|
#
|
16
17
|
# ==== References
|
17
18
|
# https://imperavi.com/redactor/docs
|
@@ -17,6 +17,7 @@
|
|
17
17
|
# * +tags+ - Allow options to be created dynamically. This will set the multiple attribute to true
|
18
18
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
19
19
|
# * +remote+ - Hash with all options for remote data fetching
|
20
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
20
21
|
#
|
21
22
|
# ==== Remote options
|
22
23
|
# * +url+ -- JSON endpoint to fetch data from
|
@@ -11,6 +11,7 @@
|
|
11
11
|
# * +label+ - Text to display inside label tag. Defaults to the attribute name. Set to false if you don"t want to show a label.
|
12
12
|
# * +unchecked_value+ - Value for unchecked state
|
13
13
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
14
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
14
15
|
#
|
15
16
|
# ==== References
|
16
17
|
# https://headmin.dev/docs/forms/switch
|
@@ -26,4 +27,4 @@
|
|
26
27
|
switch = Formstrap::SwitchView.new(local_assigns)
|
27
28
|
%>
|
28
29
|
|
29
|
-
<%= render "formstrap/checkbox", switch.options %>
|
30
|
+
<%= render "formstrap/checkbox", switch.options %>
|
@@ -15,6 +15,7 @@
|
|
15
15
|
# * +plaintext+ - Render input as plain text.
|
16
16
|
# * +prepend+ - Display as input group with text on the left-hand side
|
17
17
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
18
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
18
19
|
#
|
19
20
|
# ==== References
|
20
21
|
# https://headmin.dev/docs/forms/text
|
@@ -39,4 +40,4 @@
|
|
39
40
|
<%= render "formstrap/validation", text.validation_options if text.validate? %>
|
40
41
|
<%= render "formstrap/hint", text.hint_options if text.hint? %>
|
41
42
|
<%= render "formstrap/label", text.label_options if text.append_label? %>
|
42
|
-
<% end %>
|
43
|
+
<% end %>
|
@@ -13,6 +13,7 @@
|
|
13
13
|
# * +plaintext+ - Render input as plain text.
|
14
14
|
# * +prepend+ - Display as input group with text on the left-hand side
|
15
15
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
16
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
16
17
|
#
|
17
18
|
# ==== References
|
18
19
|
# https://headmin.dev/docs/forms/textarea
|
@@ -10,6 +10,7 @@
|
|
10
10
|
# * +label+ - Text to display inside label tag. Defaults to the attribute name. Set to false if you don"t want to show a label.
|
11
11
|
# * +toolbar+ - Show toolbar (default true)
|
12
12
|
# * +wrapper+ - Hash with all options for the surrounding html tag
|
13
|
+
# * +translatable+ - Adds a translatable icon next to the label if it is set to true. Defaults depends on initializer.
|
13
14
|
#
|
14
15
|
# ==== References
|
15
16
|
# https://imperavi.com/redactor/docs
|
data/lib/formstrap/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jef Vlamings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An extensive Bootstrap form library to power your Ruby On Rails application.
|
14
14
|
email:
|
@@ -172,7 +172,6 @@ files:
|
|
172
172
|
- app/views/formstrap/pagination/_infinite.html.erb
|
173
173
|
- app/views/formstrap/repeater/_row.html.erb
|
174
174
|
- app/views/formstrap/shared/_nested_preview.html.erb
|
175
|
-
- app/views/formstrap/shared/_notifications.html.erb
|
176
175
|
- app/views/formstrap/shared/_popup.html.erb
|
177
176
|
- app/views/formstrap/shared/_thumbnail.html.erb
|
178
177
|
- bin/console
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
# formstrap/shared/notifications
|
3
|
-
#
|
4
|
-
# ==== Examples
|
5
|
-
# Basic version
|
6
|
-
# <%= render "formstrap/shared/notifications" %#>
|
7
|
-
%>
|
8
|
-
|
9
|
-
<div class="toast-container position-absolute top-0 end-0 p-3">
|
10
|
-
<% flash.each do |name, message| %>
|
11
|
-
<div class="toast align-items-center text-white show <%= notification_color(name.to_sym)[:background] %>" role="alert" aria-live="assertive" aria-atomic="true" data-controller="toast">
|
12
|
-
<div class="d-flex">
|
13
|
-
<div class="toast-body <%= notification_color(name.to_sym)[:text] %>">
|
14
|
-
<%= message %>
|
15
|
-
</div>
|
16
|
-
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
<% end %>
|
20
|
-
</div>
|