Permalink
Browse files

adding to git

  • Loading branch information...
0 parents commit e110ae6bf018c7a2ea6afbba7558f645bec9b3d3 @stevenbristol committed Mar 21, 2008
Showing 445 changed files with 30,213 additions and 0 deletions.
34 LICENSE
@@ -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.
+
+
+
125 README
@@ -0,0 +1,125 @@
+How to get LovdByLess up and running
+
+ * Lovd 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). Lovd 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 lovd with the typical "./script/server" and point your browser to "http://localhost:3000".
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Instructions:
+
+Install the Required Gems:
+
+- youtube-g
+- rflickr
+- uuidtools
+- acts_as_ferret
+- ferret
+- colored
+- hpricot
+- tzinfo
+- mocha
+- redgreen
+- RedCloth
+- imagick
+- win32console (windows only)
+
+
+Setup the databases:
+
+1. Edit config/database.yml.tmo 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.
+
+Configure Ferret:
+
+14. Feel free to replace ferret with the search engine of your choice.
+15. Acts_s_ferret home page: http://projects.jkraemer.net/acts_as_ferret/wiki.
+16. We recommend using the drb server as described here: http://projects.jkraemer.net/acts_as_ferret/wiki/DrbServer.
+
+Start Lovd By Less:
+
+17. ./script/server
+18. Go to the home page http://localhost:3000
+19. Go to the signup page and create an account.
+20. Go into the database and turn the is_admin flag to true on your new account.
+
+
+
+About flickr integration
+
+If you WANT to have flickr integration in your Lovd By Less project, 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/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 Lovd By Less project, 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
+
+
+
+
+
+
+
+
+Is there a google group for this project?
+
+Yes. It can be found here: http://groups.google.com/group/lovdbyless
+
+
+
+
+How to change the page a user is redirected to after login or singup:
+
+In AccountController.rb, look for lines that contain: redirect_back_or_default home_path and change either home_path to the path you want to send them to, or change redirect_back_or_default to redirect_to, or both.
+
+
+
+
+Why is public/javascripts/less_routes.js always modified and needing to be checked in? I swear I didn't touch it.
+
+less_routes.js is automatically generate when your app starts. Any changes to this app will be lost the next time it's generated.
@@ -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'
@@ -0,0 +1,121 @@
+class AccountsController < ApplicationController
+ skip_before_filter :login_required, :except => :logout
+ skip_after_filter :store_location
+ layout 'plain'
+
+
+
+ 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[:email] && params[:email].size > 0
+ u = Profile.find_by_email(params[:email]).user rescue nil
+ flash.now[:error] = "Could not find that email address. Try again." and return if u.nil?
+
+ @pass = u.forgot_password #must be @ variable for function tests
+ AccountMailer.deliver_forgot_password(u.profile.email, u.f, u.login, @pass)
+ flash[:notice] = "A new password has been mailed to you."
+ 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
+ remember_me if params[:remember_me] == "1"
+ flash[:notice] = "Hello #{@u.f}"
+ redirect_back_or_default home_path
+ 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
+ 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
+ return unless request.post?
+
+
+ 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]
+ u.email = params[:user][:email]
+ u.captcha = params[:user][:captcha] unless ENV['RAILS_ENV'] == 'test'
+ u.captcha_answer = params[:user][:captcha_answer] unless ENV['RAILS_ENV'] == 'test'
+
+ @u = u
+ if u.save
+ self.user = u
+
+
+ remember_me if params[:remember_me] == "1"
+ flash[:notice] = "Thanks for signing up!"
+ AuthMailer.deliver_registration(:subject=>"new #{SITE_NAME} registration", :body => "username = '#{@u.login}', email = '#{@u.profile.email}'", :recipients=>REGISTRATION_RECIPIENTS)
+ redirect_to home_url
+ else
+ @user = @u
+ params[:user][:password] = params[:user][:password_confirmation] = ''
+ flash.now[:error] = @u.errors
+ self.user = u# if RAILS_ENV == 'test'
+ 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
+
+
+
+
+
+
+
+
+class AuthMailer < ActionMailer::Base
+ def registration(options)
+ self.generic_mailer(options)
+ end
+end
@@ -0,0 +1,41 @@
+class Admin::UsersController < ApplicationController
+ before_filter :search_results, :except => [:destroy]
+
+ def index
+ render
+ end
+
+
+
+ def update
+ @profile = Profile.find(params[:id])
+ respond_to do |wants|
+ wants.js do
+ render :update do |page|
+ if @p == @profile
+ page << "message('You cannot deactivate yourself!');"
+ else
+ @profile.toggle! :is_active
+ page << "message('User has been marked as #{@profile.is_active ? 'active' : 'inactive'}');"
+ page.replace_html @profile.dom_id('link'), (@profile.is_active ? 'deactivate' : 'activate')
+ end
+ end
+ end
+ end
+ end
+
+ private
+
+ def allow_to
+ super :admin, :all => true
+ end
+
+ def search_results
+ if params[:search]
+ p = params[:search].dup
+ else
+ p = []
+ end
+ @results = Profile.search((p.delete(:q) || ''), p).paginate(:page => @page, :per_page => @per_page)
+ end
+end
Oops, something went wrong.

0 comments on commit e110ae6

Please sign in to comment.