0.0
No release in over 3 years
Low commit activity in last 3 years
AdminInvitable includes a generator to make devise invitable gem work with ActiveAdmin.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

Admin Invitable

Gem Version Coverage Status

Admin Invitable is a gem that allows devise invitable gem to work with ActiveAdmin 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...

gem "admin_invitable"

Then, run the installer:

$ 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...

$ rails generate devise_invitable Admin

Then, somewhere in your code, a super admin will have access to perform:

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 Admins and Clients you will need to generate views for clients like this:

$ 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!

Platanus

Admin Invitable is maintained by platanus.

License

Admin Invitable is © 2021 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.