activeadmin_selectize 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: d3a61a8c9ec00cdabdd940c905360d58fd5621bf
4
- data.tar.gz: 4f2202a52a27293e7486924c5fee9c2cc02023e0
3
+ metadata.gz: 3547c31cd6c7e4133b4e01207346c6b49d362f54
4
+ data.tar.gz: 8374b9f2f4adff98f540a6de0ebc4810acc486be
5
5
  SHA512:
6
- metadata.gz: dc89542066d7716d13db44fa67421e1e2c1168c82bdf98bce104b098e3d2157b28dd28e7c1b138fc30d4fdb9fbdaac0d7e24a7056032ddda9b9ddc961c280869
7
- data.tar.gz: 521326d5a96cf23c3d82331dafca7df7a5036ff74198b8c14d1aa4c0eaf8faa541fc3a17676d0a154869632c7b33e78ff4ffac7560a7df53e11594c971b20faa
6
+ metadata.gz: e82d587c55041402d5ddc4ddd21cae3f34e5a52678a8bab34ecfccba05af16c4344a4086677e1ab1d3a23f944d8dffacb4d55582c3357614a6db0e0fd4185759
7
+ data.tar.gz: 8e50003c64850744ca0de6827916fb911f06de7ef0fabfd8b78791cd4419c0be631ac962d7bb6beb1ee23185368b9ec5697a0157cb1717385d1e374abab4d657
data/README.md CHANGED
@@ -25,19 +25,7 @@ Features:
25
25
 
26
26
  Why 2 separated scripts? In this way you can include a different version of Selectize.js if you like.
27
27
 
28
- ## Notes
29
-
30
- - In ActiveAdmin json routes should be enabled by default, this behavior is controlled by *download_links* option for index action. Example:
31
-
32
- ```rb
33
- index download_links: [:csv, :json] do
34
- # ...
35
- end
36
- ```
37
-
38
- - If the select items "gets cut" by the container try adding: `'data-opts': '{"dropdownParent":"body"}'`
39
-
40
- ## Example
28
+ ## Examples
41
29
 
42
30
  Example 1: an Article model with a many-to-many relation with Tag model:
43
31
 
@@ -70,6 +58,28 @@ filter :name_eq, as: :selectize, collection: Author.all.pluck( :name, :name )
70
58
  filter :tags_id_eq, as: :selectize, collection: [], input_html: { 'data-opt-remote': '/admin/tags.json', 'data-opt-text': 'name', 'data-opt-value': 'id', 'data-opts': '{"dropdownParent":"body"}', placeholder: 'Search a tag...' }
71
59
  ```
72
60
 
61
+ ## Notes
62
+
63
+ - In ActiveAdmin json routes should be enabled by default, this behavior is controlled by *download_links* option for index action. Example:
64
+
65
+ ```rb
66
+ index download_links: [:csv, :json] do
67
+ # ...
68
+ end
69
+ ```
70
+
71
+ You can customize the JSON response overriding the *as_json* method of the model:
72
+
73
+ ```rb
74
+ def as_json( options = nil )
75
+ super({ only: [:id], methods: [:fullname] }.merge(options || {}))
76
+ end
77
+ ```
78
+
79
+ - If the select items "gets cut" by the container try adding: `'data-opts': '{"dropdownParent":"body"}'`
80
+
81
+ - Alternative syntax to pass data attributes: `input_html: { data: { opts: '{}' } }`
82
+
73
83
  ## Options
74
84
 
75
85
  Pass the required options using `input_html`.
@@ -83,6 +93,12 @@ Alternative syntax:
83
93
 
84
94
  - **data-opts**: overrides Selectize options - example: `'data-opts': '{"highlight":true,"plugins":[]}'`
85
95
 
96
+ ## Do you like it? Star it!
97
+
98
+ If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
99
+
100
+ Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source) that I made if you are curious.
101
+
86
102
  ## Contributors
87
103
 
88
104
  - [Mattia Roccoberton](http://blocknot.es) - creator, maintainer
@@ -1,4 +1,4 @@
1
- @import './selectize/selectize'
1
+ @import 'activeadmin/selectize/selectize.css'
2
2
 
3
3
  .selectize-control
4
4
  .selectize-input
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module Selectize
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_selectize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin