update to the latest firebase

This commit is contained in:
Radek Stepan 2014-10-25 13:38:56 -07:00
parent d096365f48
commit 9a4080b42e
14 changed files with 916 additions and 1027 deletions

View File

@ -22,7 +22,6 @@ module.exports = (grunt) ->
'vendor/ractive-transitions-fade/ractive-transitions-fade.js' 'vendor/ractive-transitions-fade/ractive-transitions-fade.js'
'vendor/ractive-ractive/index.js' 'vendor/ractive-ractive/index.js'
'vendor/firebase/firebase.js' 'vendor/firebase/firebase.js'
'vendor/firebase-simple-login/firebase-simple-login.js'
'vendor/superagent/superagent.js' 'vendor/superagent/superagent.js'
'vendor/lscache/lscache.js' 'vendor/lscache/lscache.js'
'vendor/async/lib/async.js' 'vendor/async/lib/async.js'

View File

@ -23,8 +23,6 @@
###Misc ###Misc
- [ ] the deploy script needs to disable autoreload; `make watch` should start a static web server and also launch a build script with a flag saying which files to include in the head (uncompressed, with live reload); standard build script should minify scripts - [ ] the deploy script needs to disable autoreload; `make watch` should start a static web server and also launch a build script with a flag saying which files to include in the head (uncompressed, with live reload); standard build script should minify scripts
- [ ] on chart page show a little progress bar in the title
- [ ] add a chart straight from the hero banner
##Backlog ##Backlog
@ -53,7 +51,7 @@
- [ ] `rails/rails/24` has issues in two clusters as if merged from two milestones - [ ] `rails/rails/24` has issues in two clusters as if merged from two milestones
- [ ] trendline cutting into axes - [ ] trendline cutting into axes
- [ ] Browserify does not generate source maps - [ ] topbar messages set position from `top`, does not work when we have scrolled on the page; show sticky to the top and move with our scroll; at the very least make them show up at the top and not be hidden
###Error Handling ###Error Handling
@ -70,6 +68,8 @@
###Misc ###Misc
- [ ] add a chart straight from the hero banner
- [ ] on chart page show a little progress bar in the title
- [ ] use tap plugin for `Ractive` - [ ] use tap plugin for `Ractive`
- [ ] the app bundle (albeit uncompressed) clocks in at 1.5MB, reduce the size (`d3` is huge (use [grunt-smash](https://github.com/cvisco/grunt-smash), [docs here](https://github.com/mbostock/smash/wiki)), `localForage` not nedded) - [ ] the app bundle (albeit uncompressed) clocks in at 1.5MB, reduce the size (`d3` is huge (use [grunt-smash](https://github.com/cvisco/grunt-smash), [docs here](https://github.com/mbostock/smash/wiki)), `localForage` not nedded)
- [ ] make the names consistent, reuse code, template etc. - [ ] make the names consistent, reuse code, template etc.

View File

@ -6,8 +6,7 @@
"d3": "~3.4.11", "d3": "~3.4.11",
"d3-tip": "~0.6.5", "d3-tip": "~0.6.5",
"director": "~1.2.2", "director": "~1.2.2",
"firebase": "~1.0.21", "firebase": "~1.1.2",
"firebase-simple-login": "~1.6.3",
"lodash": "2.3.0", "lodash": "2.3.0",
"lscache": "~1.0.2", "lscache": "~1.0.2",
"marked": "~0.3.2", "marked": "~0.3.2",

View File

@ -476,7 +476,6 @@ ul li{display:inline-block}
#head .right a{-webkit-border-radius:2px;border-radius:2px;background:#ffbb2a;color:#c1041c;padding:11px 20px} #head .right a{-webkit-border-radius:2px;border-radius:2px;background:#ffbb2a;color:#c1041c;padding:11px 20px}
#title{border-bottom:3px solid #f3f4f8;} #title{border-bottom:3px solid #f3f4f8;}
#title .title{border-bottom:3px solid #aaafbf;margin:30px 0 -3px 0;display:inline-block;padding-bottom:20px} #title .title{border-bottom:3px solid #aaafbf;margin:30px 0 -3px 0;display:inline-block;padding-bottom:20px}
#title .sup{color:#b1b6c4}
#title .sub{font-size:16px;font-weight:bold;margin:0 20px} #title .sub{font-size:16px;font-weight:bold;margin:0 20px}
#title .description{display:inline-block;font-family:'MuseoSlab500Regular',serif;white-space:nowrap;color:#b1b6c4} #title .description{display:inline-block;font-family:'MuseoSlab500Regular',serif;white-space:nowrap;color:#b1b6c4}
#page{padding-bottom:80px;} #page{padding-bottom:80px;}

View File

@ -69,7 +69,6 @@ ul li{display:inline-block}
#head .right a{-webkit-border-radius:2px;border-radius:2px;background:#ffbb2a;color:#c1041c;padding:11px 20px} #head .right a{-webkit-border-radius:2px;border-radius:2px;background:#ffbb2a;color:#c1041c;padding:11px 20px}
#title{border-bottom:3px solid #f3f4f8;} #title{border-bottom:3px solid #f3f4f8;}
#title .title{border-bottom:3px solid #aaafbf;margin:30px 0 -3px 0;display:inline-block;padding-bottom:20px} #title .title{border-bottom:3px solid #aaafbf;margin:30px 0 -3px 0;display:inline-block;padding-bottom:20px}
#title .sup{color:#b1b6c4}
#title .sub{font-size:16px;font-weight:bold;margin:0 20px} #title .sub{font-size:16px;font-weight:bold;margin:0 20px}
#title .description{display:inline-block;font-family:'MuseoSlab500Regular',serif;white-space:nowrap;color:#b1b6c4} #title .description{display:inline-block;font-family:'MuseoSlab500Regular',serif;white-space:nowrap;color:#b1b6c4}
#page{padding-bottom:80px;} #page{padding-bottom:80px;}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
{ Firebase, FirebaseSimpleLogin } = require '../modules/vendor.coffee' { Firebase } = require '../modules/vendor.coffee'
Model = require '../utils/ractive/model.coffee' Model = require '../utils/ractive/model.coffee'
user = require './user.coffee' user = require './user.coffee'
@ -8,30 +8,35 @@ module.exports = new Model
'name': 'models/firebase' 'name': 'models/firebase'
auth: ->
throw 'Not overriden'
# Login a user. # Login a user.
login: (cb) -> login: (cb) ->
# Login. cb 'Not ready yet' unless @data.client
@auth.login config.data.provider,
@data.client.authWithOAuthPopup "github", (err, authData) =>
return @publish '!app/notify', {
'text': do err.toString
'type': 'alert'
'system': yes
} if err
@onAuth authData
,
'rememberMe': yes 'rememberMe': yes
'scope': 'private_repo' 'scope': 'private_repo'
onAuth: (authData) ->
# Save user.
user.set authData
# Say we are done.
user.set 'ready', yes
# Logout a user. # Logout a user.
logout: -> logout: ->
@auth?.logout throw 'Implement'
do user.reset
onrender: -> onrender: ->
# Setup a new client. # Setup a new client.
@set 'client', client = new Firebase "https://#{config.data.firebase}.firebaseio.com" @set 'client', client = new Firebase "https://#{config.data.firebase}.firebaseio.com"
# Check if we have a user in session. # When user is authenticated.
@auth = new FirebaseSimpleLogin client, (err, obj) -> client.onAuth @onAuth
throw err if err
# Save user.
user.set obj if obj
# Say we are done.
user.set 'ready', yes

View File

@ -4,10 +4,3 @@ Model = require '../utils/ractive/model.coffee'
module.exports = new Model module.exports = new Model
'name': 'models/user' 'name': 'models/user'
# Default to a local user.
'data':
'provider': "local"
'id': "0"
'uid': "local:0"
'token': null

View File

@ -3,7 +3,6 @@ module.exports =
'_': window._ '_': window._
'Ractive': window.Ractive 'Ractive': window.Ractive
'Firebase': window.Firebase 'Firebase': window.Firebase
'FirebaseSimpleLogin': window.FirebaseSimpleLogin
'SuperAgent': window.superagent 'SuperAgent': window.superagent
'async': window.async 'async': window.async
'moment': window.moment 'moment': window.moment

View File

@ -2,11 +2,11 @@
{{#with user}} {{#with user}}
{{#ready}} {{#ready}}
<div class="right" intro="fade"> <div class="right" intro="fade">
{{#displayName}} {{#uid}}
{{displayName}} logged in {{github.displayName}} logged in
{{else}} {{else}}
<a class="github" on-click="!login"><Icons icon="github"/> Sign In</a> <a class="github" on-click="!login"><Icons icon="github"/> Sign In</a>
{{/displayName}} {{/uid}}
</div> </div>
{{/ready}} {{/ready}}
{{/with}} {{/with}}

View File

@ -2,7 +2,15 @@
<div id="add"> <div id="add">
<div class="header"> <div class="header">
<h2>Add a Project</h2> <h2>Add a Project</h2>
<p>Type in the name of the repository as you would normally. If you'd like to add a private GitHub project, <a href="#">Sign In</a> first.</p> <p>Type in the name of the repository as you would normally.
{{#with user}}
{{#ready}}
{{^uid}}
If you'd like to add a private GitHub project, <a on-click="!login">Sign In</a> first.
{{/uid}}
{{/ready}}
{{/with}}
</p>
</div> </div>
<div class="form"> <div class="form">

View File

@ -23,8 +23,7 @@ module.exports = Ractive.extend
onconstruct: -> onconstruct: ->
# Login user. # Login user.
@on '!login', -> @on '!login', ->
firebase.login (err) -> do firebase.login
throw err if err
onrender: -> onrender: ->
# Switch loading icon with app icon. # Switch loading icon with app icon.

View File

@ -1,6 +1,7 @@
{ _, Ractive } = require '../../modules/vendor.coffee' { _, Ractive } = require '../../modules/vendor.coffee'
Eventful = require '../../utils/ractive/eventful.coffee' Eventful = require '../../utils/ractive/eventful.coffee'
firebase = require '../../models/firebase.coffee'
system = require '../../models/system.coffee' system = require '../../models/system.coffee'
user = require '../../models/user.coffee' user = require '../../models/user.coffee'
key = require '../../utils/key.coffee' key = require '../../utils/key.coffee'
@ -28,6 +29,11 @@ module.exports = Eventful.extend
# TODO: trigger a named route # TODO: trigger a named route
window.location.hash = '#' window.location.hash = '#'
onconstruct: ->
# Login user.
@on '!login', ->
do firebase.login
onrender: -> onrender: ->
document.title = 'Add a new project' document.title = 'Add a new project'