effective_form_inputs 1.1.2 → 1.1.3
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 +4 -4
- data/README.md +15 -1
- data/app/assets/javascripts/effective_panel_select/effective_panel_select.js.coffee +3 -3
- data/app/assets/stylesheets/effective_panel_select/input.scss +1 -2
- data/app/models/inputs/effective_panel_select/input.rb +1 -2
- data/app/views/effective/effective_panel_select/_input.html.haml +5 -5
- data/lib/effective_form_inputs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5c0536cee968b16df4fc40420a6382534593b1b
|
|
4
|
+
data.tar.gz: 7508dbdfb18e1339156a8b4016eb9132866ae54b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e1e529cabc60dd5e87fa49c0ab37fd76e9bb12ebb6039b5d8071d5d07dbd842443a598f22c827ea628a903b735fb7ded7af86df9649d1378a4c3c09b96ccd05
|
|
7
|
+
data.tar.gz: fdc9d57dc9f91b327b57889828c731e8fc9b7b86ef4ace3f5976f2f25649bd2f5cfeb1997aa44244832bf84612c2920b707590dedb47610cc96d992d99688b95
|
data/README.md
CHANGED
|
@@ -384,7 +384,7 @@ and add the following to your application.css:
|
|
|
384
384
|
|
|
385
385
|
### Usage
|
|
386
386
|
|
|
387
|
-
As a Rails
|
|
387
|
+
As a Rails form helper input:
|
|
388
388
|
|
|
389
389
|
```ruby
|
|
390
390
|
= form_for @user do |f|
|
|
@@ -398,6 +398,12 @@ and as a SimpleForm input:
|
|
|
398
398
|
= f.input :category, as: :effective_panel_select, collection: categories_collection
|
|
399
399
|
```
|
|
400
400
|
|
|
401
|
+
By default, the left sidebar uses the .nav-stacked class. You can customize this by passing the sidebar_class option to the helper input:
|
|
402
|
+
|
|
403
|
+
```ruby
|
|
404
|
+
= f.input :category, as: :effective_panel_select, collection: categories_collection, sidebar_class: 'your-custom-class'
|
|
405
|
+
```
|
|
406
|
+
|
|
401
407
|
### Collection
|
|
402
408
|
|
|
403
409
|
The collection is the same as a grouped select collection:
|
|
@@ -748,6 +754,14 @@ Call with `single_selected: true` to ensure only the first selected option tag w
|
|
|
748
754
|
|
|
749
755
|
This can be useful when displaying multiple options with an identical value.
|
|
750
756
|
|
|
757
|
+
### Clear value
|
|
758
|
+
|
|
759
|
+
It's a bit tricky to clear the selected value
|
|
760
|
+
|
|
761
|
+
```coffeescript
|
|
762
|
+
$('select').val('').trigger('change.select2')
|
|
763
|
+
```
|
|
764
|
+
|
|
751
765
|
### Working with dynamic options
|
|
752
766
|
|
|
753
767
|
The following information applies to `effective_select` only, and is not part of the standard select2 API.
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
reset: ->
|
|
140
140
|
value = @val()
|
|
141
141
|
|
|
142
|
-
@fetched.children(':not(.
|
|
142
|
+
@fetched.children(':not(.effective-panel-select-actions)').remove() if @fetched && @fetched.length && !@options.keepFetched
|
|
143
143
|
|
|
144
144
|
@selector.find("li.selected").removeClass('selected')
|
|
145
145
|
@selector.find('.active').removeClass('active')
|
|
@@ -173,9 +173,9 @@
|
|
|
173
173
|
@fetched.append(fetched)
|
|
174
174
|
|
|
175
175
|
@fetched.parent().find('.active').removeClass('active')
|
|
176
|
-
@fetched.addClass('active').children(':not(.
|
|
176
|
+
@fetched.addClass('active').children(':not(.effective-panel-select-actions)').hide()
|
|
177
177
|
fetched.show()
|
|
178
|
-
@fetched.children('.
|
|
178
|
+
@fetched.children('.effective-panel-select-actions').find('.fetched-select').data('item-value', value)
|
|
179
179
|
|
|
180
180
|
url: (value) ->
|
|
181
181
|
return unless @options.ajax && @options.ajax.url.length
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
.tab-content { padding-top: 0px; }
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.tab-pane.fetched { padding
|
|
18
|
+
.tab-pane.fetched { padding: 15px 15px 15px 0; }
|
|
19
19
|
|
|
20
20
|
.selection {
|
|
21
21
|
width: 100%;
|
|
22
|
-
font-family: "Open Sans", sans-serif;
|
|
23
22
|
font-size: 14px;
|
|
24
23
|
cursor: pointer;
|
|
25
24
|
}
|
|
@@ -10,7 +10,7 @@ module Inputs
|
|
|
10
10
|
delegate :grouped_collection_select, :hidden_field_tag, :text_field_tag, :render, to: :@template
|
|
11
11
|
|
|
12
12
|
def default_options
|
|
13
|
-
{ label_method: :to_s, value_method: :to_s, group_label_method: :first, group_method: :second, option_value_method: :first, option_key_method: :second }
|
|
13
|
+
{ label_method: :to_s, value_method: :to_s, group_label_method: :first, group_method: :second, option_value_method: :first, option_key_method: :second, sidebar_class: 'nav-stacked' }
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def default_input_js
|
|
@@ -101,7 +101,6 @@ module Inputs
|
|
|
101
101
|
collection.respond_to?(:call) ? collection.call : collection.to_a
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
|
-
|
|
105
104
|
end
|
|
106
105
|
end
|
|
107
106
|
end
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
%span.selection-clear x
|
|
8
8
|
%span.selection-label= input.option_label
|
|
9
9
|
- else
|
|
10
|
-
%span.selection-placeholder Please
|
|
10
|
+
%span.selection-placeholder Please choose
|
|
11
|
+
|
|
11
12
|
%span.selection-arrow
|
|
12
13
|
%b
|
|
13
14
|
|
|
14
15
|
.selector
|
|
15
16
|
.row
|
|
16
17
|
.col-sm-4
|
|
17
|
-
%ul.nav.nav-pills
|
|
18
|
+
%ul.nav.nav-pills{role: 'tablist', class: input.options[:sidebar_class]}
|
|
18
19
|
- input.collection.each do |group, items|
|
|
19
20
|
- group_label = group.send(input.options[:group_label_method])
|
|
20
21
|
- group_value = group.send(input.options[:group_method])
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
= group_label
|
|
25
26
|
- if input.show_count?
|
|
26
27
|
%span.badge= items.length
|
|
28
|
+
|
|
27
29
|
.col-sm-8
|
|
28
30
|
.tab-content
|
|
29
31
|
- input.collection.each do |group, items|
|
|
@@ -31,8 +33,6 @@
|
|
|
31
33
|
- group_value = group.send(input.options[:group_method])
|
|
32
34
|
|
|
33
35
|
.tab-pane{id: group_value.parameterize, class: ('active' if group_value == input.group_value) }
|
|
34
|
-
%p #{group_label}:
|
|
35
|
-
|
|
36
36
|
%ul.nav.nav-pills.nav-stacked
|
|
37
37
|
- Array(items).each do |item|
|
|
38
38
|
- item_value = item.send(input.options[:option_key_method])
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
- if input.ajax?
|
|
47
47
|
.tab-pane.fetched
|
|
48
|
-
.
|
|
48
|
+
.row.effective-panel-select-actions
|
|
49
49
|
.col-xs-6
|
|
50
50
|
.btn.btn-default.fetched-clear Back
|
|
51
51
|
.col-xs-6.text-right
|
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.3
|
|
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-06-
|
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|