administrate_ransack 0.4.1 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/administrate_ransack/searchable.rb +4 -3
- data/lib/administrate_ransack/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 808b679267c3978acf5c8b2224f9606c0104756355a4a2335b9a7e64058e0bbe
|
4
|
+
data.tar.gz: 9093235b9934b14ca35d1f2a6bc1626b813fbf46a5fd3e0794c9a80b3ad15120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9ce500cc3d87e8554b7b36331333c9d666a77c64435f37f1ef0430730a5683c5a62141ec078d6cb3f6a2dd9f9b4eeb49ccc9361a7f48ecae8ea9a0568a39917
|
7
|
+
data.tar.gz: 39cb0c4b850221c566fe764babad3e4a0739cc1667d8b404f2026878988f9b857e087e50a46a73ad4537280eaf4a9f07434d2e7c2e88fa8978af504a0e4cc6f2
|
data/README.md
CHANGED
@@ -99,6 +99,21 @@ end
|
|
99
99
|
|
100
100
|
## Customizations
|
101
101
|
|
102
|
+
- Ransack options can be customized defining a `ransack_options` method in the controller, example:
|
103
|
+
|
104
|
+
```rb
|
105
|
+
module Admin
|
106
|
+
class PostsController < Admin::ApplicationController
|
107
|
+
prepend AdministrateRansack::Searchable
|
108
|
+
|
109
|
+
def ransack_options
|
110
|
+
# raises an exception on unknown parameters
|
111
|
+
{ ignore_unknown_conditions: false }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
```
|
116
|
+
|
102
117
|
- Sample call of the filters partial with different options provided:
|
103
118
|
|
104
119
|
```erb
|
@@ -5,13 +5,14 @@ require 'ransack'
|
|
5
5
|
module AdministrateRansack
|
6
6
|
module Searchable
|
7
7
|
def scoped_resource
|
8
|
-
|
8
|
+
options = respond_to?(:ransack_options) ? ransack_options : {}
|
9
|
+
@ransack_results = super.ransack(params[:q], **options)
|
9
10
|
@ransack_results.result(distinct: true)
|
10
11
|
end
|
11
12
|
|
12
|
-
# ref => https://github.com/thoughtbot/administrate/blob/v0.
|
13
|
+
# ref => https://github.com/thoughtbot/administrate/blob/v0.18.0/app/helpers/administrate/application_helper.rb#L72-L78
|
13
14
|
def sanitized_order_params(page, current_field_name)
|
14
|
-
collection_names = page.
|
15
|
+
collection_names = page.item_associations + [current_field_name]
|
15
16
|
association_params = collection_names.map do |assoc_name|
|
16
17
|
{ assoc_name => %i[order direction page per_page] }
|
17
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate_ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.18'
|
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
|
-
version: '0.
|
26
|
+
version: '0.18'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ransack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: appraisal
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.4'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.4'
|
55
41
|
description: A plugin for Administrate to use Ransack for search filters
|
56
42
|
email:
|
57
43
|
- mat@blocknot.es
|
@@ -102,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
88
|
- !ruby/object:Gem::Version
|
103
89
|
version: '0'
|
104
90
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
91
|
+
rubygems_version: 3.4.19
|
106
92
|
signing_key:
|
107
93
|
specification_version: 4
|
108
94
|
summary: Administrate Ransack plugin
|