administrate_batch_actions 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aad9212d68311a11e3fd64d580a0b10d329cc14c02805f59c1c85587e32c555
4
- data.tar.gz: dc7aa8df9038cc92de28c597be45169cc725026a532dc83a2efa069b83b573cf
3
+ metadata.gz: 8b8b4f2d80b3683b2ddf3d064389ea6743ea7c812cc90b5c81210f0ab34926ec
4
+ data.tar.gz: 2e5844bd5838c30bdbb3ae337cf87d93b8c0b9cf3e4cecaec516611e92995782
5
5
  SHA512:
6
- metadata.gz: 5f3fd76300782922b1a72fc5e05e513ca5c50c112b844779bd8d81eb83300c1ef1604468e4c0394077c3f0f77466cdc6d06e246afa6104c015b9b60a8f941c0e
7
- data.tar.gz: 0e9bee44d6050f25d98f129deb207ad8c6d8d2d3409c0f15f5eb6c9bb411a4aeb6e7862a6287789dce67a3e8df3518c4df5ae47bde23777708a2f31bd11d6a32
6
+ metadata.gz: c22b56f02ec93e6812a33acc572853ade75adf090ecf7c2dd00469c279bdeed3f7ba49bd542190647f51b428fbfa78c235e1f5076e00f591b65571fe0f1aac23
7
+ data.tar.gz: dcad88ea590e8ca5cf640d8848138c342845d8afe2b968536dd2061636df94582309c64e1d009ee9a2f9533e87b5c97f8f80ddf82e509c0e7878fc60ddf5def7
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # AdministrateBatchActions
2
2
 
3
- This gem allows you to quickly embed a UI on resources' list page, by using the UI, you are able to do batch actions, such as batch deletion or batch approval etc.
3
+ This plugin for [Administrate](https://github.com/thoughtbot/administrate) allows you to add batch/bulk actions to your Administrate resources index lists, such as batch deletion or batch approval, etc.
4
4
 
5
- The helper addes checkboxes and batch action button which allows you to integrate some customized actions in `administrate` way.
5
+ The available helpers add individual checkboxes, a 'select all' checkbox and batch action buttons which allow you to integrate custom batch/bulk actions.
6
+
7
+ ## Demo
8
+ ![Aug-21-2021 21-56-48](https://user-images.githubusercontent.com/541665/130339415-c69f4b53-e248-449a-8764-7a854c5b0dcb.gif)
6
9
 
7
10
  ## Installation
8
11
 
@@ -16,7 +19,7 @@ And then execute:
16
19
 
17
20
  $ bundle
18
21
 
19
- Or install it yourself as:
22
+ Or install it yourself:
20
23
 
21
24
  $ gem install administrate_batch_actions
22
25
 
@@ -24,14 +27,25 @@ Or install it yourself as:
24
27
 
25
28
  The gem introduces three helper methods below:
26
29
  ```
27
- administrate_batch_actions_select_all() # renders Select All checkbox
30
+ <%= administrate_batch_actions_select_all() %> # renders Select All checkbox
28
31
  ```
32
+ Insert the helper between the 2 lines in [_collection.html.erb](https://github.com/thoughtbot/administrate/blob/v0.16.0/app/views/administrate/application/_collection.html.erb#L23-L24)
33
+
29
34
  ```
30
- administrate_batch_actions_checkbox(resource.id) # individual row checkbox
35
+ <%= administrate_batch_actions_checkbox(resource.id) %> # individual row checkbox
31
36
  ```
37
+ Insert the helper between the 2 lines in [_collection.html.erb](https://github.com/thoughtbot/administrate/blob/v0.16.0/app/views/administrate/application/_collection.html.erb#L61-L62)
38
+
32
39
  ```
33
- administrate_batch_actions_button(batch_action_name, target_handling_path) # batch action submit button
40
+ <%=
41
+ administrate_batch_actions_button(
42
+ batch_action_name,
43
+ target_handling_path,
44
+ { class: '', confirm: '' }
45
+ )
46
+ %> # batch action submit button with optional `class` and `confirm` message params
34
47
  ```
48
+ Insert the helper between the 2 lines in [_index.html.erb](https://github.com/thoughtbot/administrate/blob/v0.16.0/app/views/administrate/application/index.html.erb#L34)
35
49
 
36
50
  You need to create custom Administrate views and insert the helpers above.
37
51
 
@@ -40,7 +54,7 @@ Afterwards-- define your custom controller actions named as `*_batch_action` e.g
40
54
  * `def approve_batch_action; ...; end`
41
55
  * etc
42
56
 
43
- The gem will auto-generate route entries for controller actions matches to this pattern. For instance-- if I have an action below:
57
+ The gem will auto-generate route entries for controller actions that match this pattern. For instance-- if I have an action below:
44
58
 
45
59
  ```
46
60
  def delete_batch_action
@@ -53,6 +67,7 @@ The gem will auto-generate the following route:
53
67
  ```
54
68
  delete_batch_action_admin_users POST /admin/users/delete_batch_action(.:format) admin/users#delete_batch_action
55
69
  ```
70
+ So you can call the method to display the button like so: `<%= administrate_batch_actions_button('Delete Selected, delete_batch_action_admin_users_path)`
56
71
 
57
72
  ## Development
58
73
 
@@ -62,7 +77,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
62
77
 
63
78
  ## Contributing
64
79
 
65
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/administrate_batch_actions. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
80
+ Bug reports and pull requests are welcome on GitHub at https://github.com/SourceLabsLLC/administrate_batch_actions. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
66
81
 
67
82
  ## License
68
83
 
@@ -70,4 +85,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
70
85
 
71
86
  ## Code of Conduct
72
87
 
73
- Everyone interacting in the AdministrateBatchActions project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/administrate_batch_actions/blob/master/CODE_OF_CONDUCT.md).
88
+ Everyone interacting in the AdministrateBatchActions project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/SourceLabsLLC/administrate_batch_actions/blob/master/CODE_OF_CONDUCT.md).
@@ -1 +1 @@
1
- <%= link_to name, path, class: "button", data: { batch_action_option: 'button', confirm: 'Are you sure to do this?' }, method: :post %>
1
+ <%= link_to name, path, class: html_options[:class], data: { batch_action_option: 'button', confirm: html_options[:confirm] }, method: :post %>
@@ -1,8 +1,8 @@
1
1
  module AdministrateBatchActions
2
2
  module Helpers
3
- def administrate_batch_actions_button(name, path)
3
+ def administrate_batch_actions_button(name, path, html_options = {class: 'button'})
4
4
  render partial: 'shared/administrate_batch_actions/button',
5
- locals: { name: name, path: path }
5
+ locals: { name: name, path: path, html_options: html_options }
6
6
  end
7
7
 
8
8
  def administrate_batch_actions_select_all
@@ -1,3 +1,3 @@
1
1
  module AdministrateBatchActions
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate_batch_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sourcelabs LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-20 00:00:00.000000000 Z
11
+ date: 2021-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler