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-ractive/index.js'
'vendor/firebase/firebase.js'
'vendor/firebase-simple-login/firebase-simple-login.js'
'vendor/superagent/superagent.js'
'vendor/lscache/lscache.js'
'vendor/async/lib/async.js'

View File

@ -23,8 +23,6 @@
###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
- [ ] on chart page show a little progress bar in the title
- [ ] add a chart straight from the hero banner
##Backlog
@ -53,7 +51,7 @@
- [ ] `rails/rails/24` has issues in two clusters as if merged from two milestones
- [ ] 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
@ -70,6 +68,8 @@
###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`
- [ ] 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.

View File

@ -6,8 +6,7 @@
"d3": "~3.4.11",
"d3-tip": "~0.6.5",
"director": "~1.2.2",
"firebase": "~1.0.21",
"firebase-simple-login": "~1.6.3",
"firebase": "~1.1.2",
"lodash": "2.3.0",
"lscache": "~1.0.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}
#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 .sup{color:#b1b6c4}
#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}
#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}
#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 .sup{color:#b1b6c4}
#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}
#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'
user = require './user.coffee'
@ -8,30 +8,35 @@ module.exports = new Model
'name': 'models/firebase'
auth: ->
throw 'Not overriden'
# Login a user.
login: (cb) ->
# Login.
@auth.login config.data.provider,
cb 'Not ready yet' unless @data.client
@data.client.authWithOAuthPopup "github", (err, authData) =>
return @publish '!app/notify', {
'text': do err.toString
'type': 'alert'
'system': yes
} if err
@onAuth authData
,
'rememberMe': yes
'scope': 'private_repo'
onAuth: (authData) ->
# Save user.
user.set authData
# Say we are done.
user.set 'ready', yes
# Logout a user.
logout: ->
@auth?.logout
do user.reset
throw 'Implement'
onrender: ->
# Setup a new client.
@set 'client', client = new Firebase "https://#{config.data.firebase}.firebaseio.com"
# Check if we have a user in session.
@auth = new FirebaseSimpleLogin client, (err, obj) ->
throw err if err
# Save user.
user.set obj if obj
# Say we are done.
user.set 'ready', yes
# When user is authenticated.
client.onAuth @onAuth

View File

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

View File

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

View File

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

View File

@ -2,7 +2,15 @@
<div id="add">
<div class="header">
<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 class="form">

View File

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

View File

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