-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Th/master #111
base: th/master
Are you sure you want to change the base?
Th/master #111
Changes from all commits
a69cbe1
eb666c5
addd0f0
051516d
b7f7c6c
64b68b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Place all the styles related to the people controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ | ||
|
||
table { | ||
width: 900px; | ||
margin-left:auto; | ||
margin-right:auto; | ||
|
||
} | ||
|
||
td, th { | ||
border: 1px solid transparent; /* No more visible border */ | ||
height: 30px; | ||
transition: all 0.3s; /* Simple transition for hover effect */ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ a{ | |
|
||
|
||
#name { | ||
text-align: center; | ||
margin-left: 32%; | ||
} | ||
|
||
#description { | ||
|
@@ -75,10 +75,18 @@ footer { | |
|
||
} | ||
|
||
.comp_date { | ||
font-weight: bold; | ||
font-size: 15px; | ||
|
||
} | ||
|
||
#task_person_id { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CSS styles that contain multiple words should be separated by the |
||
margin-left: 39%; | ||
} | ||
|
||
table { | ||
width: 600px; | ||
width: 900px; | ||
margin-left:auto; | ||
margin-right:auto; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class PeopleController < ApplicationController | ||
|
||
def index | ||
@people = Person.all | ||
end | ||
|
||
def show | ||
id = params[:id] | ||
@person = Person.find(id) | ||
end | ||
|
||
def show_tasks | ||
@person = Person.find(params[:id]) | ||
@tasks = Person.find(params[:id]).tasks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you already did the |
||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module PeopleHelper | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Person < ActiveRecord::Base | ||
has_many :tasks | ||
|
||
def uncompleted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this method returns the count, it might make sense to change the name of the method to something like |
||
completed = self.tasks.where({:completed_at => nil}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might make sense to rename this variable since these are the pieces that are not completed |
||
return completed.length | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Task < ActiveRecord::Base | ||
belongs_to :person | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<table> | ||
<col width="80%"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might make more sense to have a class associated with these columns that will then set the width |
||
<col width="20%"> | ||
<tr> | ||
<th> Name </th> | ||
<th> # uncompleted tasks</th> | ||
</tr> | ||
<% @people.each do |person| %> | ||
<tr> | ||
<td> | ||
<%if !person.name.nil? %> | ||
<%= link_to "#{person.name}", {controller: "people", action: "show_tasks", id: person.id} %> | ||
<% end %> | ||
</td> | ||
<td> | ||
<%= person.uncompleted %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
\ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<h1> User Information </h1> | ||
<h2> name: <%= @person.name %> </h2> | ||
<h3>Favorite Color: <%= @person.favorite_color %></h3> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The formatting here looks inconsistent from the h1,h2 to this h3 |
||
<p> <%= link_to "Check out #{@person.name} tasks", "/people/#{@person.id}/tasks" %></p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<%= link_to "Uncompleted Tasks", {action: "index", controller: "people"} %> | ||
<h1>This is The task list of <%= @person.name %> </h1> | ||
<ul> | ||
<% @tasks.each do |task| %> | ||
<li> Task: <%= task.name %> description: <%= task.description %> </li> | ||
<ul> | ||
<% if !task.completed_at.nil? %> | ||
<li class="comp_date">completed_at: <%= task.completed_at %></li> | ||
<% else %> | ||
<li class="comp_date">This task is not yet completed</li> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</ul> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreatePeople < ActiveRecord::Migration | ||
def change | ||
create_table :people do |t| | ||
t.string :name | ||
t.string :city | ||
t.string :favorite_color | ||
|
||
t.timestamps null: false | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class AddPersonId < ActiveRecord::Migration | ||
def change | ||
change_table :tasks do |t| | ||
add_column :tasks, :person_id, :integer | ||
end | ||
|
||
add_index :tasks, :person_id | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch your formatting here