https://github.com/platanus/admin-invitable
Gem to use devise invitable with ActiveAdmin.
https://github.com/platanus/admin-invitable
activeadmin
Last synced: 9 months ago
JSON representation
Gem to use devise invitable with ActiveAdmin.
- Host: GitHub
- URL: https://github.com/platanus/admin-invitable
- Owner: platanus
- License: mit
- Created: 2015-03-20T13:39:43.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T19:43:22.000Z (about 3 years ago)
- Last Synced: 2025-04-12T06:05:50.830Z (12 months ago)
- Topics: activeadmin
- Language: Ruby
- Size: 126 KB
- Stars: 10
- Watchers: 12
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
Admin Invitable
===============
[](https://badge.fury.io/rb/admin_invitable)
[](https://coveralls.io/github/platanus/admin-invitable)
Admin Invitable is a gem that allows [devise invitable gem](https://github.com/scambra/devise_invitable) to work with [ActiveAdmin](http://activeadmin.info) nicely.
To clarify, the common use will be super administrators inviting administrators with less privileges.
## Installation
Add to your Gemfile and install the following gems...
```ruby
gem "admin_invitable"
```
Then, run the installer:
```shell
$ rails generate admin_invitable:install
```
This will copy the following files:
* `your_app/app/views/devise/invitations/edit.html.erb`. This is the form that will be used to change the password (this form uses Active Admin helpers and styles)
* `your_app/app/views/devise/mailer/invitation_instructions.html.erb`. Email template that will be sent to invited users.
> You can customize these files if you need.
## Usage
Supposing you want to invite administrators, you need to have an `Admin` model and...
```shell
$ rails generate devise_invitable Admin
```
Then, somewhere in your code, a super admin will have access to perform:
```ruby
Admin.invite!(email: "newadmin@platan.us")
```
This will send the email (`invitation_instructions.html.erb`) to **newclient@platan.us** with a link to the form (`edit.html.erb`). After choosing the password, the admin will by redirected into Active Admin dashboard.
You must kwow this gem uses the devise invitable default path to work with Active Admin. If you want to make "normal" besides "admin" invitations, you need to create custom paths for "normal" resources. For example: if you want to invite `Admin`s and `Client`s you will need to generate views for clients like this:
```shell
$ rails generate devise_invitable:views clients
```
Then, clients will be redirected to the app and administrators to Active Admin.
## Example
If you want to see an example you can:
* Clone the repository
* Run `$ rails s` inside `/admin_invitable/spec/dummy`
* Open browser at `localhost:3000`
## Publishing
On master/main branch...
1. Change `VERSION` in `lib/admin_invitable/version.rb`.
2. Change `Unreleased` title to current version in `CHANGELOG.md`.
3. Run `bundle install`.
4. Commit new release. For example: `Releasing v0.1.0`.
5. Create tag. For example: `git tag v0.1.0`.
6. Push tag. For example: `git push origin v0.1.0`.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Credits
Thank you [contributors](https://github.com/platanus/admin-invitable/graphs/contributors)!

Admin Invitable is maintained by [platanus](http://platan.us).
## License
Admin Invitable is © 2021 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.