activeadmin_active_resource 0.1.0 → 0.1.1
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 +12 -5
- data/lib/activeadmin/active_resource/engine.rb +6 -2
- data/lib/activeadmin/active_resource/results.rb +18 -14
- data/lib/activeadmin/active_resource/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 693924c691a6662812b9272be525e0749137b642
|
4
|
+
data.tar.gz: 7351de5cb82fc67a7acb6cf0ab42f3e81c7e4798
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b14cee7688627c7865e484161a3b1ccf86ef9c3b8d0f3f6873690647c7454f7c3af2f622a36e7d772b84bc159deee89d80cb6eaaeac6bb624776281790c4eb71
|
7
|
+
data.tar.gz: eccbba12431224eb4d96c9f36c5de219bdc2b54ade4f505ab951035a5199e6048475307916f27fe19808c36445bcfd290fd75fd84d257253eabb866ede8176bb
|
data/README.md
CHANGED
@@ -6,15 +6,17 @@ Data is fetched from an external API.
|
|
6
6
|
|
7
7
|
WARNING: this component is a Beta version, some Active Admin functionalities don't work as expected:
|
8
8
|
|
9
|
-
- Batch Action: not
|
9
|
+
- Batch Action: not supported
|
10
10
|
- Filters: partially supported (see example)
|
11
11
|
- Edit: fields must be configured explicitly
|
12
|
+
- Comments: not supported
|
12
13
|
|
13
14
|
## Install
|
14
15
|
|
15
16
|
- Add to your Gemfile:
|
16
17
|
`gem 'activeadmin_active_resource'`
|
17
18
|
- Execute bundle
|
19
|
+
- Disable comments in active_admin config initializer
|
18
20
|
|
19
21
|
## Example
|
20
22
|
|
@@ -43,26 +45,31 @@ end
|
|
43
45
|
|
44
46
|
```rb
|
45
47
|
ActiveAdmin.register Post do
|
46
|
-
|
48
|
+
config.batch_actions = false
|
47
49
|
|
48
|
-
filter :title_cont
|
50
|
+
filter :title_cont # Ransack postfixes required (_eq, _cont, etc.)
|
49
51
|
|
50
52
|
controller do
|
51
53
|
def permitted_params
|
52
|
-
params.permit!
|
54
|
+
params.permit! # Just to make things easier :)
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
56
58
|
form do |f|
|
57
59
|
f.inputs do
|
58
|
-
f.input :id, as: :hidden unless f.object.new_record?
|
60
|
+
f.input :id, as: :hidden unless f.object.new_record? # Required
|
59
61
|
f.input :title
|
62
|
+
# ... other fields
|
60
63
|
end
|
61
64
|
f.actions
|
62
65
|
end
|
63
66
|
end
|
64
67
|
```
|
65
68
|
|
69
|
+
## Notes
|
70
|
+
|
71
|
+
If you create a new rails project don't use *--skip-active-record*
|
72
|
+
|
66
73
|
## Do you like it? Star it!
|
67
74
|
|
68
75
|
If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'active_admin'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module ActiveAdmin
|
4
|
+
module ActiveResource
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
engine_name 'activeadmin_active_resource'
|
7
|
+
end
|
8
|
+
end
|
5
9
|
end
|
6
10
|
|
7
11
|
::ActiveResource::Base.class_eval do
|
@@ -1,19 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module ActiveAdmin
|
2
|
+
module ActiveResource
|
3
|
+
class Results < ::ActiveResource::Collection
|
4
|
+
attr_accessor :current_page, :limit_value, :total_count, :total_pages
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
def initialize( elements = [] )
|
7
|
+
super elements
|
8
|
+
@limit_value = ActiveAdmin.application.default_per_page
|
9
|
+
@total_count = 0
|
10
|
+
@total_pages = 1
|
11
|
+
@current_page = 1
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
def except( *params )
|
15
|
+
self
|
16
|
+
end
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
+
def group_values
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|