diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d89633 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +db/*.sqlite3 +db/schema.rb +config/database.yml +log/*.log +tmp/**/* + diff --git a/app/models/event.rb b/app/models/event.rb index 1fe81e9..2d31f83 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -5,7 +5,6 @@ class Event < ActiveRecord::Base has_many :participants has_many :attendees, :through => :participants, :source => :user - # has_many :users, :through => :participants accepts_nested_attributes_for :participants diff --git a/app/models/user.rb b/app/models/user.rb index 6bcfb54..5535e60 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,6 +4,13 @@ class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable + scope :investors, where('investor_id IS NOT NULL') + scope :employees, where('investor_id IS NULL') + + # if the assignments were all there this would work + #scope :investors, joins(:assignments).where('assignments.role_id = 3') + #scope :employees, joins(:assignments).where('assignments.role_id in (1,2)') + def has_role(role) self.roles.find_by_name(role) end @@ -30,5 +37,9 @@ def has_role(role) has_many :roles, :through => :assignments accepts_nested_attributes_for :participants + + def to_s + [first_name, last_name].join(' ') + end end diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb index 7b23687..9dab8c7 100644 --- a/app/views/events/show.html.erb +++ b/app/views/events/show.html.erb @@ -19,7 +19,7 @@ Investors Present @@ -29,15 +29,15 @@ H12 Team Present User ID - <%= @event.user_id %> + <%= @event.user %> diff --git a/app/views/investors/show.html.erb b/app/views/investors/show.html.erb index 275ed37..6363754 100644 --- a/app/views/investors/show.html.erb +++ b/app/views/investors/show.html.erb @@ -125,7 +125,7 @@ <%= task.investor.name %> <%= link_to 'Edit', edit_investor_task_path(@investor, task) %> - <%= link_to_function 'Destroy', "destroy_it_now('tasks', #{task.id.to_s})" %> + <%= link_to 'Destroy', "#", :onclick => 'return false;', :class => 'destroy', 'data-model' => 'tasks', 'data-id' => task.id.to_s %> <% end %> @@ -158,7 +158,7 @@ <%= event.user.first_name %> <%= link_to 'Edit', edit_investor_event_path(@investor, event) %> - <%= link_to_function 'Destroy', "destroy_it_now('events', #{event.id.to_s})" %> + <%= link_to 'Destroy', "#", :onclick => 'return false;', :class => 'destroy', 'data-model' => 'events', 'data-id' => event.id.to_s %> <% end %> @@ -169,11 +169,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/config/initializers/date_formats.rb b/config/initializers/date_formats.rb new file mode 100644 index 0000000..0e7fc3f --- /dev/null +++ b/config/initializers/date_formats.rb @@ -0,0 +1 @@ +Date::DATE_FORMATS[:default] = "%m/%d/%y" \ No newline at end of file diff --git a/db/development.sqlite3 b/db/development.sqlite3 deleted file mode 100644 index 483dec4..0000000 Binary files a/db/development.sqlite3 and /dev/null differ diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index 7945a6a..0000000 --- a/db/schema.rb +++ /dev/null @@ -1,139 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20110616164117) do - - create_table "assignments", :force => true do |t| - t.integer "user_id" - t.integer "role_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "documents", :force => true do |t| - t.string "name" - t.text "description" - t.string "attachment" - t.boolean "private", :default => true - t.integer "stage" - t.integer "folder_id" - t.integer "investor_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "event_users", :force => true do |t| - t.integer "event_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "events", :force => true do |t| - t.string "name" - t.string "event_type" - t.date "date" - t.text "notes" - t.integer "investor_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "folders", :force => true do |t| - t.string "name" - t.boolean "private", :default => true - t.integer "stage" - t.integer "investor_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "investors", :force => true do |t| - t.string "name" - t.string "investor_type" - t.string "street" - t.string "city" - t.string "state" - t.integer "zipcode" - t.integer "stage" - t.text "status" - t.integer "assets" - t.integer "potential_commitment" - t.date "expected_close" - t.string "probability" - t.integer "closed_commitment" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "participants", :force => true do |t| - t.integer "user_id" - t.integer "event_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "roles", :force => true do |t| - t.string "name" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "task_users", :force => true do |t| - t.integer "task_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "tasks", :force => true do |t| - t.string "name" - t.text "description" - t.date "due_date" - t.integer "task_owner_id" - t.boolean "completed" - t.date "completed_date" - t.integer "event_id" - t.integer "investor_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false - t.string "encrypted_password", :limit => 128, :default => "", :null => false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0 - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.string "first_name" - t.string "last_name" - t.string "phone" - t.text "notes" - t.string "user_type" - t.integer "investor_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "users", ["email"], :name => "index_users_on_email", :unique => true - add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - -end diff --git a/log/development.log b/log/development.log deleted file mode 100644 index 400ff7f..0000000 --- a/log/development.log +++ /dev/null @@ -1,67486 +0,0 @@ - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:12:10 -0600 - Processing by PagesController#index as HTML - SQL (0.7ms)  SELECT name - FROM sqlite_master - WHERE type = 'table' AND NOT name = 'sqlite_sequence' - - User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 -Rendered pages/index.html.erb within layouts/pages (145.9ms) -Completed 200 OK in 150ms (Views: 148.2ms | ActiveRecord: 1.5ms) - - -Started GET "/users/sign_out" for 127.0.0.1 at 2011-06-07 19:12:17 -0600 - Processing by Devise::SessionsController#destroy as HTML - User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 -Redirected to http://localhost:3000/ -Completed 302 Found in 96ms - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:12:17 -0600 - Processing by PagesController#index as HTML -Rendered pages/index.html.erb within layouts/pages (14.7ms) -Completed 200 OK in 18ms (Views: 18.0ms | ActiveRecord: 0.8ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:12:23 -0600 - Processing by PagesController#index as HTML -Rendered pages/index.html.erb within layouts/pages (16.0ms) -Completed 200 OK in 20ms (Views: 19.6ms | ActiveRecord: 0.0ms) - - -Started GET "/folders" for 127.0.0.1 at 2011-06-07 19:12:31 -0600 - Processing by FoldersController#index as HTML - Folder Load (0.6ms) SELECT "folders".* FROM "folders" -Rendered folders/index.html.erb within layouts/application (20.8ms) -Completed 200 OK in 68ms (Views: 26.6ms | ActiveRecord: 0.6ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:12:32 -0600 - Processing by PagesController#index as HTML -Rendered pages/index.html.erb within layouts/pages (14.6ms) -Completed 200 OK in 18ms (Views: 18.0ms | ActiveRecord: 0.0ms) - - -Started GET "/folders" for 127.0.0.1 at 2011-06-07 19:13:30 -0600 - -ActionController::RoutingError (undefined method `authenticate_user!' for ApplicationController:Class): - app/controllers/application_controller.rb:4:in `' - app/controllers/application_controller.rb:1:in `' - app/controllers/folders_controller.rb:1:in `' - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/folders" for 127.0.0.1 at 2011-06-07 19:13:42 -0600 - Processing by FoldersController#index as HTML -Completed in 10ms - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:13:42 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (1.6ms) -Rendered devise/sessions/new.html.erb within layouts/application (9.2ms) -Completed 200 OK in 63ms (Views: 13.4ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:13:42 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:19:16 -0600 - Processing by PagesController#index as HTML -Completed in 1ms - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:19:16 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (0.9ms) -Rendered devise/sessions/new.html.erb within layouts/application (8.5ms) -Completed 200 OK in 99ms (Views: 12.6ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:19:16 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:19:22 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (0.9ms) -Rendered devise/sessions/new.html.erb within layouts/application (8.3ms) -Completed 200 OK in 82ms (Views: 12.6ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:19:22 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.0ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:19:26 -0600 - Processing by PagesController#index as HTML -Completed in 10ms - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:19:26 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (0.9ms) -Rendered devise/sessions/new.html.erb within layouts/application (8.3ms) -Completed 200 OK in 84ms (Views: 12.9ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:19:26 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.2ms) - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:19:30 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (0.9ms) -Rendered devise/sessions/new.html.erb within layouts/application (7.9ms) -Completed 200 OK in 78ms (Views: 11.8ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:19:31 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.2ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:19:32 -0600 - Processing by PagesController#index as HTML -Completed in 10ms - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:19:33 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (0.9ms) -Rendered devise/sessions/new.html.erb within layouts/application (8.1ms) -Completed 200 OK in 42ms (Views: 11.9ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:19:33 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.0ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:23:06 -0600 - -ActionController::RoutingError (undefined local variable or method `index' for PagesController:Class): - app/controllers/pages_controller.rb:3:in `' - app/controllers/pages_controller.rb:1:in `' - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:23:14 -0600 - -ArgumentError (wrong number of arguments (3 for 1..2)): - app/controllers/pages_controller.rb:3:in `[]' - app/controllers/pages_controller.rb:3:in `' - app/controllers/pages_controller.rb:1:in `' - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms) -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms) -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (8.6ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:23:22 -0600 - Processing by PagesController#index as HTML -Rendered pages/index.html.erb within layouts/pages (15.0ms) -Completed 200 OK in 19ms (Views: 18.3ms | ActiveRecord: 0.0ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:23:28 -0600 - -ActionController::RoutingError (undefined local variable or method `index' for PagesController:Class): - app/controllers/pages_controller.rb:3:in `' - app/controllers/pages_controller.rb:1:in `' - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:23:34 -0600 - Processing by PagesController#index as HTML -Rendered pages/index.html.erb within layouts/pages (14.6ms) -Completed 200 OK in 18ms (Views: 17.9ms | ActiveRecord: 0.0ms) - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:23:42 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (1.0ms) -Rendered devise/sessions/new.html.erb within layouts/application (44.4ms) -Completed 200 OK in 79ms (Views: 48.3ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:23:42 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.1ms) - - -Started GET "/users/sign_up" for 127.0.0.1 at 2011-06-07 19:23:47 -0600 - Processing by Devise::RegistrationsController#new as HTML -Rendered devise/shared/_links.erb (1.3ms) -Rendered devise/registrations/new.html.erb within layouts/application (60.2ms) -Completed 200 OK in 84ms (Views: 64.5ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:23:47 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:23:50 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (0.9ms) -Rendered devise/sessions/new.html.erb within layouts/application (8.1ms) -Completed 200 OK in 43ms (Views: 12.1ms | ActiveRecord: 0.0ms) - - -Started GET "/users/images/logo.png" for 127.0.0.1 at 2011-06-07 19:23:51 -0600 - -ActionController::RoutingError (No route matches "/users/images/logo.png"): - - -Rendered /Users/Keller/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms) - - -Started GET "/" for 127.0.0.1 at 2011-06-07 19:28:42 -0600 - Processing by PagesController#index as HTML -Rendered pages/index.html.erb within layouts/pages (3.8ms) -Completed 200 OK in 8ms (Views: 7.7ms | ActiveRecord: 0.0ms) - - -Started GET "/users/sign_in" for 127.0.0.1 at 2011-06-07 19:28:44 -0600 - Processing by Devise::SessionsController#new as HTML -Rendered devise/shared/_links.erb (1.1ms) -ERROR: compiling _app_views_layouts_application_html_erb___3568604270509674942_2182067980__2879401685795245714 RAISED /Users/Keller/rails_projects/clearview-solutions/app/views/layouts/application.html.erb:29: syntax error, unexpected '<' -....png'), root_path, border="0"> -... ^ -/Users/Keller/rails_projects/clearview-solutions/app/views/layouts/application.html.erb:33: unknown regexp options - dv -unmatched close parenthesis: /a> -
-
- <%= link_to 'Investor Login', new_user_session_path );@output_buffer.safe_concat(' -');@output_buffer.safe_concat(' - ^ -/Users/Keller/rails_projects/clearview-solutions/app/views/layouts/application.html.erb:35: unknown regexp options - dv -/Users/Keller/rails_projects/clearview-solutions/app/views/layouts/application.html.erb:36: syntax error, unexpected '<' -
- ^ -/Users/Keller/rails_projects/clearview-solutions/app/views/layouts/application.html.erb:43: unknown regexp options - dv -unmatched close parenthesis: /div> - -'); end -@output_buffer.safe_concat(' -
-