Skip to content

Commit 8015e09

Browse files
committed
added buzz demo, fix undefined() -> undefined
1 parent 2987f7f commit 8015e09

4 files changed

Lines changed: 86 additions & 23 deletions

File tree

example/buzz/buzz.css

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,89 @@
11
body {
2-
background: -webkit-gradient(linear, left top, left 400, from(#1C4070), to(#fff));
2+
background: -webkit-gradient(linear, left top, left 100, from(#bbb), to(#fff));
33
background-repeat: no-repeat;
44
margin: 0px;
5+
font-family: sans-serif;
6+
font-size: 12px;
57
}
68

7-
.bar {
9+
body > div {
810
border-top: 1px solid white;
911
border-bottom: 1px solid black;
10-
text-align: right;
12+
text-align: center;
1113
background: -webkit-gradient(linear, left top, left bottom, from(#CCC), to(#888));
1214
-webkit-background-origin: padding; -webkit-background-clip: content;
1315
}
14-
.bar button {
16+
body > div button {
1517
margin: 5px;
1618
}
1719

18-
.bar span {
20+
body > div span:FIRST-CHILD {
1921
float: left;
2022
font-family: monospace;
2123
font-size: 1.5em;
2224
color: black;
25+
padding: 2px 5px;
2326
}
2427

25-
ul.buzz {
28+
body > div span:last-child {
29+
float: right;
30+
}
31+
32+
ul {
2633
list-style: none;
27-
padding: 5px;
34+
padding: 10px;
2835
margin: 0;
2936
}
3037

31-
ul.buzz > li {
32-
border: 1px solid yellow;
33-
margin: 5px;
38+
body > ul > li {
39+
border: 1px solid black;
40+
margin: 15px 5px;
3441
padding: 0;
42+
-webkit-box-shadow: 5px 5px 5px #888;
43+
}
44+
45+
body > ul > li > h1 {
46+
margin: 0;
47+
background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#999));
48+
font-size: 13px;
49+
border-bottom: 1px solid black;
50+
}
51+
52+
h1 > img,
53+
li > img {
54+
max-height: 30px;
55+
max-width: 30px;
56+
vertical-align: middle;
57+
padding: 3px;
3558
}
3659

37-
ul.buzz > li > h1 {
38-
border: 1px solid yellow;
60+
a > img {
61+
margin-right: 5px;
62+
margin-top: 5px;
63+
}
64+
65+
body > ul > li > h1 > a:last-child {
66+
float: right;
67+
margin: 10px;
68+
}
69+
70+
body > ul > li > div {
71+
background-color: white;
72+
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
3973
margin: 0;
74+
padding: 10px;
4075
}
4176

42-
ul.buzz > li > div {
43-
border: 1px solid yellow;
77+
body > ul > li ul {
4478
margin: 0;
79+
padding: 0;
80+
margin-left: 5px;
81+
border-left: 5px solid lightgray;
4582
}
83+
84+
body > ul > li ul > li {
85+
margin: 0;
86+
padding: 10px;
87+
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
88+
}
89+

example/buzz/buzz.html

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,44 @@
22
<html xmlns:ng="http://angularjs.org">
33
<head>
44
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
5-
<!--script type="text/javascript" src="http://angularjs.org/ng/js/angular-debug.js#autobind"></script-->
6-
<script type="text/javascript" src="../../src/angular-bootstrap.js#autobind"></script>
5+
<script type="text/javascript" src="http://angularjs.org/ng/js/angular-debug.js#autobind"></script>
76
<script type="text/javascript" src="buzz.js"></script>
7+
<link rel="stylesheet" type="text/css" href="http://angularjs.org/ng/css/angular.css"/>
88
<link rel="stylesheet" type="text/css" href="buzz.css"/>
99
</head>
1010
<body ng:init="$window.$root = this" ng:controller="BuzzController">
11-
<div class="bar">
11+
<div>
1212
<span>&lt;angular/&gt; Buzz</span>
13-
<input type="text" name="userId" ng:required/>
14-
<button ng:click="$location.hashPath = userId">fetch</button>
13+
<span>
14+
filter:
15+
<input type="text" name="filterText"/>
16+
</span>
17+
<span>
18+
user:
19+
<input type="text" name="userId" ng:required/>
20+
<button ng:click="$location.hashPath = userId">fetch</button>
21+
</span>
1522
</div>
16-
<ul class="buzz">
17-
<li ng:repeat="item in activities.data.items">
23+
<ul>
24+
<li ng:repeat="item in activities.data.items.$filter(filterText)">
1825
<h1>
1926
<img src="{{item.actor.thumbnailUrl}}"/>
2027
<a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a>
28+
<a href="#" ng:click="expandReplies(item)">Replies: {{item.links.replies[0].count}}</a>
2129
</h1>
2230
<div>
2331
{{item.object.content | html}}
24-
<a href="#" ng:click="expandReplies(item)">Replies: {{item.links.replies[0].count}}</a>
32+
<div>
33+
<a href="{{attachment.links.enclosure[0].href}}" ng:repeat="attachment in item.object.attachments">
34+
<img src="{{attachment.links.preview[0].href}}"/>
35+
</a>
36+
</div>
2537
</div>
2638
<my:expand expand="item.replies.show">
2739
<ul>
2840
<li ng:repeat="reply in item.replies.data.items">
2941
<img src="{{reply.actor.thumbnailUrl}}"/>
30-
<a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>
42+
<a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>:
3143
{{reply.content | html}}
3244
</li>
3345
</ul>

src/Parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,8 @@ Parser.prototype = {
602602
var fnPtr = fn(self);
603603
if (typeof fnPtr === 'function') {
604604
return fnPtr.apply(self, args);
605+
} else if (fnPtr === undefined) {
606+
return fnPtr;
605607
} else {
606608
throw "Expression '" + fn.isAssignable + "' is not a function.";
607609
}

test/ScopeSpec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ describe('scope/model', function(){
1515
expect(model.$root).toEqual(model);
1616
});
1717

18+
it('should return noop function when LHS is undefined', function(){
19+
var model = createScope();
20+
expect(model.$eval('x.$filter()')).toEqual(undefined);
21+
});
22+
1823
describe('$eval', function(){
1924
it('should eval function with correct this and pass arguments', function(){
2025
var model = createScope();

0 commit comments

Comments
 (0)