activeadmin-select2 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f43792ee420d95f4830e98ff61066bdf8d60f95a
|
4
|
+
data.tar.gz: fc9ea7e90233527b30532c4032e86464cdf772e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e103104db8122dcf90df1c998e6d09abcf3557e84738d9e239deb0df404b9429a56d280d3f659c0142c8d063e4c28ef6516813b931f8b74f083cf60f080dd5b4
|
7
|
+
data.tar.gz: 0a485f2f56c2ae315ed730af95232dd7b59f6b1b104aa60be0448d914f427454a6f75b73dbb3fb6a341773ab7c666f731f78b5b367b120b75aad6de7441bfd60
|
@@ -1,7 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
initSelect2 = (inputs, extra = {}) ->
|
4
|
+
inputs.each ->
|
5
|
+
item = $(this)
|
6
|
+
# reading from data allows <input data-select2='{"tags": ['some']}'> to be passed to select2
|
7
|
+
options = $.extend(allowClear: true, extra, item.data('select2'))
|
8
|
+
# because select2 reads from input.data to check if it is select2 already
|
9
|
+
item.data('select2', null)
|
10
|
+
item.select2(options)
|
3
11
|
|
12
|
+
$(document).on 'has_many_add:after', '.has_many_container', (e, fieldset) ->
|
13
|
+
initSelect2(fieldset.find('.select2-input'))
|
4
14
|
|
5
15
|
$(document).ready ->
|
6
|
-
$(".select2-input")
|
16
|
+
initSelect2($(".select2-input"), placeholder: "")
|
7
17
|
return
|
data/lib/activeadmin-select2.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'formtastic/inputs/string_input'
|
2
|
+
|
3
|
+
module Formtastic
|
4
|
+
module Inputs
|
5
|
+
|
6
|
+
class Select2TagsInput < Formtastic::Inputs::StringInput
|
7
|
+
def input_html_options
|
8
|
+
{
|
9
|
+
class: 'select2-input select2-tags-input',
|
10
|
+
data: { select2: { tags: options[:collection] }}
|
11
|
+
}.merge(super)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-select2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Fairburn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/activeadmin/select2/version.rb
|
107
107
|
- lib/formtastic/inputs/select2_input.rb
|
108
108
|
- lib/formtastic/inputs/select2_multiple_input.rb
|
109
|
+
- lib/formtastic/inputs/select2_tags_input.rb
|
109
110
|
homepage: https://github.com/mfairburn/activeadmin-select2#readme
|
110
111
|
licenses:
|
111
112
|
- MIT
|