Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/marcjeanson/Pomodoroz

  • Loading branch information...
commit 2fd86cde61e6dd2f9e4a6e30cb1b647880556c10 2 parents 848c103 + 19a784f
@amirci amirci authored
View
1  Gemfile
@@ -24,6 +24,7 @@ end
gem 'jquery-rails'
gem 'slim'
gem 'simple_form'
+gem 'less-rails-bootstrap'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
14 Gemfile.lock
@@ -50,6 +50,8 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
+ commonjs (0.2.0)
+ therubyracer (~> 0.9.9)
cucumber (1.1.4)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
@@ -86,6 +88,15 @@ GEM
json (1.6.5)
launchy (2.0.5)
addressable (~> 2.2.6)
+ less (2.0.9)
+ commonjs (~> 0.2.0)
+ therubyracer (~> 0.9.9)
+ less-rails (2.1.3)
+ actionpack (>= 3.1)
+ less (~> 2.0.7)
+ less-rails-bootstrap (1.4.3)
+ less-rails (~> 2.1.0)
+ libv8 (3.3.10.4)
mail (2.4.1)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -161,6 +172,8 @@ GEM
tilt (~> 1.1, != 1.3.0)
temple (0.3.5)
term-ansicolor (1.0.7)
+ therubyracer (0.9.9)
+ libv8 (~> 3.3.10)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@@ -190,6 +203,7 @@ DEPENDENCIES
faker
jquery-rails
launchy
+ less-rails-bootstrap
pg
rails (= 3.2.0)
rspec-rails
View
5 app/assets/stylesheets/application.css
@@ -8,6 +8,11 @@
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
+ *= require twitter/bootstrap
*= require_self
*= require_tree .
*/
+
+body{
+ padding-top: 40px;
+}
View
6 app/controllers/application_controller.rb
@@ -1,9 +1,15 @@
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
+ before_filter :current_pomodoro
private
def record_not_found
render text: "Sorry, we couldn't find that record for you.", status: 404
end
+
+ def current_pomodoro
+ @pomodoro = Pomodoro.where("reset_at is null and completed_at is null and created_at > ?", 25.minutes.ago).first
+ @time_left = 25 * 60 - (Time.zone.now - @pomodoro.created_at).truncate if @pomodoro
+ end
end
View
4 app/models/pomodoro.rb
@@ -11,6 +11,10 @@ def complete!
self.update_attribute :completed_at, Time.now
end
+ def reset?
+ !reset_at.nil?
+ end
+
def reset!
self.update_attribute :reset_at, Time.now
end
View
2  app/views/activities/_pomodoro.html.slim
@@ -1,4 +1,4 @@
- if pomodoro.completed?
'X
-- else
+- elsif pomodoro.reset?
'R
View
5 app/views/layouts/_timer.html.slim
@@ -1,4 +1,7 @@
div id="timer"
div id="reset_timer"
- if @pomodoro
- == render 'activities/reset_link', locals: { activity_id: @pomodoro.activity.id, pomodoro_id: @pomodoro.id }
+ == render partial: 'activities/reset_link', locals: { activity_id: @pomodoro.activity.id, pomodoro_id: @pomodoro.id }
+
+- if @pomodoro
+ = javascript_tag "pomodoro_timer(#{@pomodoro.activity.id}, #{@pomodoro.id}, #{@time_left})"
View
11 app/views/layouts/application.html.slim
@@ -8,5 +8,12 @@ html
= yield :doc_head
body
- == render 'layouts/timer'
- == yield
+ div class="topbar"
+ div class="topbar-inner"
+ div class="container"
+ ul class="nav"
+ li class="active" = link_to t('navigation.activities'), activities_path
+ li = link_to t('navigation.new_activity'), new_activity_path
+ div class="container"
+ == render 'layouts/timer'
+ == yield
View
2  app/views/pomodoros/create.js.coffee
@@ -1,2 +1,2 @@
-pomodoro_timer(<%= @activity.id %>, <%= @pomodoro.id %>, 3)
+pomodoro_timer(<%= @activity.id %>, <%= @pomodoro.id %>, 1500)
$("#reset_timer").html "<%= escape_javascript(render partial: 'activities/reset_link', locals: { activity_id: @pomodoro.activity.id, pomodoro_id: @pomodoro.id }) %>"
View
15 db/seeds.rb
@@ -5,3 +5,18 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
+
+activity1 = Activity.create title: "Read requirements document"
+activity2 = Activity.create title: "Reinstall Visual Studio", completed: true
+activity3 = Activity.create title: "Migrate from TFS to Git"
+
+activity1.pomodoros.create completed_at: 1.day.ago
+activity1.pomodoros.create reset_at: 2.days.ago
+activity1.pomodoros.create completed_at: 3.days.ago
+
+activity2.pomodoros.create completed_at: 1.day.ago
+
+activity3.pomodoros.create completed_at: 1.day.ago
+activity3.pomodoros.create completed_at: 2.days.ago
+activity3.pomodoros.create completed_at: 4.days.ago
+activity3.pomodoros.create reset_at: 2.days.ago
Please sign in to comment.
Something went wrong with that request. Please try again.