Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
3dd6105b
Commit
3dd6105b
authored
Mar 23, 2015
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pr/1103'
Close #1103
parents
e5adfb0c
189da5c8
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
15699 additions
and
9996 deletions
+15699
-9996
examples/firebase-angular/.gitignore
examples/firebase-angular/.gitignore
+13
-0
examples/firebase-angular/bower.json
examples/firebase-angular/bower.json
+0
-15
examples/firebase-angular/bower_components/angular-mocks/angular-mocks.js
...e-angular/bower_components/angular-mocks/angular-mocks.js
+0
-2136
examples/firebase-angular/bower_components/angular/bower.json
...ples/firebase-angular/bower_components/angular/bower.json
+0
-7
examples/firebase-angular/bower_components/angularfire/angularfire.js
...ebase-angular/bower_components/angularfire/angularfire.js
+0
-779
examples/firebase-angular/bower_components/todomvc-common/bg.png
...s/firebase-angular/bower_components/todomvc-common/bg.png
+0
-0
examples/firebase-angular/index.html
examples/firebase-angular/index.html
+12
-10
examples/firebase-angular/js/controllers/todoCtrl.js
examples/firebase-angular/js/controllers/todoCtrl.js
+26
-34
examples/firebase-angular/node_modules/angular/angular.js
examples/firebase-angular/node_modules/angular/angular.js
+12768
-7013
examples/firebase-angular/node_modules/angularfire/dist/angularfire.js
...base-angular/node_modules/angularfire/dist/angularfire.js
+2313
-0
examples/firebase-angular/node_modules/todomvc-app-css/index.css
...s/firebase-angular/node_modules/todomvc-app-css/index.css
+388
-0
examples/firebase-angular/node_modules/todomvc-common/base.css
...les/firebase-angular/node_modules/todomvc-common/base.css
+141
-0
examples/firebase-angular/node_modules/todomvc-common/base.js
...ples/firebase-angular/node_modules/todomvc-common/base.js
+27
-0
examples/firebase-angular/package.json
examples/firebase-angular/package.json
+9
-0
examples/firebase-angular/readme.md
examples/firebase-angular/readme.md
+2
-2
No files found.
examples/firebase-angular/.gitignore
0 → 100644
View file @
3dd6105b
node_modules/angular/*
!node_modules/angular/angular.js
node_modules/angularfire/*
node_modules/angularfire/dist/*
!node_modules/angularfire/dist/angularfire.js
node_modules/todomvc-app-css/*
!node_modules/todomvc-app-css/index.css
node_modules/todomvc-common/*
!node_modules/todomvc-common/base.css
!node_modules/todomvc-common/base.js
examples/firebase-angular/bower.json
deleted
100644 → 0
View file @
e5adfb0c
{
"name"
:
"todomvc-angular"
,
"version"
:
"0.0.0"
,
"dependencies"
:
{
"angular"
:
"1.2.8"
,
"angularfire"
:
"~0.5.0"
,
"todomvc-common"
:
"~0.3.0"
},
"devDependencies"
:
{
"angular-mocks"
:
"1.2.8"
},
"resolutions"
:
{
"angular"
:
"1.2.8"
}
}
examples/firebase-angular/bower_components/angular-mocks/angular-mocks.js
deleted
100644 → 0
View file @
e5adfb0c
This diff is collapsed.
Click to expand it.
examples/firebase-angular/bower_components/angular/bower.json
deleted
100644 → 0
View file @
e5adfb0c
{
"name"
:
"angular"
,
"version"
:
"1.2.8"
,
"main"
:
"./angular.js"
,
"dependencies"
:
{
}
}
examples/firebase-angular/bower_components/angularfire/angularfire.js
deleted
100644 → 0
View file @
e5adfb0c
This diff is collapsed.
Click to expand it.
examples/firebase-angular/bower_components/todomvc-common/bg.png
deleted
100644 → 0
View file @
e5adfb0c
2.08 KB
examples/firebase-angular/index.html
View file @
3dd6105b
...
...
@@ -3,7 +3,8 @@
<head>
<meta
charset=
"utf-8"
>
<title>
Firebase
&
AngularJS • TodoMVC
</title>
<link
rel=
"stylesheet"
href=
"bower_components/todomvc-common/base.css"
>
<link
rel=
"stylesheet"
href=
"node_modules/todomvc-common/base.css"
>
<link
rel=
"stylesheet"
href=
"node_modules/todomvc-app-css/index.css"
>
<style>
[
ng-cloak
]
{
display
:
none
;
}
</style>
</head>
<body>
...
...
@@ -20,12 +21,12 @@
<ul
id=
"todo-list"
>
<li
ng-repeat=
"(id, todo) in todos | todoFilter"
ng-class=
"{completed: todo.completed, editing: todo == editedTodo}"
>
<div
class=
"view"
>
<input
class=
"toggle"
type=
"checkbox"
ng-model=
"todo.completed"
ng-change=
"todos.$save(
id
)"
>
<label
ng-dblclick=
"editTodo(
id
)"
>
{{todo.title}}
</label>
<button
class=
"destroy"
ng-click=
"removeTodo(
id
)"
></button>
<input
class=
"toggle"
type=
"checkbox"
ng-model=
"todo.completed"
ng-change=
"todos.$save(
todo
)"
>
<label
ng-dblclick=
"editTodo(
todo
)"
>
{{todo.title}}
</label>
<button
class=
"destroy"
ng-click=
"removeTodo(
todo
)"
></button>
</div>
<form
ng-submit=
"doneEditing(
id
)"
>
<input
class=
"edit"
ng-model=
"todo.title"
todo-escape=
"revertEditing(
id)"
todo-blur=
"doneEditing(id
)"
todo-focus=
"todo == editedTodo"
>
<form
ng-submit=
"doneEditing(
todo
)"
>
<input
class=
"edit"
ng-model=
"todo.title"
todo-escape=
"revertEditing(
todo)"
todo-blur=
"doneEditing(todo
)"
todo-focus=
"todo == editedTodo"
>
</form>
</li>
</ul>
...
...
@@ -53,15 +54,16 @@
<p>
Credits:
<a
href=
"http://twitter.com/cburgdorf"
>
Christoph Burgdorf
</a>
,
<a
href=
"http://ericbidelman.com"
>
Eric Bidelman
</a>
,
<a
href=
"http://twitter.com/_davideast"
>
David East
</a>
,
<a
href=
"http://jacobmumm.com"
>
Jacob Mumm
</a>
and
<a
href=
"http://igorminar.com"
>
Igor Minar
</a>
</p>
<p>
Part of
<a
href=
"http://todomvc.com"
>
TodoMVC
</a></p>
</footer>
<script
src=
"
https://cdn.firebase.com/v0
/firebase.js"
></script>
<script
src=
"
bower_component
s/todomvc-common/base.js"
></script>
<script
src=
"
bower_component
s/angular/angular.js"
></script>
<script
src=
"
bower_components/angularfire
/angularfire.js"
></script>
<script
src=
"
//cdn.firebase.com/js/client/2.2.2
/firebase.js"
></script>
<script
src=
"
node_module
s/todomvc-common/base.js"
></script>
<script
src=
"
node_module
s/angular/angular.js"
></script>
<script
src=
"
node_modules/angularfire/dist
/angularfire.js"
></script>
<script
src=
"js/app.js"
></script>
<script
src=
"js/controllers/todoCtrl.js"
></script>
<script
src=
"js/directives/todoFocus.js"
></script>
...
...
examples/firebase-angular/js/controllers/todoCtrl.js
View file @
3dd6105b
...
...
@@ -3,18 +3,22 @@
/**
* The main controller for the app. The controller:
* - retrieves and persists the model via the $firebase service
* - retrieves and persists the model via the $firebase
Array
service
* - exposes the model to the template and provides event handlers
*/
todomvc
.
controller
(
'
TodoCtrl
'
,
function
TodoCtrl
(
$scope
,
$location
,
$firebase
)
{
var
url
=
'
https://todomvc-angular.firebaseio.com/
'
;
todomvc
.
controller
(
'
TodoCtrl
'
,
function
TodoCtrl
(
$scope
,
$location
,
$firebase
Array
)
{
var
url
=
'
https://todomvc-angular.firebaseio.com/
todos
'
;
var
fireRef
=
new
Firebase
(
url
);
// Bind the todos to the firebase provider.
$scope
.
todos
=
$firebaseArray
(
fireRef
);
$scope
.
newTodo
=
''
;
$scope
.
editedTodo
=
null
;
$scope
.
$watch
(
'
todos
'
,
function
()
{
var
total
=
0
;
var
remaining
=
0
;
$scope
.
todos
.
$getIndex
().
forEach
(
function
(
index
)
{
var
todo
=
$scope
.
todos
[
index
];
$scope
.
todos
.
forEach
(
function
(
todo
)
{
// Skip invalid entries so they don't break the entire app.
if
(
!
todo
||
!
todo
.
title
)
{
return
;
...
...
@@ -43,59 +47,47 @@ todomvc.controller('TodoCtrl', function TodoCtrl($scope, $location, $firebase) {
$scope
.
newTodo
=
''
;
};
$scope
.
editTodo
=
function
(
id
)
{
$scope
.
editedTodo
=
$scope
.
todos
[
id
]
;
$scope
.
editTodo
=
function
(
todo
)
{
$scope
.
editedTodo
=
todo
;
$scope
.
originalTodo
=
angular
.
extend
({},
$scope
.
editedTodo
);
};
$scope
.
doneEditing
=
function
(
id
)
{
$scope
.
doneEditing
=
function
(
todo
)
{
$scope
.
editedTodo
=
null
;
var
title
=
$scope
.
todos
[
id
]
.
title
.
trim
();
var
title
=
todo
.
title
.
trim
();
if
(
title
)
{
$scope
.
todos
.
$save
(
id
);
$scope
.
todos
.
$save
(
todo
);
}
else
{
$scope
.
removeTodo
(
id
);
$scope
.
removeTodo
(
todo
);
}
};
$scope
.
revertEditing
=
function
(
id
)
{
$scope
.
todos
[
id
]
=
$scope
.
originalTodo
;
$scope
.
doneEditing
(
id
);
};
$scope
.
removeTodo
=
function
(
id
)
{
$scope
.
todos
.
$remove
(
id
);
$scope
.
revertEditing
=
function
(
todo
)
{
todo
.
title
=
$scope
.
originalTodo
.
title
;
$scope
.
doneEditing
(
todo
);
};
$scope
.
toggleCompleted
=
function
(
id
)
{
var
todo
=
$scope
.
todos
[
id
];
todo
.
completed
=
!
todo
.
completed
;
$scope
.
todos
.
$save
(
id
);
$scope
.
removeTodo
=
function
(
todo
)
{
$scope
.
todos
.
$remove
(
todo
);
};
$scope
.
clearCompletedTodos
=
function
()
{
angular
.
forEach
(
$scope
.
todos
.
$getIndex
(),
function
(
index
)
{
if
(
$scope
.
todos
[
index
]
.
completed
)
{
$scope
.
todos
.
$remove
(
index
);
$scope
.
todos
.
forEach
(
function
(
todo
)
{
if
(
todo
.
completed
)
{
$scope
.
removeTodo
(
todo
);
}
});
};
$scope
.
markAll
=
function
(
allCompleted
)
{
angular
.
forEach
(
$scope
.
todos
.
$getIndex
(),
function
(
index
)
{
$scope
.
todos
[
index
].
completed
=
!
allCompleted
;
$scope
.
todos
.
forEach
(
function
(
todo
)
{
todo
.
completed
=
allCompleted
;
$scope
.
todos
.
$save
(
todo
);
});
$scope
.
todos
.
$save
();
};
$scope
.
newTodo
=
''
;
$scope
.
editedTodo
=
null
;
if
(
$location
.
path
()
===
''
)
{
$location
.
path
(
'
/
'
);
}
$scope
.
location
=
$location
;
// Bind the todos to the firebase provider.
$scope
.
todos
=
$firebase
(
fireRef
);
});
examples/firebase-angular/
bower_component
s/angular/angular.js
→
examples/firebase-angular/
node_module
s/angular/angular.js
View file @
3dd6105b
This diff is collapsed.
Click to expand it.
examples/firebase-angular/node_modules/angularfire/dist/angularfire.js
0 → 100644
View file @
3dd6105b
This diff is collapsed.
Click to expand it.
examples/firebase-angular/
bower_components/todomvc-common/base
.css
→
examples/firebase-angular/
node_modules/todomvc-app-css/index
.css
View file @
3dd6105b
This diff is collapsed.
Click to expand it.
examples/firebase-angular/node_modules/todomvc-common/base.css
0 → 100644
View file @
3dd6105b
hr
{
margin
:
20px
0
;
border
:
0
;
border-top
:
1px
dashed
#c5c5c5
;
border-bottom
:
1px
dashed
#f7f7f7
;
}
.learn
a
{
font-weight
:
normal
;
text-decoration
:
none
;
color
:
#b83f45
;
}
.learn
a
:hover
{
text-decoration
:
underline
;
color
:
#787e7e
;
}
.learn
h3
,
.learn
h4
,
.learn
h5
{
margin
:
10px
0
;
font-weight
:
500
;
line-height
:
1.2
;
color
:
#000
;
}
.learn
h3
{
font-size
:
24px
;
}
.learn
h4
{
font-size
:
18px
;
}
.learn
h5
{
margin-bottom
:
0
;
font-size
:
14px
;
}
.learn
ul
{
padding
:
0
;
margin
:
0
0
30px
25px
;
}
.learn
li
{
line-height
:
20px
;
}
.learn
p
{
font-size
:
15px
;
font-weight
:
300
;
line-height
:
1.3
;
margin-top
:
0
;
margin-bottom
:
0
;
}
#issue-count
{
display
:
none
;
}
.quote
{
border
:
none
;
margin
:
20px
0
60px
0
;
}
.quote
p
{
font-style
:
italic
;
}
.quote
p
:before
{
content
:
'“'
;
font-size
:
50px
;
opacity
:
.15
;
position
:
absolute
;
top
:
-20px
;
left
:
3px
;
}
.quote
p
:after
{
content
:
'”'
;
font-size
:
50px
;
opacity
:
.15
;
position
:
absolute
;
bottom
:
-42px
;
right
:
3px
;
}
.quote
footer
{
position
:
absolute
;
bottom
:
-40px
;
right
:
0
;
}
.quote
footer
img
{
border-radius
:
3px
;
}
.quote
footer
a
{
margin-left
:
5px
;
vertical-align
:
middle
;
}
.speech-bubble
{
position
:
relative
;
padding
:
10px
;
background
:
rgba
(
0
,
0
,
0
,
.04
);
border-radius
:
5px
;
}
.speech-bubble
:after
{
content
:
''
;
position
:
absolute
;
top
:
100%
;
right
:
30px
;
border
:
13px
solid
transparent
;
border-top-color
:
rgba
(
0
,
0
,
0
,
.04
);
}
.learn-bar
>
.learn
{
position
:
absolute
;
width
:
272px
;
top
:
8px
;
left
:
-300px
;
padding
:
10px
;
border-radius
:
5px
;
background-color
:
rgba
(
255
,
255
,
255
,
.6
);
transition-property
:
left
;
transition-duration
:
500ms
;
}
@media
(
min-width
:
899px
)
{
.learn-bar
{
width
:
auto
;
padding-left
:
300px
;
}
.learn-bar
>
.learn
{
left
:
8px
;
}
}
examples/firebase-angular/
bower_component
s/todomvc-common/base.js
→
examples/firebase-angular/
node_module
s/todomvc-common/base.js
View file @
3dd6105b
/* global _ */
(
function
()
{
'
use strict
'
;
/* jshint ignore:start */
// Underscore's Template Module
// Courtesy of underscorejs.org
var
_
=
(
function
(
_
)
{
...
...
@@ -114,6 +116,7 @@
if
(
location
.
hostname
===
'
todomvc.com
'
)
{
window
.
_gaq
=
[[
'
_setAccount
'
,
'
UA-31081062-1
'
],[
'
_trackPageview
'
]];(
function
(
d
,
t
){
var
g
=
d
.
createElement
(
t
),
s
=
d
.
getElementsByTagName
(
t
)[
0
];
g
.
src
=
'
//www.google-analytics.com/ga.js
'
;
s
.
parentNode
.
insertBefore
(
g
,
s
)}(
document
,
'
script
'
));
}
/* jshint ignore:end */
function
redirect
()
{
if
(
location
.
hostname
===
'
tastejs.github.io
'
)
{
...
...
@@ -175,13 +178,17 @@
if
(
learnJSON
.
backend
)
{
this
.
frameworkJSON
=
learnJSON
.
backend
;
this
.
frameworkJSON
.
issueLabel
=
framework
;
this
.
append
({
backend
:
true
});
}
else
if
(
learnJSON
[
framework
])
{
this
.
frameworkJSON
=
learnJSON
[
framework
];
this
.
frameworkJSON
.
issueLabel
=
framework
;
this
.
append
();
}
this
.
fetchIssueCount
();
}
Learn
.
prototype
.
append
=
function
(
opts
)
{
...
...
@@ -212,6 +219,26 @@
document
.
body
.
insertAdjacentHTML
(
'
afterBegin
'
,
aside
.
outerHTML
);
};
Learn
.
prototype
.
fetchIssueCount
=
function
()
{
var
issueLink
=
document
.
getElementById
(
'
issue-count-link
'
);
if
(
issueLink
)
{
var
url
=
issueLink
.
href
.
replace
(
'
https://github.com
'
,
'
https://api.github.com/repos
'
);
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
function
(
e
)
{
var
parsedResponse
=
JSON
.
parse
(
e
.
target
.
responseText
);
if
(
parsedResponse
instanceof
Array
)
{
var
count
=
parsedResponse
.
length
if
(
count
!==
0
)
{
issueLink
.
innerHTML
=
'
This app has
'
+
count
+
'
open issues
'
;
document
.
getElementById
(
'
issue-count
'
).
style
.
display
=
'
inline
'
;
}
}
};
xhr
.
send
();
}
};
redirect
();
getFile
(
'
learn.json
'
,
Learn
);
})();
examples/firebase-angular/package.json
0 → 100644
View file @
3dd6105b
{
"private"
:
true
,
"dependencies"
:
{
"angular"
:
"^1.3.15"
,
"angularfire"
:
"^1.0.0"
,
"todomvc-app-css"
:
"^1.0.1"
,
"todomvc-common"
:
"^1.0.1"
}
}
examples/firebase-angular/readme.md
View file @
3dd6105b
...
...
@@ -13,10 +13,10 @@ Here are some links you may find helpful:
*
[
Tutorial
](
https://www.firebase.com/tutorial/
)
*
[
Documentation & Examples
](
https://www.firebase.com/docs/
)
*
[
API Reference
](
https://www.firebase.com/docs/
javascript/firebase/
)
*
[
API Reference
](
https://www.firebase.com/docs/
web
)
*
[
Blog
](
https://www.firebase.com/blog/
)
*
[
Firebase on Github
](
http://firebase.github.io
)
*
[
AngularJS bindings for Firebase
](
http
://github.com/firebase/angularFire
)
*
[
AngularJS bindings for Firebase
](
http
s://www.firebase.com/docs/web/libraries/angular/
)
Get help from other AngularJS users:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment