Permalink
Browse files

Showing and X for completed and an R for reset pomodoros beside each

activity.
  • Loading branch information...
1 parent 237d2a4 commit 43effae74ecd629591d3dfd80765237c24f6fb85 Marc Jeanson committed Jan 25, 2012
View
@@ -3,6 +3,10 @@ class Pomodoro < ActiveRecord::Base
validates :activity_id, presence: true
+ def completed?
+ !completed_at.nil?
+ end
+
def complete!
self.update_attribute :completed_at, Time.now
end
@@ -0,0 +1,4 @@
+- if pomodoro.completed?
+ 'X
+- else
+ 'R
@@ -3,8 +3,10 @@
table id="activities"
- @activities.each do |activity|
= content_tag_for(:tr, activity) do
+ td = check_box('activity', 'completed', activity_id: activity.id, checked: activity.completed?)
td = activity.title
td = link_to t('navigation.start_pomodoro'), activity_pomodoros_path(activity_id: activity), :remote => true, :method => :post
td = link_to t('navigation.edit_activity'), edit_activity_path(activity)
td = link_to t('navigation.delete_activity'), activity, :method => :delete
- td = check_box('activity', 'completed', activity_id: activity.id, checked: activity.completed?)
+ td id=dom_id(activity, :pomodoros)
+ == render partial: 'pomodoro', collection: activity.pomodoros
@@ -1 +1,2 @@
+$("#<%= dom_id(@activity, :pomodoros) %>").html("<%= escape_javascript(render partial: 'activities/pomodoro', collection: @activity.pomodoros) %>")
$("#reset_timer").html ""
@@ -1,2 +1,2 @@
-pomodoro_timer(<%= @activity.id %>, <%= @pomodoro.id %>, 1500)
+pomodoro_timer(<%= @activity.id %>, <%= @pomodoro.id %>, 3)
$("#reset_timer").html "<%= escape_javascript(render partial: 'activities/reset_link', locals: { activity_id: @pomodoro.activity.id, pomodoro_id: @pomodoro.id }) %>"
@@ -1 +1,2 @@
+$("#<%= dom_id(@activity, :pomodoros) %>").html("<%= escape_javascript(render partial: 'activities/pomodoro', collection: @activity.pomodoros) %>")
reset_pomodoro_timer(1500)

0 comments on commit 43effae

Please sign in to comment.