mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 19:11:08 +00:00
fix howers which were accidently broken
This commit is contained in:
parent
849a05b5a5
commit
2987f7f705
7 changed files with 96 additions and 29 deletions
|
|
@ -0,0 +1,45 @@
|
||||||
|
body {
|
||||||
|
background: -webkit-gradient(linear, left top, left 400, from(#1C4070), to(#fff));
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar {
|
||||||
|
border-top: 1px solid white;
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
text-align: right;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#CCC), to(#888));
|
||||||
|
-webkit-background-origin: padding; -webkit-background-clip: content;
|
||||||
|
}
|
||||||
|
.bar button {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar span {
|
||||||
|
float: left;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 1.5em;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.buzz {
|
||||||
|
list-style: none;
|
||||||
|
padding: 5px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.buzz > li {
|
||||||
|
border: 1px solid yellow;
|
||||||
|
margin: 5px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.buzz > li > h1 {
|
||||||
|
border: 1px solid yellow;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.buzz > li > div {
|
||||||
|
border: 1px solid yellow;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
@ -2,28 +2,36 @@
|
||||||
<html xmlns:ng="http://angularjs.org">
|
<html xmlns:ng="http://angularjs.org">
|
||||||
<head>
|
<head>
|
||||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
|
||||||
|
<!--script type="text/javascript" src="http://angularjs.org/ng/js/angular-debug.js#autobind"></script-->
|
||||||
<script type="text/javascript" src="../../src/angular-bootstrap.js#autobind"></script>
|
<script type="text/javascript" src="../../src/angular-bootstrap.js#autobind"></script>
|
||||||
<script type="text/javascript" src="buzz.js"></script>
|
<script type="text/javascript" src="buzz.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
<link rel="stylesheet" type="text/css" href="buzz.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body ng:init="$window.$root = this" ng:controller="BuzzController">
|
<body ng:init="$window.$root = this" ng:controller="BuzzController">
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
<input type="text" name="userId"/>
|
<span><angular/> Buzz</span>
|
||||||
|
<input type="text" name="userId" ng:required/>
|
||||||
<button ng:click="$location.hashPath = userId">fetch</button>
|
<button ng:click="$location.hashPath = userId">fetch</button>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul class="buzz">
|
||||||
<li ng:repeat="item in activities.data.items">
|
<li ng:repeat="item in activities.data.items">
|
||||||
<img src="{{item.actor.thumbnailUrl}}"/>
|
<h1>
|
||||||
<a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a>
|
<img src="{{item.actor.thumbnailUrl}}"/>
|
||||||
{{item.object.content | html}}
|
<a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a>
|
||||||
<a href="">Replies: {{item.links.replies[0].count}}</a>
|
</h1>
|
||||||
<ul>
|
<div>
|
||||||
<li ng:repeat="reply in item.replies.items">
|
{{item.object.content | html}}
|
||||||
<img src="{{reply.actor.thumbnailUrl}}"/>
|
<a href="#" ng:click="expandReplies(item)">Replies: {{item.links.replies[0].count}}</a>
|
||||||
<a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>
|
</div>
|
||||||
{{reply.content | html}}
|
<my:expand expand="item.replies.show">
|
||||||
</li>
|
<ul>
|
||||||
</ul>
|
<li ng:repeat="reply in item.replies.data.items">
|
||||||
|
<img src="{{reply.actor.thumbnailUrl}}"/>
|
||||||
|
<a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>
|
||||||
|
{{reply.content | html}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</my:expand>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,32 @@ BuzzController.prototype = {
|
||||||
userChange: function(){
|
userChange: function(){
|
||||||
this.userId = this.$location.hashPath;
|
this.userId = this.$location.hashPath;
|
||||||
this.activities = this.Activity.get({userId:this.userId});
|
this.activities = this.Activity.get({userId:this.userId});
|
||||||
|
},
|
||||||
|
|
||||||
|
expandReplies: function(activity) {
|
||||||
|
var self = this;
|
||||||
|
if (activity.replies) {
|
||||||
|
activity.replies.show = !activity.replies.show;
|
||||||
|
} else {
|
||||||
|
activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id}, function(){
|
||||||
|
activity.replies.show = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
angular.widget('my:expand', function(element){
|
||||||
|
element.css('display', 'block');
|
||||||
|
this.descend(true);
|
||||||
|
return function(element) {
|
||||||
|
element.hide();
|
||||||
|
var watch = element.attr('expand');
|
||||||
|
this.$watch(watch, function(value){
|
||||||
|
if (value) {
|
||||||
|
element.delay(0).slideDown('slow');
|
||||||
|
} else {
|
||||||
|
element.slideUp('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ function Browser(location, document, head) {
|
||||||
|
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.document = document;
|
this.document = document;
|
||||||
|
this.body = jqLite(document[0].body);
|
||||||
this.head = head;
|
this.head = head;
|
||||||
this.idCounter = 0;
|
this.idCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,8 +161,6 @@ angularWidget("@ng:repeat", function(expression, element){
|
||||||
valueIdent = match[3] || match[1];
|
valueIdent = match[3] || match[1];
|
||||||
keyIdent = match[2];
|
keyIdent = match[2];
|
||||||
|
|
||||||
if (isUndefined(this.$eval(rhs))) this.$set(rhs, []);
|
|
||||||
|
|
||||||
var children = [], currentScope = this;
|
var children = [], currentScope = this;
|
||||||
this.$onEval(function(){
|
this.$onEval(function(){
|
||||||
var index = 0, childCount = children.length, childScope, lastElement = reference,
|
var index = 0, childCount = children.length, childScope, lastElement = reference,
|
||||||
|
|
|
||||||
|
|
@ -472,13 +472,6 @@ BinderTest.prototype.testRepeaterShouldBindInputsDefaults = function () {
|
||||||
assertEquals("misko", c.scope.$eval('items[1].name'));
|
assertEquals("misko", c.scope.$eval('items[1].name'));
|
||||||
};
|
};
|
||||||
|
|
||||||
BinderTest.prototype.testRepeaterShouldCreateArray = function () {
|
|
||||||
var c = this.compile('<input value="123" name="item.name" ng:repeat="item in items">');
|
|
||||||
c.scope.$eval();
|
|
||||||
|
|
||||||
assertEquals(0, c.scope.$get('items').length);
|
|
||||||
};
|
|
||||||
|
|
||||||
BinderTest.prototype.testShouldTemplateBindPreElements = function () {
|
BinderTest.prototype.testShouldTemplateBindPreElements = function () {
|
||||||
var c = this.compile('<pre>Hello {{name}}!</pre>');
|
var c = this.compile('<pre>Hello {{name}}!</pre>');
|
||||||
c.scope.$set("name", "World");
|
c.scope.$set("name", "World");
|
||||||
|
|
|
||||||
|
|
@ -140,11 +140,6 @@ describe("directives", function(){
|
||||||
expect(element.text()).toEqual('misko:swe;shyam:set;');
|
expect(element.text()).toEqual('misko:swe;shyam:set;');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set ng:repeat to [] if undefinde', function(){
|
|
||||||
var scope = compile('<ul><li ng:repeat="item in items"></li></ul>');
|
|
||||||
expect(scope.items).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should error on wrong parsing of ng:repeat', function(){
|
it('should error on wrong parsing of ng:repeat', function(){
|
||||||
var scope = compile('<ul><li ng:repeat="i dont parse"></li></ul>');
|
var scope = compile('<ul><li ng:repeat="i dont parse"></li></ul>');
|
||||||
var log = "";
|
var log = "";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue