diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 80dc7bf..cf415b6 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -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 diff --git a/app/controllers/signup_controller.rb b/app/controllers/signup_controller.rb index f14dba3..889789c 100644 --- a/app/controllers/signup_controller.rb +++ b/app/controllers/signup_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e23f865..58dc5a5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/settings/index.html.erb b/app/views/settings/index.html.erb index a0c8b50..91197fc 100644 --- a/app/views/settings/index.html.erb +++ b/app/views/settings/index.html.erb @@ -138,28 +138,5 @@ Invite a New User - <%= form_tag "/invitations", :method => :post do |f| %> -

- Invitations are used as a spam-control mechanism and are unlimited. - Persons you invite will be associated with your account in the user tree and you may be responsible for them if they cause - problems. Please use your discretion when inviting persons you don't - personally know. -

- -
- <%= label_tag :email, "E-mail Address:", :class => "required" %> - <%= text_field_tag :email, "", :size => 30 %> -
- -
- <%= label_tag :memo, "Memo to User:", :class => "required" %> - <%= text_field_tag :memo, "", :size => 60 %> -
- -
-

- <%= submit_tag "Send Invitation" %> -
- <% end %> + <%= render :partial => "users/invitationform" %> diff --git a/app/views/users/_invitationform.html.erb b/app/views/users/_invitationform.html.erb new file mode 100644 index 0000000..fd74d56 --- /dev/null +++ b/app/views/users/_invitationform.html.erb @@ -0,0 +1,28 @@ +

+Invitations are unlimited, but persons you invite will be associated with your +account in the user tree and you may be responsible for them +if they cause problems. Please use your discretion when inviting persons you +don't personally know. +

+ +<%= form_tag "/invitations", :method => :post do |f| %> + <% if defined?(return_home) && return_home %> + <%= hidden_field_tag :return_home, 1 %> + <% end %> + +
+ <%= label_tag :email, "E-mail Address:", :class => "required" %> + <%= text_field_tag :email, "", :size => 30 %> +
+ +
+ <%= label_tag :memo, "Memo to User:", :class => "required" %> + <%= text_field_tag :memo, "", :size => 60 %> +
+ +
+

+ <%= submit_tag "Send Invitation" %> +
+<% end %> + diff --git a/app/views/users/invite.html.erb b/app/views/users/invite.html.erb new file mode 100644 index 0000000..82b4bf7 --- /dev/null +++ b/app/views/users/invite.html.erb @@ -0,0 +1,21 @@ +
+
+ Pass Along an Invitation +
+ +

+ This community can only grow when members invite new users, just as <%= + @user.invited_by_user.try(:username) %> invited you. Take a moment and + invite someone you know. +

+ + <%= render :partial => "users/invitationform", + :locals => { :return_home => true } %> + + or + +

+ <%= button_to "Skip", "/" %> +

+
diff --git a/config/routes.rb b/config/routes.rb index 6d91a61..398eea7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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