forked from handcrafted/foundation
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Foundation] Changed profiles, added public profiles, bugfixed, updat…
…ed tests. * Changed profile to not track email, and consequently rewrote referral handling * Fixed invites to work properly * Added friendly_id migration and hooked it up for users * Added options for public profile in the settings * Fixed up specs and features, added new specs for public profiles * Updated the frozen new relic gem * Updated the todo list
- Loading branch information
Showing
185 changed files
with
20,271 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
h1. Todo list | ||
|
||
* Add breadcrumb support | ||
* Add breadcrumb support (AS, please confirm you want this) | ||
* Add invite cucumber features | ||
* User generation with temp passwords | ||
* Remove profiles tab in admin, add referrals tab | ||
* Add admin controller/views generator | ||
* Fix form builder so that it doesn't pass bogus html attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class Referral < ActiveRecord::Base | ||
attr_accessor :email_list | ||
|
||
#Associations | ||
belongs_to :referrer, :class_name => "User", :foreign_key => "referrer_id" | ||
|
||
#Validations | ||
validates_format_of :email_address, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i | ||
validates_uniqueness_of :email_address, :on => :create, :message => "has already been invited to the site" | ||
validates_presence_of :email_text | ||
validate :email_address_isnt_a_user | ||
|
||
#Callbacks | ||
after_create :send_referral_emails | ||
|
||
|
||
private | ||
|
||
def send_referral_emails | ||
ReferralMailer.send_later(:deliver_referral, email_address, email_text) | ||
ReferralMailer.send_later(:deliver_confirmation, referrer.email, email_text) if referrer.email | ||
end | ||
|
||
def email_address_isnt_a_user | ||
errors.add("email_address", "has already signed up for the site") if User.find_by_email(email_address) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
class ReferralMailer < Mailer | ||
|
||
def referral(profile, body) | ||
setup_template('referral', profile.email) do |options| | ||
def referral(email, body) | ||
setup_template('referral', email) do |options| | ||
options['note'] = body | ||
end | ||
end | ||
|
||
def confirmation(profile) | ||
setup_template('confirmation', profile.email) | ||
def confirmation(email) | ||
setup_template('confirmation', email) | ||
end | ||
|
||
def admin_confirmation(profile, referrals) | ||
setup_template('admin_confirmation', SiteSetting.first.admin_email) do |options| | ||
options['referrer'] = profile | ||
options['referrals'] = referrals | ||
end | ||
end | ||
# def admin_confirmation(profile, email_address) | ||
# setup_template('admin_confirmation', SiteSetting.first.admin_email) do |options| | ||
# options['referrer'] = profile | ||
# options['referrals'] = referrals | ||
# end | ||
# end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- form_for(Invite.new, :url => invites_path, :builder => HandcraftedFormBuilder ) do |f| | ||
- field_set_tag do | ||
= f.text_field :email | ||
= f.submit "Request Invite" do | ||
- link_to "Cancel", root_url, :class => "red" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
- if @site.beta_invites? | ||
- if @site.beta_invites? && signed_in? | ||
.notice.invites | ||
.padding | ||
%h4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
#page_header | ||
%h2{:style => "position: relative;"} | ||
= @user.email | ||
- if false#@site.user_avatar_upload? | ||
- if @site.user_avatars? | ||
= image_tag(@user.profile.avatar.url(:thumb), :style => "position: absolute; top: 0; right: 0;") | ||
|
||
#page_body | ||
%p | ||
Click here to | ||
= link_to "edit your account", edit_account_url | ||
- if signed_in? && current_user == @user | ||
Click here to | ||
= link_to "edit your account", edit_account_url | ||
|
||
-if false#@site.beta_invites? | ||
-if @site.beta_invites? && signed_in? | ||
= render :partial => "shared/notice_invites" | ||
= render :partial => "invite" | ||
= render :partial => "invites/invite" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.