Skip to content
This repository has been archived by the owner on Aug 9, 2018. It is now read-only.

Commit

Permalink
Adding an option page to customize pomodoro/break durations
Browse files Browse the repository at this point in the history
  • Loading branch information
jcplessis committed Jun 30, 2012
1 parent 31c8e47 commit cee0230
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/assets/index.html
Expand Up @@ -22,10 +22,10 @@
<a href="#working">
<button id="start-pomodoro" class="btn primary">Start Pomodoro</button>
</a>
<a href="#resting/300">
<a href="#resting/short">
<button id="take-a-short-break" class="btn success">Take a short break</button>
</a>
<a href="#resting/900">
<a href="#resting/long">
<button id="take-a-long-break" class="btn success">Take a long break</button>
</a>
</span>
Expand Down
23 changes: 14 additions & 9 deletions app/routers/main_router.coffee
@@ -1,10 +1,10 @@
class exports.MainRouter extends Backbone.Router
routes :
"home" : "home"
"working" : "working"
"resting/:seconds" : "resting"
"stats" : "stats"
"small_timer" : "small_timer"
"home" : "home"
"working" : "working"
"resting/:rest_type" : "resting"
"stats" : "stats"
"small_timer" : "small_timer"

home: ->
app.views.home.render()
Expand All @@ -16,13 +16,18 @@ class exports.MainRouter extends Backbone.Router

working: ->
app.views.working.render()
app.views.working.startTimer(if app.development == true then 10 else 25 * 60)

duration = localStorage["pomodoro-duration"]
if ! duration then duration = 25
app.views.working.startTimer(duration * 60)
app.collections.states.setCurrentStateName('working')

resting: (seconds) ->
resting: (rest_type) ->
app.views.resting.render()
app.views.resting.startTimer(if app.development == true then 10 else parseInt(seconds))
duration = localStorage[rest_type + "-duration"]
if ! duration
if rest_type == "short" then duration=5
if rest_type == "long" then duration=15
app.views.resting.startTimer(duration * 60)

app.collections.states.setCurrentStateName('resting/' + seconds)

Expand Down
1 change: 1 addition & 0 deletions app/views/resting_view.coffee
Expand Up @@ -8,6 +8,7 @@ class exports.RestingView extends Backbone.View

render: ->
@$(@el).html timerTemplate(title: "Resting")
$('#hide').hide()
@$(@el).modal(backdrop: 'static', show: true)

@
Expand Down
1 change: 1 addition & 0 deletions app/views/working_view.coffee
Expand Up @@ -9,6 +9,7 @@ class exports.WorkingView extends Backbone.View

render: ->
@$(@el).html timerTemplate(title: "Working")
$('#hide').show()
@$(@el).modal(backdrop: 'static', show: true)
@

Expand Down
3 changes: 2 additions & 1 deletion manifest.json
Expand Up @@ -13,5 +13,6 @@
},
"name": "Pomodoro Daisuki",
"permissions": [ "notifications", "tabs" ],
"version": "0.45"
"version": "0.45",
"options_page": "build/options.html"
}

0 comments on commit cee0230

Please sign in to comment.