Skip to content
Browse files

Merge branch 'master' of github.com:Jarred-Sumner/FundingList.us

  • Loading branch information...
2 parents 00eaee7 + fb2ac4b commit aae59c51b80624bc767c61aedcebcde66bcf829d Jarred Sumner committed Feb 20, 2012
View
1 app/assets/stylesheets/application.css.scss
@@ -1,6 +1,5 @@
/*
*= require_self
- *= require jquery-ui-1.8.17.custom
*/
@import "bourbon/bourbon";
@import "bootstrap";
View
4 app/controllers/companies_controller.rb
@@ -1,7 +1,7 @@
class CompaniesController < ApplicationController
respond_to :json, :html
def index
- @companies = Company.where(:featured => true)
+ @featured = Company.where(:featured => true).limit(4) + Person.where(:featured => true).limit(4)
respond_to do |format|
format.html
format.json { render :json => Company.all.to_json }
@@ -48,7 +48,7 @@ def search
@first_name = params[:query]
@last_name = params[:query]
end
- @people = Person.where("first_name ilike ? OR last_name ilike ?", "%#{@first_name}%", "%#{@last_name}%" ).limit(4) unless params[:query] == ''
+ @people = Person.where("first_name ilike ? OR last_name ilike ?", "#{@first_name}%", "#{@last_name}%" ).limit(4) unless params[:query] == ''
@results = @companies + @people
@results.shuffle!
respond_to do |format|
View
14 app/views/companies/index.html.erb
@@ -4,12 +4,18 @@
<h3>Find out and stay up to date on most startup's funding</h3>
<input type='search' id='search' autocomplete='off' placeholder='Who is the company/person you want to know more about?' value='<%= params[:search] %>'/>
<ul id='companies_list'>
- <% @companies.each do |company| %>
+ <% @featured.each do |feature| %>
<li class='company unselectable'>
<h3>
- <a href='/companies/<%= company.id %>' class='unselectable'>
- <%= company.name %>
- </a>
+ <% if feature.class.name == 'Company' %>
+ <a href='/companies/<%= feature.id %>' class='unselectable'>
+ <%= feature.name %>
+ </a>
+ <% else %>
+ <a href='/people/<%= feature.id %>' class='unselectable'>
+ <%= feature.name %>
+ </a>
+ <% end %>
</h3>
</li>
<% end %>
View
6 db/migrate/20120221040721_add_featured_to_person.rb
@@ -0,0 +1,6 @@
+class AddFeaturedToPerson < ActiveRecord::Migration
+ def change
+ add_column :people, :featured, :boolean
+
+ end
+end
View
3 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120218061729) do
+ActiveRecord::Schema.define(:version => 20120221040721) do
create_table "companies", :force => true do |t|
t.string "name"
@@ -42,6 +42,7 @@
t.string "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.boolean "featured"
end
create_table "related_people", :force => true do |t|

0 comments on commit aae59c5

Please sign in to comment.
Something went wrong with that request. Please try again.