Skip to content

Commit

Permalink
added new category boolean check sent
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencely committed Oct 8, 2014
1 parent 5271503 commit 8cf0c8e
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def update

def show
@category = Category.find params[:id]
@tasks = Task.where :category_id => params[:id]
end

private
Expand Down
3 changes: 2 additions & 1 deletion app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# paideuo :text
# category_id :integer
# partner_id :integer
# datetime :date
# datetime :datetime
# created_at :datetime
# updated_at :datetime
# check_sent :boolean default(FALSE)
#

class Task < ActiveRecord::Base
Expand Down
4 changes: 2 additions & 2 deletions app/views/categories/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<h2>Your Current Categories:</h2>

<%= @category.heading %>
<% @tasks.each do |task| %>
<% @category.tasks.each do |task| %>

<p>
<%= task.paideuo %> <%= time_ago_in_words task.datetime if task.datetime %> <%= "ago" if task.datetime && task.datetime < Time.now %> <%= link_to('edit', edit_category_task_path(@category.id, task.id)) %>
<%= task.paideuo %> Due: <%= task.datetime.strftime('%I:%M %p %B %d, %Y') if task.datetime %> <%= "ago" if task.datetime && task.datetime < Time.now %> <%= link_to('edit', edit_category_task_path(@category.id, task.id)) %>
<%= link_to('delete', category_task_path(@category.id,task.id), :method => :delete, :data => {:confirm => 'Are you sure? Dont give up!'}) %>
</p>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tasks/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2>Edit your task </h2>
<%= form_for(@task, :url => {:controller => 'tasks', :action => 'update', :id => @task.id}) do |f| %>
<p>Task name: <%= f.text_field :paideuo %></p>
<p>Complete by: <%= f.date_field :datetime %></p>
<p>Complete by: <%= f.datetime_select :datetime %>
<%= f.submit %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/tasks/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<%= form_for(:task, :url => {:controller => 'tasks', :action => 'create'}) do |f| %>
<p>Task name: <%= f.text_field :paideuo %></p>
<p>Complete by: <%= f.date_field :datetime %></p>
<p>Complete by: <%= f.datetime_select :datetime %></p>

<%= fields_for(:partner) do |pf| %>
<%= pf.label :name %>
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20141003154138_create_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def change
t.timestamps
end
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20141007232657_change_datetime_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeDatetimeType < ActiveRecord::Migration
def change
change_column :tasks, :datetime, :datetime
end
end
5 changes: 5 additions & 0 deletions db/migrate/20141008003033_add_column_to_tasks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddColumnToTasks < ActiveRecord::Migration
def change
add_column :tasks, :check_sent, :boolean, default: false
end
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20141003154146) do
ActiveRecord::Schema.define(version: 20141008003033) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand All @@ -32,9 +32,10 @@
t.text "paideuo"
t.integer "category_id"
t.integer "partner_id"
t.date "datetime"
t.datetime "datetime"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "check_sent", default: false
end

create_table "users", force: true do |t|
Expand Down

0 comments on commit 8cf0c8e

Please sign in to comment.