effective_form_inputs 1.1.8 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +7 -0
- data/app/assets/javascripts/effective_select/initialize.js.coffee +11 -0
- data/app/models/inputs/effective_select/input.rb +1 -0
- data/lib/effective_form_inputs/version.rb +1 -1
- metadata +2 -3
- data/Rakefile +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf93583a8dc76bcd36f5b87da49adadf24cbe92
|
4
|
+
data.tar.gz: 22c5a4c1baaed2aa38484b0f897eef99ea793823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 940c2f761c989743ee2de77c2a60e61efc8051863cb96d8a0e764654218768f34309588bde48f0249153aa2d693eb17182541a30184857e7e4c1e6c537e2346d
|
7
|
+
data.tar.gz: 867476cf23dfcde448c57d40cebbf210df9cd398480867e2d8a496850c2766063c467d277f84d97311e4a9c4040614bd047ee698764602775b144dc35e9bd7d4
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -748,6 +748,13 @@ To add a css class to the select2 container or dropdown:
|
|
748
748
|
:dropdownClass => 'custom-dropdown-class'
|
749
749
|
```
|
750
750
|
|
751
|
+
to display a glyphicon infront of each option value:
|
752
|
+
|
753
|
+
```ruby
|
754
|
+
:template => :glyphicon, :collection => User.all.map { |user| [user.to_s, user.to_param, { class: 'glyphicon-flag' }] }
|
755
|
+
```
|
756
|
+
|
757
|
+
|
751
758
|
### Additional
|
752
759
|
|
753
760
|
Call with `single_selected: true` to ensure only the first selected option tag will be `<option selected="selected">`.
|
@@ -1,10 +1,21 @@
|
|
1
1
|
# https://select2.github.io/examples.html
|
2
2
|
|
3
|
+
formatWithGlyphicon = (data, container) ->
|
4
|
+
if data.element && data.element.className
|
5
|
+
$("<span><i class='glyphicon #{data.element.className}'></i> #{data.text}</span>")
|
6
|
+
else
|
7
|
+
data.text
|
8
|
+
|
3
9
|
initialize = ->
|
4
10
|
$('select.effective_select:not(.initialized)').each (i, element) ->
|
5
11
|
element = $(element)
|
6
12
|
options = element.data('input-js-options') || {}
|
7
13
|
|
14
|
+
switch options['template']
|
15
|
+
when 'glyphicon'
|
16
|
+
options['templateResult'] = formatWithGlyphicon
|
17
|
+
options['templateSelection'] = formatWithGlyphicon
|
18
|
+
|
8
19
|
$select = element.addClass('initialized').select2(options)
|
9
20
|
|
10
21
|
# effective_select custom class functionality
|
@@ -153,6 +153,7 @@ module Inputs
|
|
153
153
|
js_options[:allowClear] = (options[:multiple] != true)
|
154
154
|
js_options[:tags] = (options[:tags] == true)
|
155
155
|
js_options[:tokenSeparators] = nil if options[:tags] != true
|
156
|
+
js_options[:template] = options[:template] if options[:template].present?
|
156
157
|
|
157
158
|
# select2 doesn't support adding css classes to its input, so we support it through the
|
158
159
|
# js_options[:containerClass] and js_options[:dropdownClass] methods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_form_inputs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -47,7 +47,6 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- MIT-LICENSE
|
49
49
|
- README.md
|
50
|
-
- Rakefile
|
51
50
|
- app/assets/javascripts/effective_ckeditor_text_area/initialize.js.coffee
|
52
51
|
- app/assets/javascripts/effective_ckeditor_text_area/input.js
|
53
52
|
- app/assets/javascripts/effective_date_picker/initialize.js.coffee
|
data/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
begin
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
|
8
|
-
# Testing tasks
|
9
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
10
|
-
load 'rails/tasks/engine.rake'
|
11
|
-
|
12
|
-
Bundler::GemHelper.install_tasks
|
13
|
-
|
14
|
-
require 'rspec/core'
|
15
|
-
require 'rspec/core/rake_task'
|
16
|
-
|
17
|
-
desc "Run all specs in spec directory (excluding plugin specs)"
|
18
|
-
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
19
|
-
|
20
|
-
task :default => :spec
|