Changeset 134

Show
Ignore:
Timestamp:
04/30/08 12:29:22 (8 months ago)
Author:
peter
Message:

Updated from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ambitiouslemon/branches/peter/app/controllers/account_controller.rb

    r39 r134  
    1919      if params[:remember_me] == "1" 
    2020        self.current_user.remember_me 
    21         cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } 
     21        cookies[:auth_token] = { :value => self.current_user.remember_token ,  
     22          :expires => self.current_user.remember_token_expires_at } 
    2223      end 
    2324      redirect_back_or_default( :action => 'index') 
  • ambitiouslemon/branches/peter/app/controllers/application.rb

    r25 r134  
    33 
    44class ApplicationController < ActionController::Base 
    5   # Pick a unique cookie name to distinguish our session data from others' 
    6   session :session_key => '_alcd_session_id' 
     5  helper :all # include all helpers, all the time 
     6 
     7  # See ActionController::RequestForgeryProtection for details 
     8  # Uncomment the :secret if you're not using the cookie session store 
     9  protect_from_forgery # :secret => 'a1110632f977a34cb503d5c35e5cfd79' 
    710end 
  • ambitiouslemon/branches/peter/app/models/skill.rb

    r23 r134  
    11class Skill < ActiveRecord::Base 
    2   has_and_belongs_to_many :users 
     2  belongs_to :skill_category 
     3  has_many :abilities 
     4  has_many :users, :through => :abilities 
    35end 
  • ambitiouslemon/branches/peter/app/models/user.rb

    r38 r134  
    44  attr_accessor :password 
    55   
     6   
     7  has_many :abiilities 
     8  has_many :skills, :through => :abilities 
    69  has_and_belongs_to_many :roles 
    710 
  • ambitiouslemon/branches/peter/app/views/apply/edit.rhtml

    r22 r134  
    11<h1>Editing Ambitious Lemon Application</h1> 
    22 
    3 <%= start_form_tag :action => 'update', :id => @answer %> 
     3<% form_for :apply, :action => 'update', :id => @answer do |f| %> 
    44  <%= render :partial => 'form' %> 
    55  <%= submit_tag 'Save' %> 
    6 <%= end_form_tag %> 
     6<% end %> 
  • ambitiouslemon/branches/peter/app/views/apply/new.rhtml

    r22 r134  
    11<h1>New Ambitious Lemon Application</h1> 
    22 
    3 <%= start_form_tag :action => 'create' %> 
     3<% form_for :apply, tag :action => 'create' do |f| %> 
    44  <%= render :partial => 'form' %> 
    55  <%= submit_tag "Create and Save" %> 
    6 <%= end_form_tag %> 
     6<% end %> 
  • ambitiouslemon/branches/peter/app/views/apply/show.rhtml

    r22 r134  
    11<h1>Ambitious Lemon Application</h1> 
    22 
    3 <%= start_form_tag :action => 'create' %> 
     3<% form_for :apply, :action => 'create' do |f| %> 
    44 
    55<% counter = 0 %> 
     
    4747<br> 
    4848<%= submit_tag "Save" %> 
    49 <%= end_form_tag %> 
     49<% end %> 
  • ambitiouslemon/branches/peter/app/views/layouts/generic.rhtml

    r39 r134  
    77  <title>AmbitiousLemon - Free Nonprofit Web Hosting</title> 
    88        <%= stylesheet_link_tag 'my' %> 
    9   <link rel="stylesheet" type="text/css" href="my.css" /> 
    109  <!--[if IE]> 
    1110   <%= stylesheet_link_tag 'compatability' %> 
  • ambitiouslemon/branches/peter/app/views/sites/edit.rhtml

    r22 r134  
    11<h1>Editing <%= @site.url %></h1> 
    22 
    3 <%= start_form_tag :action => 'update', :id => @site %> 
     3<% form_for :site, @site :action => 'update', :id => @site do |f| %> 
    44        <%= render :partial => 'form' %> 
    55        <div style='text-align: center; padding: 10px;'> 
    66                <%= submit_tag 'Save' %> 
    77        </div> 
    8 <%= end_form_tag %> 
     8<% end %> 
  • ambitiouslemon/branches/peter/app/views/sites/new.rhtml

    r22 r134  
    11<h1>New Site</h1> 
    22 
    3 <%= start_form_tag :action => 'create' %> 
     3<% form_for :site, :action => 'create' do |f| %> 
    44        <%= render :partial => 'form' %> 
    55        <div style='text-align: center; padding: 10px;'> 
    66                <%= submit_tag 'Create' %> 
    77        </div> 
    8 <%= end_form_tag %> 
     8<% end %> 
  • ambitiouslemon/branches/peter/app/views/users/_user_approve.rhtml

    r22 r134  
    2929                                <td><%= link_to 'Application', :action => 'observe', :controller => 'apply', :id => user %></td> 
    3030                                <td><%= link_to 'Activate', :action => 'activate', :id => user %></td> 
    31                                 <td><%= link_to 'Delete', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :post => true %></td> 
     31                                <td><%= link_to 'Delete', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => post %></td> 
    3232                        <% end %> 
    3333                        <% if counter == 0 %> 
  • ambitiouslemon/branches/peter/app/views/users/_user_list.rhtml

    r22 r134  
    2828                                <td><%= link_to 'Show', :action => 'show', :id => user %></td> 
    2929                                <td><%= link_to 'Edit', :action => 'edit', :id => user %></td> 
    30                                 <td><%= link_to 'Deactivate', { :action => 'deactivate', :id => user}, :confirm => 'Are you sure?', :post => true %></td> 
    31                                 <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'You are about to DESTROY a user! This could muck up the database! Are you sure?', :post => true %></td> 
     30                                <td><%= link_to 'Deactivate', { :action => 'deactivate', :id => user}, :confirm => 'Are you sure?', :method => post %></td> 
     31                                <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'You are about to DESTROY a user! This could muck up the database! Are you sure?', :method => post %></td> 
    3232                        <% end %> 
    3333                        <% if counter == 0 %> 
  • ambitiouslemon/branches/peter/app/views/users/edit.rhtml

    r22 r134  
    11<h1>Editing User Profile</h1> 
    22 
    3 <%= start_form_tag :action => 'update', :id => @user %> 
     3<% form_for :user, @user, :action => 'update', :id => @user  do |f|%> 
    44        <%= render :partial => 'form' %> 
    55        <div style='text-align: center; padding: 10px;'> 
    66                <%= submit_tag 'Save' %> 
    77        </div> 
    8 <%= end_form_tag %> 
     8<% end %> 
  • ambitiouslemon/branches/peter/config

    • Property svn:ignore changed from
      database.yml
      to

  • ambitiouslemon/branches/peter/config/boot.rb

    r35 r134  
    1 # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb 
     1# Don't change this file! 
     2# Configure your app in config/environment.rb and config/environments/*.rb 
    23 
    3 unless defined?(RAILS_ROOT) 
    4   root_path = File.join(File.dirname(__FILE__), '..') 
     4RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) 
    55 
    6   unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ 
    7     require 'pathname' 
    8     root_path = Pathname.new(root_path).cleanpath(true).to_s 
    9   end 
     6module Rails 
     7  class << self 
     8    def boot! 
     9      unless booted? 
     10        preinitialize 
     11        pick_boot.run 
     12      end 
     13    end 
    1014 
    11   RAILS_ROOT = root_path 
    12 end 
     15    def booted? 
     16      defined? Rails::Initializer 
     17    end 
    1318 
    14 unless defined?(Rails::Initializer) 
    15   if File.directory?("#{RAILS_ROOT}/vendor/rails") 
    16     require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" 
    17   else 
    18     require 'rubygems' 
     19    def pick_boot 
     20      (vendor_rails? ? VendorBoot : GemBoot).new 
     21    end 
    1922 
    20     environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join 
    21     environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/ 
    22     rails_gem_version = $1 
     23    def vendor_rails? 
     24      File.exist?("#{RAILS_ROOT}/vendor/rails") 
     25    end 
    2326 
    24     if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version 
    25       # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems 
    26       rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last 
     27    # FIXME : Ruby 1.9 
     28    def preinitialize 
     29      load(preinitializer_path) if File.exists?(preinitializer_path) 
     30    end 
    2731 
    28       if rails_gem 
    29         gem "rails", "=#{rails_gem.version.version}" 
    30         require rails_gem.full_gem_path + '/lib/initializer' 
    31       else 
    32         STDERR.puts %(Cannot find gem for Rails ~>#{version}.0: 
    33     Install the missing gem with 'gem install -v=#{version} rails', or 
    34     change environment.rb to define RAILS_GEM_VERSION with your desired version. 
    35   ) 
    36         exit 1 
    37       end 
    38     else 
    39       gem "rails" 
    40       require 'initializer' 
     32    def preinitializer_path 
     33      "#{RAILS_ROOT}/config/preinitializer.rb" 
    4134    end 
    4235  end 
    4336 
    44   Rails::Initializer.run(:set_load_path) 
     37  class Boot 
     38    def run 
     39      load_initializer 
     40      Rails::Initializer.run(:set_load_path) 
     41    end 
     42  end 
     43 
     44  class VendorBoot < Boot 
     45    def load_initializer 
     46      require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" 
     47    end 
     48  end 
     49 
     50  class GemBoot < Boot 
     51    def load_initializer 
     52      self.class.load_rubygems 
     53      load_rails_gem 
     54      require 'initializer' 
     55    end 
     56 
     57    def load_rails_gem 
     58      if version = self.class.gem_version 
     59        gem 'rails', version 
     60      else 
     61        gem 'rails' 
     62      end 
     63    rescue Gem::LoadError => load_error 
     64      $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) 
     65      exit 1 
     66    end 
     67 
     68    class << self 
     69      def rubygems_version 
     70        Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion 
     71      end 
     72 
     73      def gem_version 
     74        if defined? RAILS_GEM_VERSION 
     75          RAILS_GEM_VERSION 
     76        elsif ENV.include?('RAILS_GEM_VERSION') 
     77          ENV['RAILS_GEM_VERSION'] 
     78        else 
     79          parse_gem_version(read_environment_rb) 
     80        end 
     81      end 
     82 
     83      def load_rubygems 
     84        require 'rubygems' 
     85 
     86        unless rubygems_version >= '0.9.4' 
     87          $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.) 
     88          exit 1 
     89        end 
     90 
     91      rescue LoadError 
     92        $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org) 
     93        exit 1 
     94      end 
     95 
     96      def parse_gem_version(text) 
     97        $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ 
     98      end 
     99 
     100      private 
     101        def read_environment_rb 
     102          File.read("#{RAILS_ROOT}/config/environment.rb") 
     103        end 
     104    end 
     105  end 
    45106end 
     107 
     108# All that for this: 
     109Rails.boot! 
  • ambitiouslemon/branches/peter/config/deploy.rb

    r88 r134  
    4040# set :gateway, "gate.host.com"  # default to no gateway 
    4141set :deploy_to, "/home/admin/myapp" 
    42 set :user, "admin" 
     42set :user, "peter" 
     43set :use_sudo, false 
     44 
     45set :scm, :subversion 
     46set :scm_username, "peter" 
     47set :scm_password, "Passw0rd" 
     48set :checkout, "export" 
    4349 
    4450set :mongrel_conf, "#{current_path}/config/mongrel_cluster.yml" 
    4551 
     52set :runner, "peter" 
    4653 
    4754# ============================================================================= 
  • ambitiouslemon/branches/peter/config/environment.rb

    r35 r134  
    1 # Be sure to restart your web server when you modify this file. 
     1# Be sure to restart your server when you modify this file 
    22 
    3 # Uncomment below to force Rails into production mode when  
     3# Uncomment below to force Rails into production mode when 
    44# you don't control web/app server and can't set it the proper way 
    55# ENV['RAILS_ENV'] ||= 'production' 
    66 
    77# Specifies gem version of Rails to use when vendor/rails is not present 
    8 RAILS_GEM_VERSION = '1.2.3' #unless defined? RAILS_GEM_VERSION 
     8RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION 
    99 
    1010# Bootstrap the Rails environment, frameworks, and default configuration 
     
    1212 
    1313Rails::Initializer.run do |config| 
    14   # Settings in config/environments/* take precedence over those specified here 
    15    
    16   # Skip frameworks you're not going to use (only works if using vendor/rails) 
    17   # config.frameworks -= [ :action_web_service, :action_mailer ] 
     14  # Settings in config/environments/* take precedence over those specified here. 
     15  # Application configuration should go into files in config/initializers 
     16  # -- all .rb files in that directory are automatically loaded. 
     17  # See Rails::Configuration for more options. 
    1818 
    19   # Only load the plugins named here, by default all plugins in vendor/plugins are loaded 
    20   # config.plugins = %W( exception_notification ssl_requirement ) 
     19  # Skip frameworks you're not going to use (only works if using vendor/rails). 
     20  # To use Rails without a database, you must remove the Active Record framework 
     21  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] 
     22 
     23  # Only load the plugins named here, in the order given. By default, all plugins  
     24  # in vendor/plugins are loaded in alphabetical order. 
     25  # :all can be used as a placeholder for all plugins not explicitly named 
     26  # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 
    2127 
    2228  # Add additional load paths for your own custom dirs 
    2329  # config.load_paths += %W( #{RAILS_ROOT}/extras ) 
    2430 
    25   # Force all environments to use the same logger level  
     31  # Force all environments to use the same logger level 
    2632  # (by default production uses :info, the others :debug) 
    2733  # config.log_level = :debug 
    2834 
    29   # Use the database for sessions instead of the file system 
     35  # Your secret key for verifying cookie session data integrity. 
     36  # If you change this key, all old sessions will become invalid! 
     37  # Make sure the secret is at least 30 characters and all random,  
     38  # no regular words or you'll be exposed to dictionary attacks. 
     39  config.action_controller.session = { 
     40    :session_key => '_al_session', 
     41    :secret      => '3f9020a15e2b63bc71d0d0b8c626ebccdce02579940c0abcdd2510fdb416bd912e16e61393e9e425b6af7e42158e0d9a436ce1dad451b967a9298c001124751f' 
     42  } 
     43 
     44  # Use the database for sessions instead of the cookie-based default, 
     45  # which shouldn't be used to store highly confidential information 
    3046  # (create the session table with 'rake db:sessions:create') 
    3147  # config.action_controller.session_store = :active_record_store 
    3248 
    3349  # Use SQL instead of Active Record's schema dumper when creating the test database. 
    34   # This is necessary if your schema can't be completely dumped by the schema dumper,  
     50  # This is necessary if your schema can't be completely dumped by the schema dumper, 
    3551  # like if you have constraints or database-specific column types 
    3652  # config.active_record.schema_format = :sql 
     
    4157  # Make Active Record use UTC-base instead of local time 
    4258  # config.active_record.default_timezone = :utc 
    43    
    44   # See Rails::Configuration for more options 
    4559end 
    46  
    47 # Add new inflection rules using the following format  
    48 # (all these examples are active by default): 
    49 # Inflector.inflections do |inflect| 
    50 #   inflect.plural /^(ox)$/i, '\1en' 
    51 #   inflect.singular /^(ox)en/i, '\1' 
    52 #   inflect.irregular 'person', 'people' 
    53 #   inflect.uncountable %w( fish sheep ) 
    54 # end 
    55  
    56 # Add new mime types for use in respond_to blocks: 
    57 # Mime::Type.register "text/richtext", :rtf 
    58 # Mime::Type.register "application/x-mobile", :mobile 
    59  
    60 # Include your application configuration below 
  • ambitiouslemon/branches/peter/config/environments/development.rb

    r22 r134  
    99config.whiny_nils = true 
    1010 
    11 # Enable the breakpoint server that script/breakpointer connects to 
    12 config.breakpoint_server = true 
    13  
    1411# Show full error reports and disable caching 
    1512config.action_controller.consider_all_requests_local = true 
     13config.action_view.debug_rjs                         = true 
    1614config.action_controller.perform_caching             = false 
    1715config.action_view.cache_template_extensions         = false 
    18 config.action_view.debug_rjs                         = true 
    1916 
    2017# Don't care if the mailer can't send 
  • ambitiouslemon/branches/peter/config/environments/production.rb

    r25 r134  
    1111config.action_controller.consider_all_requests_local = false 
    1212config.action_controller.perform_caching             = true 
     13config.action_view.cache_template_loading            = true 
    1314 
    1415# Enable serving of images, stylesheets, and javascripts from an asset server 
  • ambitiouslemon/branches/peter/config/environments/test.rb

    r22 r134  
    1414config.action_controller.perform_caching             = false 
    1515 
     16# Disable request forgery protection in test environment 
     17config.action_controller.allow_forgery_protection    = false 
     18 
    1619# Tell ActionMailer not to deliver emails to the real world. 
    1720# The :test delivery method accumulates sent emails in the 
  • ambitiouslemon/branches/peter/config/mongrel_cluster.yml

    r88 r134  
    1 ---  
    2 user: admin 
    3 cwd: /home/admin/myapp 
     1--- 
     2user: peter 
     3cwd: /home/admin/myapp/current 
    44port: "8000" 
    5 group: apache 
    6 #address: 127 
     5environment: production 
     6group: users 
    77pid_file: log/mongrel.pid 
    88servers: 2 
  • ambitiouslemon/branches/peter/config/routes.rb

    r25 r134  
    11ActionController::Routing::Routes.draw do |map| 
     2   
     3  # map.root :controller => 'users' 
     4  # map.resources :users, :has_many => :abilities 
     5  map.resources :abilities 
     6 
     7  map.resources :skills 
     8 
     9  map.resources :skill_categories, :has_many => :skills 
     10 
    211  # The priority is based upon order of creation: first created -> highest priority. 
    3    
     12 
    413  # Sample of regular route: 
    5   # map.connect 'products/:id', :controller => 'catalog', :action => 'view' 
     14  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view' 
    615  # Keep in mind you can assign values other than :controller and :action 
    716 
    817  # Sample of named route: 
    9   # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' 
     18  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' 
    1019  # This route can be invoked with purchase_url(:id => product.id) 
    1120 
    12   # You can have the root of your site routed by hooking up ''  
    13   # -- just remember to delete public/index.html. 
    14   map.connect '', :controller => "sections", :action => 'index' 
     21  # Sample resource route (maps HTTP verbs to controller actions automatically): 
     22  #   map.resources :products 
    1523 
    16   # Allow downloading Web Service WSDL as a file with an extension 
    17   # instead of a file named 'wsdl' 
    18   map.connect ':controller/service.wsdl', :action => 'wsdl' 
     24  # Sample resource route with options: 
     25  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } 
    1926 
    20   # Install the default route as the lowest priority. 
     27  # Sample resource route with sub-resources: 
     28  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller 
     29 
     30  # Sample resource route within a namespace: 
     31  #   map.namespace :admin do |admin| 
     32  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) 
     33  #     admin.resources :products 
     34  #   end 
     35 
     36  # You can have the root of your site routed with map.root -- just remember to delete public/index.html. 
     37  # map.root :controller => "welcome" 
     38 
     39  # See how all your routes lay out with "rake routes" 
     40 
     41  # Install the default routes as the lowest priority. 
     42  map.connect ':controller/:action/:id' 
    2143  map.connect ':controller/:action/:id.:format' 
    22   map.connect ':controller/:action/:id' 
    2344end 
  • ambitiouslemon/branches/peter/db/migrate/001_initial_schema.rb

    r38 r134  
    4040     
    4141    #add_index "sites", ["id"], :name => "id", :unique => true 
    42      
    43     create_table "skillcategories", :force => true do |t| 
    44       t.column "catagory", :text, :default => "", :null => false 
    45     end 
    46      
    47     #add_index "skillcategories", ["id"], :name => "id", :unique => true 
    48      
    49     create_table "skills", :force => true do |t| 
    50       t.column "name", :text,    :default => "", :null => false 
    51       t.column "cat",  :integer, :default => 1,  :null => false 
    52     end 
    53      
    54     #add_index "skills", ["id"], :name => "id", :unique => true 
     42      
    5543     
    5644    create_table "skills_users", :id => false, :force => true do |t| 
     
    9785    drop_table :questions 
    9886    drop_table :sites 
    99     drop_table :skillcategories 
    100     drop_table :skills 
    10187    drop_table :skills_users 
    10288    drop_table :users 
  • ambitiouslemon/branches/peter/db/schema.rb

    r88 r134  
    1 # This file is autogenerated. Instead of editing this file, please use the 
    2 # migrations feature of ActiveRecord to incrementally modify your database, and 
     1# This file is auto-generated from the current state of the database. Instead of editing this file,  
     2# please use the migrations feature of ActiveRecord to incrementally modify your database, and 
    33# then regenerate this schema definition. 
     4# 
     5# Note that this schema.rb definition is the authoritative source for your database schema. If you need 
     6# to create the application database on another system, you should be using db:schema:load, not running 
     7# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations 
     8# you'll amass, the slower it'll run and the greater likelihood for issues). 
     9# 
     10# It's strongly recommended to check this file into your version control system. 
    411 
    5 ActiveRecord::Schema.define(:version => 2) do 
     12ActiveRecord::Schema.define(:version => 5) do 
     13 
     14  create_table "abilities", :force => true do |t| 
     15    t.integer  "skill_id" 
     16    t.integer  "user_id" 
     17    t.text     "details" 
     18    t.datetime "created_at" 
     19    t.datetime "updated_at" 
     20  end 
    621 
    722  create_table "answers", :force => true do |t| 
    8     t.column "question_id", :integer, :default => 0,  :null => false 
    9     t.column "user_id",     :integer, :default => 0,  :null => false 
    10     t.column "answer",      :text,    :default => "", :null => false 
     23    t.integer "question_id", :