after a new user signs up, nag them to invite someone

This commit is contained in:
joshua stein 2013-02-22 14:52:22 -06:00
parent 87cb2cb45b
commit de1dc1d430
7 changed files with 67 additions and 29 deletions

View file

@ -20,6 +20,10 @@ class InvitationsController < ApplicationController
"address is valid."
end
return redirect_to "/settings"
if params[:return_home]
return redirect_to "/"
else
return redirect_to "/settings"
end
end
end

View file

@ -45,7 +45,7 @@ class SignupController < ApplicationController
Countinual.count!("lobsters.users.created", "+1")
return redirect_to "/"
return redirect_to "/users/invite"
else
render :action => "invited"
end

View file

@ -1,4 +1,6 @@
class UsersController < ApplicationController
before_filter :require_logged_in_user, :only => :invite
def show
@showing_user = User.find_by_username!(params[:id])
@title = "User #{@showing_user.username}"
@ -34,4 +36,8 @@ class UsersController < ApplicationController
@tree
end
def invite
@title = "Pass Along an Invitation"
end
end

View file

@ -138,28 +138,5 @@
Invite a New User
</div>
<%= form_tag "/invitations", :method => :post do |f| %>
<p>
Invitations are used as a spam-control mechanism and are unlimited.
Persons you invite will be associated with your account in the <a
href="/u">user tree</a> and you may be responsible for them if they cause
problems. Please use your discretion when inviting persons you don't
personally know.
</p>
<div class="boxline">
<%= label_tag :email, "E-mail Address:", :class => "required" %>
<%= text_field_tag :email, "", :size => 30 %>
</div>
<div class="boxline">
<%= label_tag :memo, "Memo to User:", :class => "required" %>
<%= text_field_tag :memo, "", :size => 60 %>
</div>
<div class="boxline">
<p></p>
<%= submit_tag "Send Invitation" %>
</div>
<% end %>
<%= render :partial => "users/invitationform" %>
</div>

View file

@ -0,0 +1,28 @@
<p>
Invitations are unlimited, but persons you invite will be associated with your
account in the <a href="/u">user tree</a> and you may be responsible for them
if they cause problems. Please use your discretion when inviting persons you
don't personally know.
</p>
<%= form_tag "/invitations", :method => :post do |f| %>
<% if defined?(return_home) && return_home %>
<%= hidden_field_tag :return_home, 1 %>
<% end %>
<div class="boxline">
<%= label_tag :email, "E-mail Address:", :class => "required" %>
<%= text_field_tag :email, "", :size => 30 %>
</div>
<div class="boxline">
<%= label_tag :memo, "Memo to User:", :class => "required" %>
<%= text_field_tag :memo, "", :size => 60 %>
</div>
<div class="boxline">
<p></p>
<%= submit_tag "Send Invitation" %>
</div>
<% end %>

View file

@ -0,0 +1,21 @@
<div class="box wide">
<div class="legend">
Pass Along an Invitation
</div>
<p>
This community can only grow when members invite new users, just as <a
href="/u/<%= @user.invited_by_user.try(:username) %>"><%=
@user.invited_by_user.try(:username) %></a> invited you. Take a moment and
invite someone you know.
</p>
<%= render :partial => "users/invitationform",
:locals => { :return_home => true } %>
or
<p>
<%= button_to "Skip", "/" %>
</p>
</div>

View file

@ -69,15 +69,17 @@ Lobsters::Application.routes.draw do
get "/u" => "users#tree"
get "/u/:id" => "users#show"
get "/users/invite" => "users#invite"
get "/settings" => "settings#index"
post "/settings" => "settings#update"
get "/filters" => "filters#index"
post "/filters" => "filters#update"
post "/invitations" => "invitations#create"
get "/invitations/:invitation_code" => "signup#invited"
get "/moderations" => "moderations#index"
get "/moderations/page/:page" => "moderations#index"
end