Invite system for muck
JavaScript Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db/migrate
lib
public/stylesheets
test
.gitignore
Gemfile
MIT-LICENSE
README.rdoc
Rakefile
VERSION
muck-invites.gemspec

README.rdoc

Muck Invites

Make it easy to let users invite other users.

Setup

Add the gem to your Gemfile:

gem 'muck-invites'

Initializer

# Create an initializer to configure settings:

MuckInvites.configure 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

Javascript and CSS

Be sure to include muck.js:

<%= javascript_include_tag %w{ 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.

Oauth

The invite system can use oauth where available to acquire contacts. To enable this functionality install the muck-auth gem:

gem 'muck-auth'

See the muck-auth gem for more information - github.com/tatemae/muck-auth

Inviter model

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 MuckInvites::Models::MuckInviter
end

or

class Event < ActiveRecord::Base
  include MuckInvites::Models::MuckInviter
end

Other models

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 MuckInvites::Models::MuckInvitee
end

Create an Invite model:

class Invite < ActiveRecord::Base
  include MuckInvites::Models::MuckInvite 
end

Copyright © 2009-2010 Tatemae.com, released under the MIT license