five-two-nw-olivander 0.2.0.11 → 0.2.0.13

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: 6f764e204cfc85552452c95d06194c22b7902bee3dcca094f8374ee1e3fb8507
4
- data.tar.gz: 900b83c1bc3dbb69a36ce555ade4c5a219cdc0201e8cc0e0359721d37b8ae08f
3
+ metadata.gz: 32975e399247cbaadcd9c20ad92f234a8b1d1d6e6309c5ffb9356ad2e91cf3ce
4
+ data.tar.gz: d13e34fff93d0fcba192c6adf841e5102e600cd27e9d6e48711fa4a6165658f9
5
5
  SHA512:
6
- metadata.gz: a27b770a994ae2f3438297279c17819c15e38c10180a79e6c6627e0d9a7e47398a688c73cb2f5131cc970ec54d7b9916e628d1f8de481c57704bb13007d82af1
7
- data.tar.gz: e0c30bf32abf9d9bc47926f97d7177ffde07b20762e274e401f6135aa5e919a4ffe9fe2d72688707e303d1965afdcdd4a16039ebae8c339ef9639b8d597c3cab
6
+ metadata.gz: d79a012a2dd882b152c251bb8a3fa0dc63232cfcaaf054c6ce8b9cb5bf917d9818a61cd121ed672febd0f3291113f27b601292090d42ac353d37346e137776d7
7
+ data.tar.gz: 9e835c5d61f5c40e9a43182224f353ddfc53a89b9c83e40292d828cd535bb0c054dd9ed4a6a63c142f948b312300f20ac90c2e10e1d7a25d7fa010268dc6a501
@@ -3,12 +3,14 @@ import { Controller } from "@hotwired/stimulus"
3
3
  // Connects to data-controller="input-control-association"
4
4
  export default class extends Controller {
5
5
  connect() {
6
+ console.log('setting up')
6
7
  var self = this,
7
8
  el = self.element;
8
9
 
9
- if (!$(el).hasClass("select2-hidden-accessible")) {
10
+ if (el.dataset.forceSelect2 || !$(el).hasClass("select2-hidden-accessible")) {
10
11
  $(el).select2({
11
12
  dropdownParent: $(el).parent(),
13
+ minimumInputLength: el.dataset.minimumInputLength || 0,
12
14
  tags: el.dataset.taggable == 'true',
13
15
  createTag: function (tag) {
14
16
  return {
@@ -20,8 +22,19 @@ export default class extends Controller {
20
22
  ajax: {
21
23
  url: el.dataset.collectionPath,
22
24
  delay: 250,
23
- minimumInputLength: 2,
24
25
  dataType: 'json',
26
+ data: function(params) {
27
+ var hash = {
28
+ term: params.term,
29
+ _type: params._type,
30
+ }
31
+
32
+ if (el.dataset.tagParentId) {
33
+ hash[el.dataset.tagParentSearch] = el.dataset.tagParentId
34
+ }
35
+
36
+ return hash;
37
+ },
25
38
  processResults: function(data) {
26
39
  return { results: data.map(function(map) {
27
40
  return {
@@ -40,6 +53,7 @@ export default class extends Controller {
40
53
  data = new FormData()
41
54
  data.append("authenticity_token", document.querySelector('meta[name="csrf-token"]').content)
42
55
  data.append(el.dataset.tagFieldName, tag.text)
56
+ data.append(el.dataset.tagParentField, el.dataset.tagParentId)
43
57
  fetch(el.dataset.collectionPath, {
44
58
  method: 'POST',
45
59
  headers: {
@@ -1,3 +1,3 @@
1
1
  module Olivander
2
- VERSION = '0.2.0.11'.freeze
2
+ VERSION = '0.2.0.13'.freeze
3
3
  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.11
4
+ version: 0.2.0.13
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-03-28 00:00:00.000000000 Z
11
+ date: 2024-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick