muck-invites 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -1
- data/VERSION +1 -1
- data/app/controllers/muck/invites_controller.rb +13 -21
- data/app/views/invites/{_get_contacts.html.erb → _get_contacts.erb} +1 -1
- data/app/views/invites/get_contacts.html.erb +1 -0
- data/app/views/invites/get_contacts.js.erb +14 -0
- data/app/views/invites/{new.html.erb → new.erb} +3 -22
- data/lib/active_record/acts/muck_invite.rb +0 -1
- data/lib/active_record/acts/muck_inviter.rb +1 -1
- data/muck-invites.gemspec +6 -4
- metadata +7 -5
data/README.rdoc
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
Make it easy to let users invite other users.
|
3
3
|
|
4
4
|
== Setup
|
5
|
+
Be sure to include muck.js:
|
6
|
+
<%= javascript_include_tag %w{ muck.js } %>
|
7
|
+
|
8
|
+
Include a link to initialize the invite process. You might want to do this in a lightbox.
|
9
|
+
<%= link_to 'Invite Your Friends', new_invite_path, :class => 'invite_box' %>
|
5
10
|
|
6
11
|
=== Inviter model
|
7
12
|
Add 'acts_as_muck_inviter' to the class that you wish to have do the inviting. This is commonly the user model, but
|
@@ -36,4 +41,4 @@ Create an Invite model:
|
|
36
41
|
end
|
37
42
|
|
38
43
|
|
39
|
-
Copyright (c) 2009 Tatemae.com, released under the MIT license
|
44
|
+
Copyright (c) 2009-2010 Tatemae.com, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -1,38 +1,36 @@
|
|
1
1
|
class Muck::InvitesController < ApplicationController
|
2
|
-
|
3
2
|
unloadable
|
4
|
-
|
5
3
|
before_filter :login_required
|
6
|
-
|
4
|
+
|
7
5
|
def new
|
8
6
|
flash.discard
|
9
7
|
@page_title = t('muck.invites.new_invites', :app_name => GlobalConfig.application_name)
|
10
8
|
respond_to do |format|
|
11
9
|
format.html { render :template => 'invites/new' }
|
12
10
|
format.pjs { render :template => 'invites/new', :layout => false }
|
11
|
+
format.js { render :template => 'invites/new', :layout => false }
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
def get_contacts
|
17
|
-
success = true
|
16
|
+
@success = true
|
18
17
|
begin
|
19
18
|
@contacts = User.get_contacts(params[:get_contacts][:email], params[:get_contacts][:password])
|
20
19
|
if @contacts.blank?
|
21
|
-
message = t('muck.invites.no_contacts_found')
|
22
|
-
success = false
|
20
|
+
@message = t('muck.invites.no_contacts_found')
|
21
|
+
@success = false
|
23
22
|
end
|
24
23
|
rescue Contacts::AuthenticationError => ex
|
25
|
-
success = false
|
26
|
-
message = ex.to_s
|
24
|
+
@success = false
|
25
|
+
@message = ex.to_s
|
27
26
|
end
|
28
27
|
respond_to do |format|
|
29
28
|
format.html do
|
30
|
-
flash[:error] = message if message
|
31
|
-
render :template => 'invites/
|
32
|
-
end
|
33
|
-
format.json do
|
34
|
-
render :json => { :success => success, :message => message, :html => get_contacts_html }
|
29
|
+
flash[:error] = @message if @message
|
30
|
+
render :template => 'invites/get_contacts'
|
35
31
|
end
|
32
|
+
format.json { render :json => { :success => @success, :message => @message, :contacts => @contacts.as_json } }
|
33
|
+
format.js { render :template => 'invites/get_contacts', :layout => false }
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
@@ -47,6 +45,7 @@ class Muck::InvitesController < ApplicationController
|
|
47
45
|
redirect_to('/')
|
48
46
|
end
|
49
47
|
format.pjs { render :text => message }
|
48
|
+
format.js { render :text => message }
|
50
49
|
end
|
51
50
|
|
52
51
|
rescue ActiveRecord::RecordInvalid => ex
|
@@ -59,15 +58,8 @@ class Muck::InvitesController < ApplicationController
|
|
59
58
|
respond_to do |format|
|
60
59
|
format.html { render :template => 'invites/new' }
|
61
60
|
format.pjs { render :template => 'invites/new', :layout => false }
|
61
|
+
format.js { render :template => 'invites/new', :layout => false }
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
protected
|
66
|
-
|
67
|
-
def get_contacts_html
|
68
|
-
render_as_html do
|
69
|
-
render_to_string(:partial => 'invites/get_contacts')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
65
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= output_errors(t('muck.invites.problem_adding_invite'), {:class => 'help-box'}, @invite) %>
|
2
2
|
<% if !@contacts.blank? -%>
|
3
|
-
<% custom_form_for(:invite_contacts, :url => {:action => 'create'}, :html => {:id => "invite-contacts-form", :name => 'invite-contacts-form'} ) do |f| -%>
|
3
|
+
<% custom_form_for(:invite_contacts, :url => {:action => 'create'}, :html => {:id => "invite-contacts-form", :name => 'invite-contacts-form', :class => 'ajax'} ) do |f| -%>
|
4
4
|
<div id="contact-chooser">
|
5
5
|
<div id="contact-chooser-list">
|
6
6
|
<fieldset>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => 'invites/get_contacts' %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
jQuery("#contacts-loading").hide();
|
2
|
+
<% if @success -%>
|
3
|
+
jQuery("#contacts-chooser-wrapper").html("<%=escape_javascript(render(:partial => 'invites/get_contacts'))%>");
|
4
|
+
jQuery("#contacts-chooser-wrapper").show();
|
5
|
+
apply_ajax_forms();
|
6
|
+
<% else -%>
|
7
|
+
<% if GlobalConfig.growl_enabled -%>
|
8
|
+
jQuery.jGrowl.info(json.message);
|
9
|
+
<% else -%>
|
10
|
+
jQuery("#notice-error").html('<%=escape_javascript(@message)%>');
|
11
|
+
jQuery("#notice-error").show();
|
12
|
+
<% end -%>
|
13
|
+
jQuery("#get-contacts-form").show();
|
14
|
+
<% end -%>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<div id="get-contacts-form">
|
5
5
|
<% custom_form_for(:get_contacts, :url => get_contacts_invites_path,
|
6
6
|
:html => {:id => "get-contacts-form", :name => 'get-contacts-form',
|
7
|
-
:class => 'get-contacts-form', :autocomplete => 'off'} ) do |f| -%>
|
7
|
+
:class => 'ajax get-contacts-form', :autocomplete => 'off'} ) do |f| -%>
|
8
8
|
<%= f.text_field :email, { :label => t('muck.invites.your_email'),
|
9
9
|
:tip => t('muck.invites.your_email_help')} -%>
|
10
10
|
<%= f.password_field :password, { :label => t('muck.invites.email_password'),
|
@@ -25,26 +25,7 @@ jQuery(document).ready(function() {
|
|
25
25
|
jQuery("#get-contacts-form").hide();
|
26
26
|
jQuery("#contacts-loading").show();
|
27
27
|
jQuery("#notice-error").hide();
|
28
|
-
var form = jQuery(this).parents('form');
|
29
|
-
jQuery.post(form.attr('action'), form.serialize() + '&format=json',
|
30
|
-
function(data){
|
31
|
-
var json = eval('(' + data + ')');
|
32
|
-
jQuery("#contacts-loading").hide();
|
33
|
-
if(!json.success){
|
34
|
-
<% if GlobalConfig.growl_enabled -%>
|
35
|
-
jQuery.jGrowl.info(json.message);
|
36
|
-
<% else -%>
|
37
|
-
jQuery("#notice-error").html(json.message);
|
38
|
-
jQuery("#notice-error").show();
|
39
|
-
jQuery("#get-contacts-form").show();
|
40
|
-
<% end -%>
|
41
|
-
} else {
|
42
|
-
jQuery("#contacts-chooser-wrapper").html(json.html);
|
43
|
-
jQuery("#contacts-chooser-wrapper").show();
|
44
|
-
}
|
45
|
-
});
|
46
|
-
return false;
|
47
28
|
});
|
29
|
+
apply_ajax_forms();
|
48
30
|
});
|
49
|
-
</script>
|
50
|
-
|
31
|
+
</script>
|
@@ -19,7 +19,6 @@ module ActiveRecord
|
|
19
19
|
named_scope :by_oldest, :order => "created_at ASC"
|
20
20
|
named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
|
21
21
|
|
22
|
-
|
23
22
|
include ActiveRecord::Acts::MuckInvite::InstanceMethods
|
24
23
|
extend ActiveRecord::Acts::MuckInvite::SingletonMethods
|
25
24
|
|
data/muck-invites.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-invites}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball, Joel Duffin"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-22}
|
13
13
|
s.description = %q{The invite engine for the muck system.}
|
14
14
|
s.email = %q{justin@tatemae.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,8 +27,10 @@ Gem::Specification.new do |s|
|
|
27
27
|
"app/views/invite_mailer/invite_notification.text.plain.erb",
|
28
28
|
"app/views/invite_mailer/invited_joined_notification.text.html.erb",
|
29
29
|
"app/views/invite_mailer/invited_joined_notification.text.plain.erb",
|
30
|
-
"app/views/invites/_get_contacts.
|
31
|
-
"app/views/invites/
|
30
|
+
"app/views/invites/_get_contacts.erb",
|
31
|
+
"app/views/invites/get_contacts.html.erb",
|
32
|
+
"app/views/invites/get_contacts.js.erb",
|
33
|
+
"app/views/invites/new.erb",
|
32
34
|
"config/muck_invites_routes.rb",
|
33
35
|
"db/migrate/20090928213532_create_invites.rb",
|
34
36
|
"db/migrate/20091128170318_make_invites_polymorphic.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Justin Ball, Joel Duffin
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-22 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -61,8 +61,10 @@ files:
|
|
61
61
|
- app/views/invite_mailer/invite_notification.text.plain.erb
|
62
62
|
- app/views/invite_mailer/invited_joined_notification.text.html.erb
|
63
63
|
- app/views/invite_mailer/invited_joined_notification.text.plain.erb
|
64
|
-
- app/views/invites/_get_contacts.
|
65
|
-
- app/views/invites/
|
64
|
+
- app/views/invites/_get_contacts.erb
|
65
|
+
- app/views/invites/get_contacts.html.erb
|
66
|
+
- app/views/invites/get_contacts.js.erb
|
67
|
+
- app/views/invites/new.erb
|
66
68
|
- config/muck_invites_routes.rb
|
67
69
|
- db/migrate/20090928213532_create_invites.rb
|
68
70
|
- db/migrate/20091128170318_make_invites_polymorphic.rb
|