ransack_ui 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTM1OTZhOTNhN2Y2Y2NhODdhMzdkMjI5ZjFjODM1YzM2MmI2N2Y3ZA==
5
- data.tar.gz: !binary |-
6
- ZDI3Yjc0OTJhM2E4ODcxODBlMTI1ZWIxODJlODk4MTY3OWFlZmRlZQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MGYzNGQzNjVmOGFlYzc4Njc5YjA3MDc1M2Q3ZDcyMWI2YWIwZjFjZTk3ODJl
10
- NzY5Njk1NWZhNmY1YzNmY2ZjYmY1YWQ5YzYzOTVlNzNlNzM3MWFkNmQ4NDdj
11
- M2NjNTQwMDg0YjE2NjdmOWU1N2Y0NjBlYWRhNjVkMDA3OGVlYjA=
12
- data.tar.gz: !binary |-
13
- YjAxYzBlNTEyOWM4ZjliODY2OTRhZmU0YzM1Y2NlMTYxZjY1ZGYzZjcyMjU3
14
- YzIyNWE4ZGQzNzdmNWFkMTFjMmI5MGJlMjViZGYyYmI4ZjdhY2VmZDM4ZGJm
15
- Nzk0YjAwYjA1OTAwOGNlZmFkMjYxNGM5OTFlOTYwNDY5NmU2MDk=
2
+ SHA1:
3
+ metadata.gz: fca5c975664cbf3a9711ce5addd629766bc27a45
4
+ data.tar.gz: f6a49dbd6dc451b6f5cab76c75d7566d4eaea04f
5
+ SHA512:
6
+ metadata.gz: fec6dbdcfd2667fd01ffbf82ab2fa7b5453534a3e2fcd3a8fac128ffe6a1354d8096394fa5f84b5ccd6e3e33e55a22087aa28d02fcf539ea58389f075d6e84e9
7
+ data.tar.gz: 95e4b7f30d73bf274b397c1888fcf8ff3839061a5a5a36da1b1c1d7bf16ac058c38d54f644c38a9140935b9d93383b64c069fff2b4a62a9834f838515b939ee2
@@ -37,6 +37,9 @@ module RansackUI
37
37
  end
38
38
  end
39
39
 
40
+ def ransortable_attributes(auth_object = nil)
41
+ ransackable_attributes(auth_object).map(&:first)
42
+ end
40
43
  end
41
44
  end
42
45
  end
@@ -184,7 +184,7 @@ module Ransack
184
184
 
185
185
  if foreign_klass
186
186
  # If field is a foreign key, set up 'data-ajax-*' attributes for auto-complete
187
- controller = foreign_klass.tableize
187
+ controller = ActiveSupport::Inflector::tableize(foreign_klass.to_s)
188
188
  html_options[:'data-ajax-entity'] = I18n.translate(controller, :default => controller)
189
189
  if ajax_options[:url]
190
190
  html_options[:'data-ajax-url'] = ajax_options[:url].sub(':controller', controller)
@@ -227,7 +227,8 @@ module Ransack
227
227
  if column == 'id'
228
228
  foreign_klass = object.context.traverse(base).model_name
229
229
  # Check that model can autocomplete. If not, skip this id column.
230
- next nil unless foreign_klass.constantize._ransack_can_autocomplete
230
+ next nil unless ActiveSupport::Inflector::constantize(foreign_klass.to_s)._ransack_can_autocomplete
231
+
231
232
  attribute_label = I18n.translate(foreign_klass, :default => foreign_klass)
232
233
  else
233
234
  foreign_klass = foreign_keys[column.to_sym]
@@ -0,0 +1,13 @@
1
+ require 'ransack/nodes/attribute'
2
+
3
+ module Ransack
4
+ module Nodes
5
+ Attribute.class_eval do
6
+ def valid?
7
+ bound? && attr &&
8
+ context.klassify(parent).ransackable_attributes(context.auth_object)
9
+ .map(&:first).include?(attr_name)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module RansackUI
2
- VERSION = "1.2.2"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Broadbent
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-20 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ransack_chronic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ransack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Framework for building a search UI with Ransack
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -73,6 +73,7 @@ files:
73
73
  - lib/ransack_ui/ransack_overrides/configuration.rb
74
74
  - lib/ransack_ui/ransack_overrides/context.rb
75
75
  - lib/ransack_ui/ransack_overrides/helpers/form_builder.rb
76
+ - lib/ransack_ui/ransack_overrides/nodes/attribute.rb
76
77
  - lib/ransack_ui/ransack_overrides/nodes/condition.rb
77
78
  - lib/ransack_ui/ransack_overrides/nodes/grouping.rb
78
79
  - lib/ransack_ui/version.rb
@@ -88,17 +89,17 @@ require_paths:
88
89
  - lib
89
90
  required_ruby_version: !ruby/object:Gem::Requirement
90
91
  requirements:
91
- - - ! '>='
92
+ - - ">="
92
93
  - !ruby/object:Gem::Version
93
94
  version: '0'
94
95
  required_rubygems_version: !ruby/object:Gem::Requirement
95
96
  requirements:
96
- - - ! '>='
97
+ - - ">="
97
98
  - !ruby/object:Gem::Version
98
99
  version: '0'
99
100
  requirements: []
100
101
  rubyforge_project:
101
- rubygems_version: 2.0.3
102
+ rubygems_version: 2.2.2
102
103
  signing_key:
103
104
  specification_version: 4
104
105
  summary: UI Builder for Ransack