-
-
See your project progress
-
Not sure where to start? Just add a demo repo to see a chart. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.
-
-
{{/projects.list}}
\ No newline at end of file
diff --git a/src/templates/icons.mustache b/src/templates/icons.mustache
new file mode 100644
index 0000000..ea21760
--- /dev/null
+++ b/src/templates/icons.mustache
@@ -0,0 +1,3 @@
+{{#code}}
+
+{{/code}}
\ No newline at end of file
diff --git a/src/templates/layout.mustache b/src/templates/layout.mustache
index 4b81a0a..a917352 100644
--- a/src/templates/layout.mustache
+++ b/src/templates/layout.mustache
@@ -1,11 +1,11 @@
\ No newline at end of file
diff --git a/src/templates/notify.mustache b/src/templates/notify.mustache
new file mode 100644
index 0000000..24a4965
--- /dev/null
+++ b/src/templates/notify.mustache
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/src/templates/pages/addProject.mustache b/src/templates/pages/addProject.mustache
index f5e68e1..36acdaa 100644
--- a/src/templates/pages/addProject.mustache
+++ b/src/templates/pages/addProject.mustache
@@ -1,21 +1,21 @@
-
\ No newline at end of file
diff --git a/src/templates/pages/index.mustache b/src/templates/pages/index.mustache
index dc3f35f..9074e0b 100644
--- a/src/templates/pages/index.mustache
+++ b/src/templates/pages/index.mustache
@@ -1,4 +1,4 @@
\ No newline at end of file
diff --git a/src/templates/pages/showChart.mustache b/src/templates/pages/showChart.mustache
index 3e5f164..6936591 100644
--- a/src/templates/pages/showChart.mustache
+++ b/src/templates/pages/showChart.mustache
@@ -1,13 +1,13 @@
-
-
{{ format.title(milestone.title) }}
-
{{{ format.due(milestone.due_on) }}}
-
{{{ format.markdown(milestone.description) }}}
-
+
+
{{ format.title(milestone.title) }}
+
{{{ format.due(milestone.due_on) }}}
+
{{{ format.markdown(milestone.description) }}}
+
\ No newline at end of file
diff --git a/src/templates/projects.mustache b/src/templates/projects.mustache
index d8da39f..400cb6a 100644
--- a/src/templates/projects.mustache
+++ b/src/templates/projects.mustache
@@ -1,89 +1,89 @@
{{#projects.list.length}}
-
-
-
-
- {{#projects.list}}
- {{#milestones}}
-
- {{owner}}/{{name}} |
-
- {{ title }}
- |
-
-
- {{Math.floor(format.progress(closed_issues, open_issues))}}%
- {{{ format.due(due_on) }}}
-
-
- |
-
- {{/milestones}}
- {{/projects.list}}
-
-
-
-
-
+
+
+
+
+ {{#projects.list}}
+ {{#milestones}}
+
+ {{owner}}/{{name}} |
+
+ {{ title }}
+ |
+
+
+ {{Math.floor(format.progress(closed_issues, open_issues))}}%
+ {{{ format.due(due_on) }}}
+
+
+ |
+
+ {{/milestones}}
+ {{/projects.list}}
+
+
+
+
+
+
{{/projects.list}}
\ No newline at end of file
diff --git a/src/utils/date.coffee b/src/utils/date.coffee
index 2349263..f447e3b 100644
--- a/src/utils/date.coffee
+++ b/src/utils/date.coffee
@@ -1,2 +1,2 @@
module.exports =
- now: -> new Date().toJSON()
\ No newline at end of file
+ now: -> new Date().toJSON()
\ No newline at end of file
diff --git a/src/utils/format.coffee b/src/utils/format.coffee
index 24c23dd..fbbf3a5 100644
--- a/src/utils/format.coffee
+++ b/src/utils/format.coffee
@@ -2,46 +2,50 @@ config = require '../models/config'
module.exports =
- # Progress in percentages.
- 'progress': _.memoize (a, b) ->
- 100 * (a / (b + a))
+ # Progress in percentages.
+ 'progress': _.memoize (a, b) ->
+ 100 * (a / (b + a))
- # Is a milestone on time?
- 'onTime': _.memoize (milestone) ->
- # Milestones with no due date are always on track.
- return 'green' unless milestone.due_on
+ # Is a milestone on time?
+ 'onTime': _.memoize (milestone) ->
+ # Milestones with no due date are always on track.
+ return 'green' unless milestone.due_on
- # Progress in points.
- points = @progress milestone.closed_issues, milestone.open_issues
+ # Progress in points.
+ points = @progress milestone.closed_issues, milestone.open_issues
- # Calculate the progress in days.
- a = +new Date milestone.created_at
- b = +new Date
- c = +new Date milestone.due_on
+ # Calculate the progress in days.
+ a = +new Date milestone.created_at
+ b = +new Date
+ c = +new Date milestone.due_on
- # Progress in time.
- time = @progress b - a, c - b
+ # Progress in time.
+ time = @progress b - a, c - b
- [ 'red', 'green' ][ +(points > time) ]
- , (m) -> # resolver
- [ m.created_at, m.number ].join '/'
+ [ 'red', 'green' ][ +(points > time) ]
+ , (m) -> # resolver
+ [ m.created_at, m.number ].join '/'
- # Time from now.
- 'fromNow': _.memoize (jsonDate) ->
- moment(new Date(jsonDate)).fromNow()
+ # Time from now.
+ 'fromNow': _.memoize (jsonDate) ->
+ moment(new Date(jsonDate)).fromNow()
- # When is a milestone due?
- 'due': (jsonDate) ->
- return ' ' unless jsonDate
- [ 'due', @fromNow jsonDate ].join(' ')
+ # When is a milestone due?
+ 'due': (jsonDate) ->
+ return ' ' unless jsonDate
+ [ 'due', @fromNow jsonDate ].join(' ')
- # Markdown formatting.
- 'markdown': (markup) ->
- marked markup
+ # Markdown formatting.
+ 'markdown': (markup) ->
+ marked markup
- # Format milestone title.
- 'title': (text) ->
- if text.toLowerCase().indexOf('milestone') > -1
- text
- else
- [ 'Milestone', text ].join(' ')
\ No newline at end of file
+ # Format milestone title.
+ 'title': (text) ->
+ if text.toLowerCase().indexOf('milestone') > -1
+ text
+ else
+ [ 'Milestone', text ].join(' ')
+
+ # Hex to decimal.
+ hexToDecimal: (hex) ->
+ parseInt hex, 16
\ No newline at end of file
diff --git a/src/utils/mixins.coffee b/src/utils/mixins.coffee
index c5ea265..69808f9 100644
--- a/src/utils/mixins.coffee
+++ b/src/utils/mixins.coffee
@@ -1,8 +1,8 @@
_.mixin
- 'pluckMany': (source, keys) ->
- throw '`keys` needs to be an Array' unless _.isArray keys
- _.map source, (item) ->
- obj = {}
- _.each keys, (key) ->
- obj[key] = item[key]
- obj
\ No newline at end of file
+ 'pluckMany': (source, keys) ->
+ throw '`keys` needs to be an Array' unless _.isArray keys
+ _.map source, (item) ->
+ obj = {}
+ _.each keys, (key) ->
+ obj[key] = item[key]
+ obj
\ No newline at end of file
diff --git a/src/utils/model.coffee b/src/utils/model.coffee
index b7bc96f..9ea2f55 100644
--- a/src/utils/model.coffee
+++ b/src/utils/model.coffee
@@ -1,5 +1,5 @@
module.exports = (opts) ->
- Model = Ractive.extend(opts)
- model = new Model()
- model.render()
- model
\ No newline at end of file
+ Model = Ractive.extend(opts)
+ model = new Model()
+ model.render()
+ model
\ No newline at end of file
diff --git a/src/views/header.coffee b/src/views/header.coffee
index f2e2422..07f6a30 100644
--- a/src/views/header.coffee
+++ b/src/views/header.coffee
@@ -1,17 +1,28 @@
firebase = require '../modules/firebase'
mediator = require '../modules/mediator'
user = require '../models/user'
+state = require '../models/state'
+Icons = require './icons'
module.exports = Ractive.extend
- 'template': require '../templates/header'
+ 'template': require '../templates/header'
- init: ->
- # Login user.
- @on '!login', ->
- firebase.login (err) ->
- throw err if err
+ 'data':
+ 'user': user
+ # Default app icon.
+ 'icon': 'fire-station'
- 'data': { user }
+ init: ->
+ # Login user.
+ @on '!login', ->
+ firebase.login (err) ->
+ throw err if err
- 'adapt': [ Ractive.adaptors.Ractive ]
\ No newline at end of file
+ # Switch loading icon with app icon.
+ state.observe 'loading', (val) =>
+ @set 'icon', if val then 'spin4' else 'fire-station'
+
+ 'components': { Icons }
+
+ 'adapt': [ Ractive.adaptors.Ractive ]
\ No newline at end of file
diff --git a/src/views/hero.coffee b/src/views/hero.coffee
index 2b39e43..dbd36ea 100644
--- a/src/views/hero.coffee
+++ b/src/views/hero.coffee
@@ -1,10 +1,13 @@
mediator = require '../modules/mediator'
projects = require '../models/projects'
+Icons = require './icons'
module.exports = Ractive.extend
- 'template': require '../templates/hero'
+ 'template': require '../templates/hero'
- 'data': { projects }
+ 'data': { projects }
- 'adapt': [ Ractive.adaptors.Ractive ]
\ No newline at end of file
+ 'components': { Icons }
+
+ 'adapt': [ Ractive.adaptors.Ractive ]
\ No newline at end of file
diff --git a/src/views/icons.coffee b/src/views/icons.coffee
new file mode 100644
index 0000000..0454e2a
--- /dev/null
+++ b/src/views/icons.coffee
@@ -0,0 +1,28 @@
+utils = require '../utils/format'
+
+# Fontello icon hex codes.
+codes =
+ 'cog': '\e800'
+ 'search': '\e801'
+ 'github': '\e802'
+ 'address': '\e803'
+ 'plus-circled': '\e804'
+ 'fire-station': '\e805'
+ 'sort-alphabet': '\e806'
+ 'down-open': '\e807'
+ 'spin6': '\e808'
+ 'megaphone': '\e809'
+ 'spin4': '\e80a'
+
+module.exports = Ractive.extend
+
+ 'template': require '../templates/icons'
+
+ 'isolated': yes
+
+ init: ->
+ @observe 'icon', (icon) ->
+ if icon and hex = codes[icon]
+ @set 'code', utils.hexToDecimal hex
+ else
+ @set 'code', null
\ No newline at end of file
diff --git a/src/views/pages/addProject.coffee b/src/views/pages/addProject.coffee
index 23527d6..a598c38 100644
--- a/src/views/pages/addProject.coffee
+++ b/src/views/pages/addProject.coffee
@@ -3,29 +3,29 @@ user = require '../../models/user'
module.exports = Ractive.extend
- 'template': require '../../templates/pages/addProject'
+ 'template': require '../../templates/pages/addProject'
- 'data': { 'value': 'radekstepan/disposable', user }
+ 'data': { 'value': 'radekstepan/disposable', user }
- 'adapt': [ Ractive.adaptors.Ractive ]
+ 'adapt': [ Ractive.adaptors.Ractive ]
- init: ->
- document.title = 'Add a new project'
+ init: ->
+ document.title = 'Add a new project'
- # TODO: autocomplete on our username if we are logged in or based
- # on repos we already have.
- autocomplete = (value) ->
+ # TODO: autocomplete on our username if we are logged in or based
+ # on repos we already have.
+ autocomplete = (value) ->
- @observe 'value', _.debounce(autocomplete, 200), { 'init': no }
+ @observe 'value', _.debounce(autocomplete, 200), { 'init': no }
- # TODO: focus on the input field
+ # TODO: focus on the input field
- # TODO: listen to Enter keypress.
- @on 'submit', ->
- [ owner, name ] = @get('value').split('/')
+ # TODO: listen to Enter keypress.
+ @on 'submit', ->
+ [ owner, name ] = @get('value').split('/')
- # TODO: save repo & persist.
- mediator.fire '!projects/add', { owner, name }, ->
- # Redirect to the dashboard.
- # TODO: trigger a named route
- window.location.hash = '#'
\ No newline at end of file
+ # TODO: save repo & persist.
+ mediator.fire '!projects/add', { owner, name }, ->
+ # Redirect to the dashboard.
+ # TODO: trigger a named route
+ window.location.hash = '#'
\ No newline at end of file
diff --git a/src/views/pages/index.coffee b/src/views/pages/index.coffee
index 44e07eb..ab26937 100644
--- a/src/views/pages/index.coffee
+++ b/src/views/pages/index.coffee
@@ -4,11 +4,11 @@ format = require '../../utils/format'
module.exports = Ractive.extend
- 'template': require '../../templates/pages/index'
+ 'template': require '../../templates/pages/index'
- 'components': { Hero, Projects }
+ 'components': { Hero, Projects }
- 'data': { format }
+ 'data': { format }
- init: ->
- document.title = 'BurnChart: GitHub Burndown Chart as a Service'
\ No newline at end of file
+ init: ->
+ document.title = 'BurnChart: GitHub Burndown Chart as a Service'
\ No newline at end of file
diff --git a/src/views/pages/showChart.coffee b/src/views/pages/showChart.coffee
index 5aca0dd..b1ada07 100644
--- a/src/views/pages/showChart.coffee
+++ b/src/views/pages/showChart.coffee
@@ -4,24 +4,24 @@ format = require '../../utils/format'
module.exports = Ractive.extend
- 'template': require '../../templates/pages/showChart'
+ 'template': require '../../templates/pages/showChart'
- 'adapt': [ Ractive.adaptors.Ractive ]
+ 'adapt': [ Ractive.adaptors.Ractive ]
- 'data': { format }
+ 'data': { format }
- init: ->
- route = @get 'route'
-
- document.title = "#{route.owner}/#{route.name}"
+ init: ->
+ route = @get 'route'
+
+ document.title = "#{route.owner}/#{route.name}"
- milestone.get route, (err, warn, obj) =>
- throw err if err
- throw warn if warn
- # Save the milestone on the route.
- @set 'milestone', obj
- route.milestone = obj
+ milestone.get route, (err, warn, obj) =>
+ throw err if err
+ throw warn if warn
+ # Save the milestone on the route.
+ @set 'milestone', obj
+ route.milestone = obj
- project route, (err) ->
- throw err if err
- console.log 'Done'
\ No newline at end of file
+ project route, (err) ->
+ throw err if err
+ console.log 'Done'
\ No newline at end of file
diff --git a/src/views/projects.coffee b/src/views/projects.coffee
index 181927d..34a8a1e 100644
--- a/src/views/projects.coffee
+++ b/src/views/projects.coffee
@@ -1,10 +1,13 @@
mediator = require '../modules/mediator'
projects = require '../models/projects'
+Icons = require './icons'
module.exports = Ractive.extend
- 'template': require '../templates/projects'
+ 'template': require '../templates/projects'
- 'data': { projects }
+ 'data': { projects }
- 'adapt': [ Ractive.adaptors.Ractive ]
\ No newline at end of file
+ 'components': { Icons }
+
+ 'adapt': [ Ractive.adaptors.Ractive ]
\ No newline at end of file