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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18486c2d275d4a29d8744839fd0838cca5ab46afbe68791cca9df7bc0b0ce77a
4
- data.tar.gz: d446454040507486d85d3bebfe1ddf8894cb0ceead8aa976394b1c74b03ea3ac
3
+ metadata.gz: '092659fd672c3482f8ce50515feaf7e8540b682f9c2a15e3d220eec68f4edb8d'
4
+ data.tar.gz: 5806e86e581d66fa53eb0898c6ae6e03e346a8ffbc99931806105143cdbfba57
5
5
  SHA512:
6
- metadata.gz: 51dc8c2510a3ecde2f41a11d1d80d2ec4cfa59efea121df2ee05ed53226081be53ffed346a8405a8ea0f2256b439964e83b253adab573c10cb3dc755dd924edf
7
- data.tar.gz: 799f3f2070b303d70443b824fc2f808b64248416b04f70230494785762ffc7fd1e4381eca0af3526fd78e12f3970a44f4b0ddb18b54f9af596cba3c9d748e46d
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
- if (this.activeItems().length > 0) {
179
- this.hidePlaceholder()
180
- } else {
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
- this.thumbnailsTarget.insertAdjacentHTML('beforeend', templateHtml)
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
- if (this.activeItems().length > 0) {
11208
- this.hidePlaceholder();
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("beforeend", templateHtml);
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;
@@ -23,7 +23,8 @@ module Formstrap
23
23
  attribute: attribute,
24
24
  form: form,
25
25
  required: required,
26
- text: label
26
+ text: label,
27
+ translatable: translatable
27
28
  }
28
29
  end
29
30
  end
@@ -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 class="<%= "d-none" if media.attachments.any? %>" data-media-target="placeholder">
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
@@ -7,6 +7,8 @@ de:
7
7
  other: Dateien durchsuchen oder hierher ziehen und ablegen
8
8
  group:
9
9
  save: Speichern
10
+ label:
11
+ translatable_tooltip: Dieses Feld ist übersetzbar und kann je nach Sprache einen anderen Wert enthalten
10
12
  media:
11
13
  modal:
12
14
  close: Schließen
@@ -7,6 +7,8 @@ en:
7
7
  other: Browse files or drag & drop them here
8
8
  group:
9
9
  save: Save
10
+ label:
11
+ translatable_tooltip: This field is translatable and can contain a different value per language
10
12
  media:
11
13
  modal:
12
14
  close: Close
@@ -7,6 +7,8 @@ fr:
7
7
  other: Parcourir les fichiers ou faites les glisser et déposez-les ici
8
8
  group:
9
9
  save: Sauvegarder
10
+ label:
11
+ translatable_tooltip: Ce champ est traduisible et peut contenir une valeur différente selon la langue
10
12
  media:
11
13
  modal:
12
14
  close: Fermer
@@ -7,6 +7,8 @@ nl:
7
7
  other: Kies bestanden of sleep ze hierheen
8
8
  group:
9
9
  save: Opslaan
10
+ label:
11
+ translatable_tooltip: "Dit veld is vertaalbaar en kan per taal een andere waarde bevatten"
10
12
  media:
11
13
  modal:
12
14
  close: Sluiten
@@ -1,3 +1,3 @@
1
1
  module Formstrap
2
- VERSION = "0.4.10"
2
+ VERSION = "0.4.11"
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontierdotbe/formstrap",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "Bootstrap-powered Form Helpers",
5
5
  "module": "app/assets/javascripts/formstrap.js",
6
6
  "main": "app/assets/javascripts/formstrap.js",
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.10
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-03-10 00:00:00.000000000 Z
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>