forked from risingsun/risealumni
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bb5740b
Showing
2,093 changed files
with
149,402 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | ||
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | ||
load 'config/deploy' |
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,34 @@ | ||
The application "Lovd By Less" is distributed under the MIT license (which | ||
is the same license that Ruby on Rails is distributed under). This license | ||
does not include any code found in the "vendors" directory. Those plugins | ||
are each licensed individually and their licenses should be reviewed before | ||
you use this application. Most plugins are also licensed under the MIT | ||
license, but some may not be. If a plugin does not | ||
have a license, due diligence should be taken to find the license on the | ||
plugin's website. | ||
|
||
|
||
|
||
The MIT license: | ||
Copyright (c) 2008 Less Everything, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
|
||
|
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,130 @@ | ||
How to get risealumni up and running | ||
|
||
START BY MAKING SURE your ruby gems are version 1.3.4 or greater: | ||
* (sudo) gem update --system | ||
Then add the github repo to your gems: | ||
* gem sources -a http://gems.github.com | ||
|
||
|
||
* risealmuni runs on Ruby on Rails, so first you need to get rails running. Go download rails (http://rubyonrails.org/down) and follow it's instructions to get rails running. | ||
* The directions in this README file assume some knowledge of rails, but I'll go through it a bit here first. | ||
* The first thing to do is install the ruby gems that are required. For each gem listed in the README, at the command line, do something like "gem install [gem name]" or "sudo gem install [gem name]". | ||
* The next thing to do is set up your database (steps 1-4 in the README). risealumni is setup to use MySQL by default, so just follow the instructions in the README and configure the files for your computer. | ||
* Skip step 5. | ||
* Now setup global variable (site name and url and stuff) (steps 6-13) and change the (r)html and css to suit your taste. | ||
* In dev mode, search (steps 14-16) should work right out of the box (assuming you install the gems). The search instructions are really for a production environment. | ||
* Start risealumni with the typical "./script/server" and point your browser to "http://localhost:3000". | ||
|
||
|
||
|
||
|
||
Instructions: | ||
|
||
Quick Setup (currently for non-Windows users only - due to ferret gem issues): | ||
|
||
1. Edit config/database.yml.tmp to reflect the database names you would like to use. | ||
2. Edit config/environments/production.rb so asset_host reflects the name of the production asset server | ||
3. cp config/database.yml.tmp config/database.yml | ||
4. MAKE SURE YOU UPGRADE TO GEMS 1.3.4. | ||
5. RUN gem sources -a http://gems.github.com | ||
7. rake test | ||
8. See step #6 below to continue setup (near "Setup default values") | ||
|
||
The getting_started rake task will install all required gems, create the databases in database.yml, | ||
and migrate the development and test databases. | ||
|
||
Manual Setup: | ||
|
||
Install the Required Gems: | ||
|
||
1. Install these gems: | ||
- youtube-g | ||
- uuidtools | ||
- ferret | ||
- avatar | ||
- icalendar | ||
- will_paginate | ||
- ar_mailer | ||
- mime-types | ||
- json | ||
- twitter4r | ||
- fiveruns-memcache-client | ||
- facebooker | ||
- rflickr | ||
- RedCloth | ||
- rmagick (will require ImageMagick, which is not a gem) | ||
- win32console (windows only) | ||
2. Run "rake gems:build" to build the gems that need building | ||
|
||
|
||
TIPS: | ||
Installing ImageMagick and RMagick | ||
See these posts for tips: | ||
http://b.lesseverything.com/2007/9/26/installing-imagemagick-and-rmagick-on-mac-os-x | ||
http://www.randycullom.com/chatterbox/archives/2006/12/installing_imag.html | ||
|
||
Setup the databases: | ||
|
||
1. Edit config/database.yml.tmp to reflect the database names you would like to use. | ||
2. cp config/database.yml.tmp config/database.yml | ||
3. rake db:create:all | ||
4. rake mig a=no | ||
|
||
All tests pass: | ||
|
||
5. rake | ||
|
||
Setup default values: | ||
|
||
6. Edit config/initializers/exception_notifier.rb | ||
7. Edit the config/environment.rb file and change the config.action_controller.session data | ||
8. Edit config/environments/development.rb and production.rb to suit your tastes. (Specifically config.action_mailer.delivery_method) | ||
9. Change the values in config/initializers/global_variables.rb to match your site and domain. (Specifically SITE_NAME, SITE, MAILER_TO_ADDRESS, MAILER_FROM_ADDRESS, REGISTRATION_RECIPIENTS) | ||
10. Go to the section "About flickr integration" and follow the steps to either use flickr or not. | ||
|
||
11. Edit public/404.html, public/500.html, app/views/account_mailer/* | ||
12. Edit application.css to suite your tastes. | ||
13. Edit app/views/home/terms. | ||
|
||
About flickr integration | ||
|
||
If you WANT to have flickr integration in your application, follow these setup instructions: | ||
1. Go http://flickr.com/services/api/keys/apply/ to apply for a flickr api key. | ||
2. Copy the Key and Secret into config/initializers/flickr.rb | ||
3. From the command line, run "ruby script/authorize_flickr.rb" and follow the instructions. | ||
This stores the flickr auth stuff into config/flickr.cache. If you add this cache file to your source control, then you shouldn't have to repeat this in production. Alternatively, you can get a different key for production, if you'd like. | ||
|
||
If you DO NOT WANT to have flickr integration in your application, follow these setup instructions: | ||
1. Delete line 15 from app/controllers/profiles_controller.rb [@flickr = @profile.flickr_username.blank? ? [] : flickr_images(flickr.people.findByUsername(@profile.flickr_username))] | ||
2. Delete lines 22-35 in app/views/profiles/_public.html.erb | ||
|
||
|
||
Facebook Configuration | ||
---------------------- | ||
|
||
0. Get a publicly available host: | ||
* dyndns.org | ||
* static IP | ||
|
||
1. Add the Developer Application. | ||
|
||
2. Create a New Application. | ||
|
||
3. Update the Facebook Application settings to point to your publicly available host. | ||
|
||
4. Edit the facebooker.yml file to reflect your Facebook Application settings page. | ||
|
||
5. Register the Facebook Post Templates. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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,10 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require(File.join(File.dirname(__FILE__), 'config', 'boot')) | ||
|
||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
require 'tasks/rails' |
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,202 @@ | ||
class AccountsController < ApplicationController | ||
skip_before_filter :login_required, :except => :logout | ||
skip_after_filter :store_location | ||
#before_filter :check_email ,:only => [:signup] | ||
cache_sweeper :profile_sweeper, :only => [:confirmation_email] | ||
|
||
def login | ||
redirect_back_or_default(home_path) and return if @u | ||
@user = User.new | ||
return unless request.post? | ||
#plays double duty login/forgot (due to the ajax nature of the login/forgot form) | ||
if params[:new_password] | ||
u = Profile.find_by_email(params[:profile][:email]).user rescue nil | ||
if u.nil? | ||
flash.now[:error] = "Could not find that email address. Try again." | ||
render :action => 'forgot_password' | ||
return | ||
else | ||
@pass = u.forgot_password! #must be @ variable for function tests | ||
AccountMailer.deliver_forgot_password(u.profile.email, u.full_name, u.login, @pass) | ||
flash.now[:notice] = "A new password has been mailed to you." | ||
end | ||
else | ||
params[:login] ||= params[:user][:login] if params[:user] | ||
params[:password] ||= params[:user][:password] if params[:user] | ||
self.user = User.authenticate(params[:login], params[:password]) | ||
if @u && !@u.email_verified | ||
reset_session | ||
flash[:error] = 'Your email address has not yet been confirmed.' | ||
return false | ||
elsif @u && @u.email_verified | ||
#@u.record_login! # Records the time when the user is suucessfully loggedin | ||
#@u.save! | ||
remember_me if params[:user][:remember_me] == "1" | ||
flash[:notice] = "Hello #{@u.full_name}" | ||
redirect_back_or_default profile_url(@u.profile) | ||
else | ||
flash.now[:error] = "Uh-oh, login didn't work. Do you have caps locks on? Try it again." | ||
end | ||
end | ||
end | ||
|
||
def logout | ||
cookies[:auth_token] = {:expires => Time.now-1.day, :value => "" } | ||
session[:user] = nil | ||
session[:return_to] = nil | ||
clear_facebook_session_information | ||
clear_fb_cookies! | ||
flash[:notice] = "You have been logged out." | ||
redirect_to '/' | ||
end | ||
|
||
def signup | ||
redirect_back_or_default(home_path) and return if @u | ||
@user = User.new | ||
@profile = @user.build_profile | ||
session[:show_referral_form] = nil unless request.xhr? # need to nill the session which maintains the step two of signup process | ||
unless request.xhr? | ||
if (params[:fb_user] && facebook_user) | ||
@f_user = facebook_user | ||
@user.attributes = {:facebook_uid => @f_user.uid,:email_verified => true,:email_verification => nil} | ||
@profile.attributes ={:first_name => @f_user.first_name, | ||
:last_name => @f_user.last_name, :gender => @f_user.sex.titleize} | ||
return | ||
elsif params[:fb_user] && facebook_user.nil? | ||
redirect_to home_url and return | ||
else | ||
return | ||
end | ||
end | ||
u = User.new | ||
u.terms_of_service = params[:user][:terms_of_service] | ||
u.login = params[:user][:login] | ||
u.password = params[:user][:password] | ||
u.password_confirmation = params[:user][:password_confirmation] | ||
if @production | ||
u.captcha = params[:user][:captcha] | ||
u.captcha_answer = params[:user][:captcha_answer] | ||
end | ||
u.generate_confirmation_hash! | ||
if u.update_attributes(params[:user]) | ||
if u.is_facebook_user? | ||
respond_to do |wants| | ||
wants.js do | ||
if u.profile.activate! | ||
self.user = u | ||
flash[:notice] = "Hello #{@u.full_name}" | ||
render :update do |page| | ||
page.redirect_to profile_path(@u.profile) | ||
end | ||
else | ||
reset_session | ||
flash[:notice] = "We're sorry but it seems that there was a problem activating your profile. Please contact the administrators to resolve the issue." | ||
render :update do |page| | ||
page.redirect_to home_path | ||
end | ||
end | ||
end | ||
end | ||
else | ||
AccountMailer.deliver_signup(u) unless u.is_facebook_user? | ||
reset_session | ||
@user = u | ||
render :update do |page| | ||
page.replace_html "main_container", :partial => "thanks" | ||
end | ||
end | ||
elsif u.errors[:references] | ||
session[:show_referral_form] = true | ||
@user = u | ||
@profile = u.profile | ||
@user.errors.add(:captcha, "can't be blank") | ||
render :update do |page| | ||
page.replace_html "main_container", :partial => "signup_form" | ||
page[:user_form].hide | ||
page[:tos].hide | ||
page[:referral_form].show | ||
page.replace_html "referral_error", :inline => @user.errors[:references] if @user.errors[:references] | ||
page << "jq('#user_captcha').val('');" | ||
end | ||
else | ||
@user = u | ||
@profile = u.profile | ||
@facebook_uid = params[:user][:facebook_uid] | ||
params[:user][:captcha] = params[:user][:password] = params[:user][:password_confirmation] = '' | ||
render :update do |page| | ||
page.replace_html "main_container", :partial => "signup_form" | ||
page[:user_form].hide if session[:show_referral_form] | ||
page[:referral_form].show if session[:show_referral_form] | ||
page.replace_html "referral_error", :inline => " " | ||
page << "jq('#user_captcha').val('');" | ||
end | ||
end | ||
end | ||
|
||
def forgot_password | ||
end | ||
|
||
def confirmation_email | ||
@u = User.find(params[:user_id]) rescue nil | ||
if @u && @u.email_verified | ||
reset_session | ||
flash[:notice] = "Your email is already confirmed by us. Please login to continue." | ||
redirect_to login_path | ||
return true | ||
end | ||
if @u && @u.match_confirmation?(params[:hash]) | ||
@u.confirm_email! | ||
@u.profile.activate! | ||
if @u.save | ||
AccountMailer.deliver_email_confirmed_by_user(@u) unless @u.profile.is_active | ||
reset_session | ||
flash[:notice] = "Thanks your email is confirmed by us. Please login to continue" | ||
redirect_to login_path | ||
else | ||
reset_session | ||
flash[:notice] = "We're sorry but it seems that there was a problem activating your profile. Please contact the administrators to resolve the issue." | ||
redirect_to home_path | ||
end | ||
else | ||
reset_session | ||
flash[:notice] = "We're sorry but it seems that the confirmation did not go thru. You may have provided an expired key." | ||
redirect_to login_path | ||
end | ||
end | ||
|
||
def check_email | ||
p = Profile.find_by_email(params[:email]) | ||
render :update do |page| | ||
if p && p.user.email_verified | ||
page.replace_html "email_msg", :inline => "<span id='email_failure' name='email_failure' class='error'>This email has already been taken</span>" | ||
else | ||
page.replace_html "email_msg", :inline => "<span id='email_success' name='email_success' class='sys_message'>This email is available</span>" | ||
end | ||
end | ||
end | ||
|
||
def check_login | ||
user = User.find_by_login(params[:login]) | ||
render :update do |page| | ||
if user# && user.email_verified | ||
page.replace_html "login_msg", :inline => "<span id='login_failure' name='login_failure' class='error'>This login has already been taken</span>" | ||
else | ||
page.replace_html "login_msg", :inline => "<span id='login_success' name='login_success' class='sys_message'>This login is available</span>" | ||
end | ||
end | ||
end | ||
|
||
protected | ||
|
||
def remember_me | ||
self.user.remember_me! | ||
cookies[:auth_token] = { | ||
:value => self.user.remember_token , | ||
:expires => self.user.remember_token_expires_at | ||
} | ||
end | ||
|
||
def allow_to | ||
super :all, :all=>true | ||
end | ||
end |
Oops, something went wrong.