diff options
| author | Misko Hevery | 2010-07-22 15:32:57 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-07-22 15:32:57 -0700 | 
| commit | 2987f7f705baffad8081fc4a3a95eab79b0d9695 (patch) | |
| tree | 95cbcdb3e0dbf39d00b266075f551be8ddd87e9f /example | |
| parent | 849a05b5a578f19ddc3d24dc9fbd304e0e07612a (diff) | |
| download | angular.js-2987f7f705baffad8081fc4a3a95eab79b0d9695.tar.bz2 | |
fix howers which were accidently broken
Diffstat (limited to 'example')
| -rw-r--r-- | example/buzz/buzz.css | 45 | ||||
| -rw-r--r-- | example/buzz/buzz.html | 36 | ||||
| -rw-r--r-- | example/buzz/buzz.js | 27 | 
3 files changed, 94 insertions, 14 deletions
| diff --git a/example/buzz/buzz.css b/example/buzz/buzz.css index e69de29b..e77c3bac 100644 --- a/example/buzz/buzz.css +++ b/example/buzz/buzz.css @@ -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; +} diff --git a/example/buzz/buzz.html b/example/buzz/buzz.html index ee2b2bb9..f1916f54 100644 --- a/example/buzz/buzz.html +++ b/example/buzz/buzz.html @@ -2,28 +2,36 @@  <html xmlns:ng="http://angularjs.org">    <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://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="buzz.js"></script> -    <link rel="stylesheet" type="text/css" href="style.css"/> +    <link rel="stylesheet" type="text/css" href="buzz.css"/>    </head>    <body ng:init="$window.$root = this" ng:controller="BuzzController">    <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>    </div> -  <ul> +  <ul class="buzz">      <li ng:repeat="item in activities.data.items"> -      <img src="{{item.actor.thumbnailUrl}}"/> -      <a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a> -      {{item.object.content | html}} -      <a href="">Replies: {{item.links.replies[0].count}}</a> -      <ul> -        <li ng:repeat="reply in item.replies.items"> -          <img src="{{reply.actor.thumbnailUrl}}"/> -          <a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a> -          {{reply.content | html}} -        </li> -      </ul> +      <h1> +        <img src="{{item.actor.thumbnailUrl}}"/> +        <a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a> +      </h1> +      <div> +        {{item.object.content | html}} +        <a href="#" ng:click="expandReplies(item)">Replies: {{item.links.replies[0].count}}</a> +      </div> +      <my:expand expand="item.replies.show"> +        <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>    </ul>    </body> diff --git a/example/buzz/buzz.js b/example/buzz/buzz.js index 871982d7..40813d16 100644 --- a/example/buzz/buzz.js +++ b/example/buzz/buzz.js @@ -15,5 +15,32 @@ BuzzController.prototype = {    userChange: function(){      this.userId = this.$location.hashPath;      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'); +      } +    }); +  }; +}); | 
