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
Sven Franck
todomvc
Commits
f0ba5464
Commit
f0ba5464
authored
Mar 20, 2012
by
Sindre Sorhus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CRLF problem after the latest pull merge
parent
3a6db4da
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
430 additions
and
430 deletions
+430
-430
architecture-examples/angularjs/css/app.css
architecture-examples/angularjs/css/app.css
+3
-3
architecture-examples/angularjs/css/base.css
architecture-examples/angularjs/css/base.css
+201
-201
architecture-examples/angularjs/index.html
architecture-examples/angularjs/index.html
+50
-50
architecture-examples/angularjs/js/controllers.js
architecture-examples/angularjs/js/controllers.js
+107
-107
architecture-examples/angularjs/js/directive.js
architecture-examples/angularjs/js/directive.js
+34
-34
architecture-examples/angularjs/js/libs/angular/angular-ie-compat.js
...e-examples/angularjs/js/libs/angular/angular-ie-compat.js
+35
-35
No files found.
architecture-examples/angularjs/css/app.css
View file @
f0ba5464
/*this doesn't seem to be used in the jquery example at all. Its getting in the way */
#todo-count
span
{
font-weight
:
inherit
;
/*this doesn't seem to be used in the jquery example at all. Its getting in the way */
#todo-count
span
{
font-weight
:
inherit
;
}
\ No newline at end of file
architecture-examples/angularjs/css/base.css
View file @
f0ba5464
html
,
body
{
margin
:
0
;
padding
:
0
;
}
body
{
font
:
14px
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
width
:
520px
;
margin
:
0
auto
;
-webkit-font-smoothing
:
antialiased
;
}
#todoapp
{
background
:
#fff
;
padding
:
20px
;
margin-bottom
:
40px
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-webkit-border-radius
:
0
0
5px
5px
;
-moz-border-radius
:
0
0
5px
5px
;
-ms-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#todoapp
h1
{
font-size
:
36px
;
font-weight
:
bold
;
text-align
:
center
;
padding
:
0
0
10px
0
;
}
#todoapp
input
[
type
=
"text"
]
{
width
:
466px
;
font-size
:
24px
;
font-family
:
inherit
;
line-height
:
1.4em
;
border
:
0
;
outline
:
none
;
padding
:
6px
;
border
:
1px
solid
#999999
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#todoapp
input
::-webkit-input-placeholder
{
font-style
:
italic
;
}
#todo-list
{
margin
:
10px
0
;
padding
:
0
;
list-style
:
none
;
}
#todo-list
li
{
padding
:
18px
20px
18px
0
;
position
:
relative
;
font-size
:
24px
;
border-bottom
:
1px
solid
#cccccc
;
}
#todo-list
li
:last-child
{
border-bottom
:
none
;
}
#todo-list
li
.done
label
{
color
:
#777777
;
text-decoration
:
line-through
;
}
#todo-list
li
.destroy
{
display
:
none
;
position
:
absolute
;
top
:
20px
;
right
:
10px
;
cursor
:
pointer
;
width
:
20px
;
height
:
20px
;
background
:
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAABGdBTUEAALGPC/xhBQAAACdQTFRFzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMAAAA////zMzMhnu0WAAAAAt0Uk5T5u3pqtV3jFQEKAC0bVelAAAAfUlEQVQI12NYtWpFsc8R865VqxhWrZpyBgg8QcylZ8AgCsjMgTCPrWJYfgYKqhjWwJgaDDVnzpw+c2bPmTPHGWzOnNm95/TuM2cOM/AARXfvBooeZAAp270bRCIz4QoOIGtDMqwJZoUEQzvCYrhzuhhWtUKYEahOX7UK6iEA3A6NUGwCTZIAAAAASUVORK5CYII=')
no-repeat
center
center
;
}
#todo-list
li
:hover
.destroy
{
display
:
block
;
}
#todo-list
li
.editing
{
border-bottom
:
none
;
margin-top
:
-1px
;
padding
:
0
;
}
#todo-list
li
.editing
:last-child
{
margin-bottom
:
-1px
;
}
#todo-list
li
.editing
.edit
{
display
:
block
;
width
:
444px
;
padding
:
13px
15px
14px
20px
;
margin
:
0
;
}
#todo-list
li
.editing
.view
{
display
:
none
;
}
#todo-list
li
.view
label
{
word-break
:
break-word
;
}
#todo-list
li
.edit
{
display
:
none
;
}
#todoapp
footer
{
margin
:
0
-20px
-20px
-20px
;
overflow
:
hidden
;
color
:
#555555
;
background
:
#f4fce8
;
border-top
:
1px
solid
#ededed
;
padding
:
0
20px
;
line-height
:
37px
;
-webkit-border-radius
:
0
0
5px
5px
;
-moz-border-radius
:
0
0
5px
5px
;
-ms-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#clear-completed
{
float
:
right
;
line-height
:
20px
;
text-decoration
:
none
;
background
:
rgba
(
0
,
0
,
0
,
0.1
);
color
:
#555555
;
font-size
:
11px
;
margin-top
:
8px
;
margin-bottom
:
8px
;
padding
:
0
10px
1px
;
cursor
:
pointer
;
-webkit-border-radius
:
12px
;
-moz-border-radius
:
12px
;
-ms-border-radius
:
12px
;
-o-border-radius
:
12px
;
border-radius
:
12px
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
}
#clear-completed
:hover
{
background
:
rgba
(
0
,
0
,
0
,
0.15
);
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
}
#clear-completed
:active
{
position
:
relative
;
top
:
1px
;
}
#todo-count
span
{
font-weight
:
bold
;
}
#instructions
{
margin
:
10px
auto
;
color
:
#777777
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#instructions
a
{
color
:
#336699
;
}
#credits
{
margin
:
30px
auto
;
color
:
#999
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#credits
a
{
color
:
#888
;
html
,
body
{
margin
:
0
;
padding
:
0
;
}
body
{
font
:
14px
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
width
:
520px
;
margin
:
0
auto
;
-webkit-font-smoothing
:
antialiased
;
}
#todoapp
{
background
:
#fff
;
padding
:
20px
;
margin-bottom
:
40px
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-webkit-border-radius
:
0
0
5px
5px
;
-moz-border-radius
:
0
0
5px
5px
;
-ms-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#todoapp
h1
{
font-size
:
36px
;
font-weight
:
bold
;
text-align
:
center
;
padding
:
0
0
10px
0
;
}
#todoapp
input
[
type
=
"text"
]
{
width
:
466px
;
font-size
:
24px
;
font-family
:
inherit
;
line-height
:
1.4em
;
border
:
0
;
outline
:
none
;
padding
:
6px
;
border
:
1px
solid
#999999
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#todoapp
input
::-webkit-input-placeholder
{
font-style
:
italic
;
}
#todo-list
{
margin
:
10px
0
;
padding
:
0
;
list-style
:
none
;
}
#todo-list
li
{
padding
:
18px
20px
18px
0
;
position
:
relative
;
font-size
:
24px
;
border-bottom
:
1px
solid
#cccccc
;
}
#todo-list
li
:last-child
{
border-bottom
:
none
;
}
#todo-list
li
.done
label
{
color
:
#777777
;
text-decoration
:
line-through
;
}
#todo-list
li
.destroy
{
display
:
none
;
position
:
absolute
;
top
:
20px
;
right
:
10px
;
cursor
:
pointer
;
width
:
20px
;
height
:
20px
;
background
:
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAABGdBTUEAALGPC/xhBQAAACdQTFRFzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMAAAA////zMzMhnu0WAAAAAt0Uk5T5u3pqtV3jFQEKAC0bVelAAAAfUlEQVQI12NYtWpFsc8R865VqxhWrZpyBgg8QcylZ8AgCsjMgTCPrWJYfgYKqhjWwJgaDDVnzpw+c2bPmTPHGWzOnNm95/TuM2cOM/AARXfvBooeZAAp270bRCIz4QoOIGtDMqwJZoUEQzvCYrhzuhhWtUKYEahOX7UK6iEA3A6NUGwCTZIAAAAASUVORK5CYII=')
no-repeat
center
center
;
}
#todo-list
li
:hover
.destroy
{
display
:
block
;
}
#todo-list
li
.editing
{
border-bottom
:
none
;
margin-top
:
-1px
;
padding
:
0
;
}
#todo-list
li
.editing
:last-child
{
margin-bottom
:
-1px
;
}
#todo-list
li
.editing
.edit
{
display
:
block
;
width
:
444px
;
padding
:
13px
15px
14px
20px
;
margin
:
0
;
}
#todo-list
li
.editing
.view
{
display
:
none
;
}
#todo-list
li
.view
label
{
word-break
:
break-word
;
}
#todo-list
li
.edit
{
display
:
none
;
}
#todoapp
footer
{
margin
:
0
-20px
-20px
-20px
;
overflow
:
hidden
;
color
:
#555555
;
background
:
#f4fce8
;
border-top
:
1px
solid
#ededed
;
padding
:
0
20px
;
line-height
:
37px
;
-webkit-border-radius
:
0
0
5px
5px
;
-moz-border-radius
:
0
0
5px
5px
;
-ms-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#clear-completed
{
float
:
right
;
line-height
:
20px
;
text-decoration
:
none
;
background
:
rgba
(
0
,
0
,
0
,
0.1
);
color
:
#555555
;
font-size
:
11px
;
margin-top
:
8px
;
margin-bottom
:
8px
;
padding
:
0
10px
1px
;
cursor
:
pointer
;
-webkit-border-radius
:
12px
;
-moz-border-radius
:
12px
;
-ms-border-radius
:
12px
;
-o-border-radius
:
12px
;
border-radius
:
12px
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
}
#clear-completed
:hover
{
background
:
rgba
(
0
,
0
,
0
,
0.15
);
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
}
#clear-completed
:active
{
position
:
relative
;
top
:
1px
;
}
#todo-count
span
{
font-weight
:
bold
;
}
#instructions
{
margin
:
10px
auto
;
color
:
#777777
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#instructions
a
{
color
:
#336699
;
}
#credits
{
margin
:
30px
auto
;
color
:
#999
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#credits
a
{
color
:
#888
;
}
\ No newline at end of file
architecture-examples/angularjs/index.html
View file @
f0ba5464
<!doctype html>
<html
xmlns:ng=
"http://angularjs.org/"
xmlns:my=
"http://rx.org"
>
<head>
<meta
charset=
"utf-8"
>
<title>
AngularJS - TodoMVC
</title>
<link
rel=
"stylesheet"
href=
"css/base.css"
>
<link
rel=
"stylesheet"
href=
"css/app.css"
>
</head>
<body>
<div
ng:controller=
"App.Controllers.TodoController"
id=
"todoapp"
>
<header>
<h1>
Todos
</h1>
<form
id=
"todo-form"
ng:submit=
"addTodo()"
>
<input
id=
"new-todo"
name=
"newTodo"
type=
"text"
placeholder=
"What needs to be done?"
>
</form>
</header>
<section
id=
"main"
ng:show=
"hasTodos()"
>
<input
id=
"toggle-all"
type=
"checkbox"
name=
"allChecked"
ng:click=
"toggleAllStates()"
>
<label
for=
"toggle-all"
>
Mark all as complete
</label>
<ul
id=
"todo-list"
>
<li
ng:repeat=
"todo in todos"
my:dblclick=
"editTodo(todo)"
ng:class=
"(todo.done && ' done ') + (todo.editing && ' editing ')"
>
<div
class=
"view"
>
<input
class=
"toggle"
type=
"checkbox"
name=
"todo.done"
>
<label>
{{ todo.title }}
</label>
<a
class=
"destroy"
ng:click=
"removeTodo(todo)"
></a>
</div>
<form
ng:submit=
"finishEditing(todo)"
>
<input
class=
"edit"
type=
"text"
name=
"todo.title"
my:focus=
"todo.editing"
my:blur=
"finishEditing(todo)"
>
</form>
</li>
</ul>
</section>
<footer
ng:show=
"hasTodos()"
>
<a
id=
"clear-completed"
ng:click=
"clearCompletedItems()"
ng:show=
"hasFinishedTodos()"
>
{{ clearItemsText() }}
</a>
<div
id=
"todo-count"
><b>
{{ remainingTodos() }}
</b>
{{ itemsLeftText() }}
</div>
</footer>
</div>
<div
id=
"instructions"
>
Double-click to edit a todo.
</div>
<div
id=
"credits"
>
Created by
<a
href=
"http://twitter.com/cburgdorf"
>
Christoph Burgdorf
</a>
.
</div>
<script
src=
"js/libs/json2.js"
></script>
<script
src=
"js/booter.js"
></script>
<script
src=
"js/libs/angular/angular.min.js"
ng:autobind
></script>
<script
src=
"js/controllers.js"
></script>
<script
src=
"js/directive.js"
></script>
</body>
</html>
<!doctype html>
<html
xmlns:ng=
"http://angularjs.org/"
xmlns:my=
"http://rx.org"
>
<head>
<meta
charset=
"utf-8"
>
<title>
AngularJS - TodoMVC
</title>
<link
rel=
"stylesheet"
href=
"css/base.css"
>
<link
rel=
"stylesheet"
href=
"css/app.css"
>
</head>
<body>
<div
ng:controller=
"App.Controllers.TodoController"
id=
"todoapp"
>
<header>
<h1>
Todos
</h1>
<form
id=
"todo-form"
ng:submit=
"addTodo()"
>
<input
id=
"new-todo"
name=
"newTodo"
type=
"text"
placeholder=
"What needs to be done?"
>
</form>
</header>
<section
id=
"main"
ng:show=
"hasTodos()"
>
<input
id=
"toggle-all"
type=
"checkbox"
name=
"allChecked"
ng:click=
"toggleAllStates()"
>
<label
for=
"toggle-all"
>
Mark all as complete
</label>
<ul
id=
"todo-list"
>
<li
ng:repeat=
"todo in todos"
my:dblclick=
"editTodo(todo)"
ng:class=
"(todo.done && ' done ') + (todo.editing && ' editing ')"
>
<div
class=
"view"
>
<input
class=
"toggle"
type=
"checkbox"
name=
"todo.done"
>
<label>
{{ todo.title }}
</label>
<a
class=
"destroy"
ng:click=
"removeTodo(todo)"
></a>
</div>
<form
ng:submit=
"finishEditing(todo)"
>
<input
class=
"edit"
type=
"text"
name=
"todo.title"
my:focus=
"todo.editing"
my:blur=
"finishEditing(todo)"
>
</form>
</li>
</ul>
</section>
<footer
ng:show=
"hasTodos()"
>
<a
id=
"clear-completed"
ng:click=
"clearCompletedItems()"
ng:show=
"hasFinishedTodos()"
>
{{ clearItemsText() }}
</a>
<div
id=
"todo-count"
><b>
{{ remainingTodos() }}
</b>
{{ itemsLeftText() }}
</div>
</footer>
</div>
<div
id=
"instructions"
>
Double-click to edit a todo.
</div>
<div
id=
"credits"
>
Created by
<a
href=
"http://twitter.com/cburgdorf"
>
Christoph Burgdorf
</a>
.
</div>
<script
src=
"js/libs/json2.js"
></script>
<script
src=
"js/booter.js"
></script>
<script
src=
"js/libs/angular/angular.min.js"
ng:autobind
></script>
<script
src=
"js/controllers.js"
></script>
<script
src=
"js/directive.js"
></script>
</body>
</html>
architecture-examples/angularjs/js/controllers.js
View file @
f0ba5464
/* App Controllers */
App
.
Controllers
.
TodoController
=
function
()
{
var
self
=
this
;
self
.
newTodo
=
""
;
var
retrieveStore
=
function
()
{
var
store
=
localStorage
.
getItem
(
'
todo-angularjs
'
);
return
(
store
&&
JSON
.
parse
(
store
)
)
||
[];
};
var
updateStore
=
function
()
{
var
isEditing
=
angular
.
Array
.
count
(
self
.
todos
,
function
(
x
)
{
return
x
.
editing
;
});
if
(
!
isEditing
){
localStorage
.
setItem
(
'
todo-angularjs
'
,
JSON
.
stringify
(
self
.
todos
));
}
};
//not sure if its intended to do so. However, we need a hook to update the store
//whenever angular changes any properties
self
.
$watch
(
updateStore
);
self
.
todos
=
retrieveStore
();
self
.
addTodo
=
function
()
{
if
(
self
.
newTodo
.
trim
().
length
===
0
)
return
;
self
.
todos
.
push
({
title
:
self
.
newTodo
,
done
:
false
,
editing
:
false
});
self
.
newTodo
=
""
;
};
self
.
editTodo
=
function
(
todo
)
{
//cancel any active editing operation
angular
.
forEach
(
self
.
todos
,
function
(
value
)
{
value
.
editing
=
false
;
});
todo
.
editing
=
true
;
};
self
.
finishEditing
=
function
(
todo
)
{
if
(
todo
.
title
.
trim
().
length
===
0
){
self
.
removeTodo
(
todo
);
}
else
{
todo
.
editing
=
false
;
}
};
self
.
removeTodo
=
function
(
todo
)
{
angular
.
Array
.
remove
(
self
.
todos
,
todo
);
};
var
countTodos
=
function
(
done
)
{
return
function
()
{
return
angular
.
Array
.
count
(
self
.
todos
,
function
(
x
)
{
return
x
.
done
===
(
done
===
"
done
"
);
});
}
};
var
pluralize
=
function
(
count
,
word
)
{
return
count
===
1
?
word
:
word
+
'
s
'
;
};
self
.
remainingTodos
=
countTodos
(
"
undone
"
);
self
.
finishedTodos
=
countTodos
(
"
done
"
);
self
.
itemsLeftText
=
function
(){
return
pluralize
(
self
.
remainingTodos
(),
'
item
'
)
+
'
left
'
};
self
.
clearItemsText
=
function
(){
var
finishedTodos
=
self
.
finishedTodos
();
return
'
Clear
'
+
finishedTodos
+
'
completed
'
+
pluralize
(
finishedTodos
,
'
item
'
);
};
self
.
clearCompletedItems
=
function
()
{
var
oldTodos
=
self
.
todos
;
self
.
todos
=
[];
angular
.
forEach
(
oldTodos
,
function
(
todo
)
{
if
(
!
todo
.
done
)
self
.
todos
.
push
(
todo
);
});
self
.
allChecked
=
false
;
};
self
.
toggleAllStates
=
function
(){
angular
.
forEach
(
self
.
todos
,
function
(
todo
){
todo
.
done
=
self
.
allChecked
;
})
};
self
.
hasFinishedTodos
=
function
()
{
return
self
.
finishedTodos
()
>
0
;
};
self
.
hasTodos
=
function
()
{
return
self
.
todos
.
length
>
0
;
};
};
/* App Controllers */
App
.
Controllers
.
TodoController
=
function
()
{
var
self
=
this
;
self
.
newTodo
=
""
;
var
retrieveStore
=
function
()
{
var
store
=
localStorage
.
getItem
(
'
todo-angularjs
'
);
return
(
store
&&
JSON
.
parse
(
store
)
)
||
[];
};
var
updateStore
=
function
()
{
var
isEditing
=
angular
.
Array
.
count
(
self
.
todos
,
function
(
x
)
{
return
x
.
editing
;
});
if
(
!
isEditing
){
localStorage
.
setItem
(
'
todo-angularjs
'
,
JSON
.
stringify
(
self
.
todos
));
}
};
//not sure if its intended to do so. However, we need a hook to update the store
//whenever angular changes any properties
self
.
$watch
(
updateStore
);
self
.
todos
=
retrieveStore
();
self
.
addTodo
=
function
()
{
if
(
self
.
newTodo
.
trim
().
length
===
0
)
return
;
self
.
todos
.
push
({
title
:
self
.
newTodo
,
done
:
false
,
editing
:
false
});
self
.
newTodo
=
""
;
};
self
.
editTodo
=
function
(
todo
)
{
//cancel any active editing operation
angular
.
forEach
(
self
.
todos
,
function
(
value
)
{
value
.
editing
=
false
;
});
todo
.
editing
=
true
;
};
self
.
finishEditing
=
function
(
todo
)
{
if
(
todo
.
title
.
trim
().
length
===
0
){
self
.
removeTodo
(
todo
);
}
else
{
todo
.
editing
=
false
;
}
};
self
.
removeTodo
=
function
(
todo
)
{
angular
.
Array
.
remove
(
self
.
todos
,
todo
);
};
var
countTodos
=
function
(
done
)
{
return
function
()
{
return
angular
.
Array
.
count
(
self
.
todos
,
function
(
x
)
{
return
x
.
done
===
(
done
===
"
done
"
);
});
}
};
var
pluralize
=
function
(
count
,
word
)
{
return
count
===
1
?
word
:
word
+
'
s
'
;
};
self
.
remainingTodos
=
countTodos
(
"
undone
"
);
self
.
finishedTodos
=
countTodos
(
"
done
"
);
self
.
itemsLeftText
=
function
(){
return
pluralize
(
self
.
remainingTodos
(),
'
item
'
)
+
'
left
'
};
self
.
clearItemsText
=
function
(){
var
finishedTodos
=
self
.
finishedTodos
();
return
'
Clear
'
+
finishedTodos
+
'
completed
'
+
pluralize
(
finishedTodos
,
'
item
'
);
};
self
.
clearCompletedItems
=
function
()
{
var
oldTodos
=
self
.
todos
;
self
.
todos
=
[];
angular
.
forEach
(
oldTodos
,
function
(
todo
)
{
if
(
!
todo
.
done
)
self
.
todos
.
push
(
todo
);
});
self
.
allChecked
=
false
;
};
self
.
toggleAllStates
=
function
(){
angular
.
forEach
(
self
.
todos
,
function
(
todo
){
todo
.
done
=
self
.
allChecked
;
})
};
self
.
hasFinishedTodos
=
function
()
{
return
self
.
finishedTodos
()
>
0
;
};
self
.
hasTodos
=
function
()
{
return
self
.
todos
.
length
>
0
;
};
};
architecture-examples/angularjs/js/directive.js
View file @
f0ba5464
angular
.
directive
(
'
my:blur
'
,
function
(
expression
,
compiledElement
)
{
var
compiler
=
this
;
return
function
(
linkElement
)
{
var
scope
=
this
;
linkElement
.
bind
(
'
blur
'
,
function
(
event
)
{
scope
.
$apply
(
expression
,
linkElement
);
event
.
stopPropagation
();
});
};
});
angular
.
directive
(
'
my:dblclick
'
,
function
(
expression
,
compiledElement
)
{
var
compiler
=
this
;
return
function
(
linkElement
)
{
var
scope
=
this
;
linkElement
.
bind
(
'
dblclick
'
,
function
(
event
)
{
scope
.
$apply
(
expression
,
linkElement
);
event
.
stopPropagation
();
});
};
});
angular
.
directive
(
"
my:focus
"
,
function
(
expression
,
compiledElement
){
return
function
(
element
){
this
.
$watch
(
expression
,
function
(){
if
(
angular
.
formatter
.
boolean
.
parse
(
expression
)){
element
[
0
].
focus
();
element
[
0
].
select
();
}
},
element
);
};
});
angular
.
directive
(
'
my:blur
'
,
function
(
expression
,
compiledElement
)
{
var
compiler
=
this
;
return
function
(
linkElement
)
{
var
scope
=
this
;
linkElement
.
bind
(
'
blur
'
,
function
(
event
)
{
scope
.
$apply
(
expression
,
linkElement
);
event
.
stopPropagation
();
});
};
});
angular
.
directive
(
'
my:dblclick
'
,
function
(
expression
,
compiledElement
)
{
var
compiler
=
this
;
return
function
(
linkElement
)
{
var
scope
=
this
;
linkElement
.
bind
(
'
dblclick
'
,
function
(
event
)
{
scope
.
$apply
(
expression
,
linkElement
);
event
.
stopPropagation
();
});
};
});
angular
.
directive
(
"
my:focus
"
,
function
(
expression
,
compiledElement
){
return
function
(
element
){
this
.
$watch
(
expression
,
function
(){
if
(
angular
.
formatter
.
boolean
.
parse
(
expression
)){
element
[
0
].
focus
();
element
[
0
].
select
();
}
},
element
);
};
});
architecture-examples/angularjs/js/libs/angular/angular-ie-compat.js
View file @
f0ba5464
/*
Content-Type: multipart/related; boundary="_"
--_
Content-Location:img0
Content-Transfer-Encoding:base64
R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7
--_
Content-Location:img1
Content-Transfer-Encoding:base64
R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrCLTcoM29yN6k9socs91e5X3EyJloipYrO4ohTMqA0Fn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SonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==
--_--
*/
(
function
(){
var
jsUri
=
document
.
location
.
href
.
replace
(
/
\/[^\/]
+
(
#.*
)?
$/
,
'
/
'
)
+
document
.
getElementById
(
'
ng-ie-compat
'
).
src
,
css
=
'
#ng-callout .ng-arrow-left{*background-image:url("mhtml:
'
+
jsUri
+
'
!img0")}#ng-callout .ng-arrow-right{*background-image:url("mhtml:
'
+
jsUri
+
'
!img1")}.ng-input-indicator-wait {*background-image:url("mhtml:
'
+
jsUri
+
'
!img2")}
'
,
s
=
document
.
createElement
(
'
style
'
);
s
.
setAttribute
(
'
type
'
,
'
text/css
'
);
if
(
s
.
styleSheet
)
{
s
.
styleSheet
.
cssText
=
css
;
}
else
{
s
.
appendChild
(
document
.
createTextNode
(
css
));
}
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
s
);
})();
/*
Content-Type: multipart/related; boundary="_"
--_
Content-Location:img0
Content-Transfer-Encoding:base64
R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7
--_
Content-Location:img1
Content-Transfer-Encoding:base64
R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMr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qIQAh+QQJCgAAACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==
--_--
*/
(
function
(){
var
jsUri
=
document
.
location
.
href
.
replace
(
/
\/[^\/]
+
(
#.*
)?
$/
,
'
/
'
)
+
document
.
getElementById
(
'
ng-ie-compat
'
).
src
,
css
=
'
#ng-callout .ng-arrow-left{*background-image:url("mhtml:
'
+
jsUri
+
'
!img0")}#ng-callout .ng-arrow-right{*background-image:url("mhtml:
'
+
jsUri
+
'
!img1")}.ng-input-indicator-wait {*background-image:url("mhtml:
'
+
jsUri
+
'
!img2")}
'
,
s
=
document
.
createElement
(
'
style
'
);
s
.
setAttribute
(
'
type
'
,
'
text/css
'
);
if
(
s
.
styleSheet
)
{
s
.
styleSheet
.
cssText
=
css
;
}
else
{
s
.
appendChild
(
document
.
createTextNode
(
css
));
}
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
s
);
})();
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