Make it easy to let users invite other users.
Add the gem to your Gemfile:
# Create an initializer to configure settings:
. do |config| config.use_gravatar_in_photo_list = true # The invite list can include photos from gravatar. config.create_activities_when_invited_joins = true # Add an entry to the inviter's activity when the invited joins. config.email_inviters_when_invited_joins = true # Send out an email to the inviter when the invited person joins. end
Be sure to include muck.js:
You can include muck-invites.css or copy and paste the styles and change them as desired:
<%= stylesheet_link_tag 'muck-invites' -%>
Include a link to initialize the invite process. You might want to do this in a lightbox.
The simple version that simply asks for an email and password:
<%= link_to 'Invite Your Friends', new_invite_path, :class => 'invite_box' %>
The better method that uses oauth to talk to email services instead of asking for a password:
<%= link_to 'Invite Friends', compose_invites_path, :class => 'invite_box iframe' %>
The 'invite_box' class will result in the invite showing up in a popup. Remove that class if you want to customize the link to do something else. By default the popup will use the 'popup' layout from muck-engine.
The invite system can use oauth where available to acquire contacts. To enable this functionality install the muck-auth gem:
See the muck-auth gem for more information - github.com/tatemae/muck-auth
Add 'include MuckInvites::Models::MuckInviter' to the class that you wish to have do the inviting. This is commonly the user model, but might also be another model - for example Event.
class User < ActiveRecord::Base acts_as_authentic do |c| c.crypto_provider = Authlogic::CryptoProviders::BCrypt end include MuckUsers::Models::MuckUser include :::: end
class Event < ActiveRecord::Base include :::: end
These models are required for the invite system to function and must be named as specified. Addition functionality can be added to each model as needed.
Create an Invitee model:
class Invitee < ActiveRecord::Base include :::: end
Create an Invite model:
class Invite < ActiveRecord::Base include :::: end
Copyright © 2009-2010 Tatemae.com, released under the MIT license