ransack_ui 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,6 +58,7 @@
58
58
  query_input.select2
59
59
  placeholder: "Search #{selected.data('ajax-entity')}"
60
60
  minimumInputLength: 1
61
+ allowClear: true
61
62
  ajax:
62
63
  url: selected.data('ajax-url')
63
64
  dataType: 'json'
@@ -148,10 +149,14 @@
148
149
  placeholder: "Select a Field"
149
150
  allowClear: true
150
151
  formatSelection: (object, container) ->
151
- # Return model name if column is AJAX auto-completed association
152
- if $(object.element).data('ajax-url')
152
+ # Return 'Model: field' if column is not on base model
153
+ if $(object.element).data('base')
153
154
  object.text
154
- # Return 'Model: field' if regular column
155
155
  else
156
- $(object.element).parent().attr('label') + ': ' + object.text
156
+ group_label = $(object.element).parent().attr('label')
157
+ # Avoid labels like 'Contact: Contact'
158
+ if group_label == object.text
159
+ object.text
160
+ else
161
+ $(object.element).parent().attr('label') + ': ' + object.text
157
162
  ) jQuery
@@ -80,6 +80,8 @@ module Ransack
80
80
 
81
81
  # Add column type as data attribute
82
82
  html_options = {:'data-type' => type}
83
+ # Set 'base' attribute if attribute is on base model
84
+ html_options[:'data-base'] = true if base.blank?
83
85
 
84
86
  if foreign_klass
85
87
  # If field is a foreign key, set up 'data-ajax-*' attributes for auto-complete
@@ -1,3 +1,3 @@
1
1
  module RansackUI
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -58,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  segments:
60
60
  - 0
61
- hash: 739364888355864408
61
+ hash: -11773573269345332
62
62
  required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  segments:
69
69
  - 0
70
- hash: 739364888355864408
70
+ hash: -11773573269345332
71
71
  requirements: []
72
72
  rubyforge_project:
73
73
  rubygems_version: 1.8.24