five-two-nw-olivander 0.2.0.38 → 0.2.0.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bd58e03477da793320172cd5573cbcf620bb80718dd0738c81fc4bb43f7ba77
4
- data.tar.gz: 73051678eacddbd98c9837807cf3927aceb7f007495e6707df8ca3c86cae71b3
3
+ metadata.gz: 5ec68ee62696638c7f27567cc63bd5c603a8d51f6e438d6e7e46d6fb66e60ddf
4
+ data.tar.gz: ff07b0ecbb480adc7c7828315d1e1b6cca6eb1b99e9a6259f969dce782adce03
5
5
  SHA512:
6
- metadata.gz: d065f3f59f8c589faaa0bf14382aeac4ad5f53c1d990f8222943dee86f6fd8e74d259bf722db00a3d138e252270fe129e5d1d1453683c8b6410daed7307eabbb
7
- data.tar.gz: ac20459dab97139df83767b3cd7cbe1b49b265ce212d2e5eedcd813e8fd4e8294f9fa551d5aa33acf8eef43cfb727d0125306f7238f4e519aa52db922e207679
6
+ metadata.gz: 5d38f3bfc7fe9f6a881a1849ec50fdde50968a557063a825148ad57a4cd6f1baebb6c421da63344bd1acd1a8051ae03ff5bb07fe062b4e38870a2e12673e5a5e
7
+ data.tar.gz: e317ba7955afa1b9f467f6000f96a8943b42f0fb40d0df97ae7df082075bbdce7b15530d1cae23dd7275042665a7addd38d1d2feac699a23cdcc0b3254189448
@@ -24,3 +24,17 @@
24
24
  //= require 'olivander/flash_toast'
25
25
  //= require "effective_datatables"
26
26
  //= require "adminlte/datatable.fix.js"
27
+
28
+ $(document).ready(function(e) {
29
+ var popperTexts = document.querySelectorAll('[data-popper-text]')
30
+ popperTexts.forEach(function(el, idx) {
31
+ var label = document.querySelector(`[for='${el.id}']`)
32
+ label.innerHTML = label.innerHTML + ` `
33
+ var helpCircle = document.createElement('i')
34
+ helpCircle.classList.add('fa', 'fa-question-circle', 'text-primary')
35
+ helpCircle.addEventListener('click', function(evt) {
36
+ Swal.fire(el.dataset.popperText)
37
+ })
38
+ label.appendChild(helpCircle)
39
+ })
40
+ })
@@ -14,6 +14,13 @@ class Olivander::Components::ResourceFormComponent < ViewComponent::Base
14
14
  @f.object.send(field.sym)
15
15
  end
16
16
 
17
+ def label_data_hash_for(field)
18
+ help_text_key = ['activerecord.attributes', @resource.class.name.underscore, "#{field.sym}_help_text"].join('.')
19
+ {}.tap do |hash|
20
+ hash[:popper_text] = O18n.t(help_text_key) if I18n.exists?(help_text_key)
21
+ end
22
+ end
23
+
17
24
  def association_data_hash_for(field)
18
25
  {
19
26
  collection_path: collection_path_for(field),
@@ -21,14 +28,14 @@ class Olivander::Components::ResourceFormComponent < ViewComponent::Base
21
28
  '-')}-#{field.sym} input-control-association",
22
29
  taggable: taggable?(field),
23
30
  tag_field_name: tag_field_name(field)
24
- }
31
+ }.merge(label_data_hash_for(field))
25
32
  end
26
33
 
27
34
  def input_data_hash_for(field)
28
35
  {
29
36
  controller: "input-#{@resource.class.name.underscore.dasherize.gsub('/',
30
37
  '-')}-#{field.sym} input-control-#{field.type}"
31
- }
38
+ }.merge(label_data_hash_for(field))
32
39
  end
33
40
 
34
41
  def input_picker_options_for(field)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # needed for gem
4
4
  module Olivander
5
- VERSION = '0.2.0.38'
5
+ VERSION = '0.2.0.39'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: five-two-nw-olivander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.38
4
+ version: 0.2.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-28 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick