diff --git a/app/css/app.css b/app/css/app.css index e4224fc..0c2dd7f 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -5,3 +5,35 @@ h1, h2, h3, h4 { body { padding: .5em 1em; } + +.header { + text-align: right; +} + +div[ng-repeat] { + display: inline-block; +} + +.profile > img { + width: 80px; + height: 80px; +} + +.profile { + margin: 3px; + width: 120px; + height: 120px; + display: inline-block; + border: 1px solid black; + -webkit-border-radius: 3px; + padding: 5px; + text-align: center; + overflow: hidden; + background-color: #EEE; +} + +.profile>h1 { + margin: 0; + padding: 0; + font-size: 11px; +} diff --git a/app/index.html b/app/index.html index f339aa7..8e43c94 100644 --- a/app/index.html +++ b/app/index.html @@ -15,15 +15,25 @@
- Name: -name={{name}} @@ -32,12 +42,10 @@ diff --git a/app/js/controllers.js b/app/js/controllers.js index 4596200..14dbc70 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -3,4 +3,12 @@ myApp.controller('Demo', function($scope) { $scope.name = 'world'; $scope.leak = 'none'; + + $scope.email = 'misko@hevery.com'; + + $scope.devs = [ + 'misko@hevery.com', + 'iiminar@gmail.com', + 'vojta.jina@gmail.com' + ]; }); diff --git a/app/js/directives.js b/app/js/directives.js index b246b1b..081c0be 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1,26 +1,8 @@ 'use strict'; -myApp.directive('demoGreet', function($parse) { +myApp.directive('profile', function() { return { - scope: true, - compile: function compileFn(cElement, attrs) { - console.log('compileFn(', cElement, attrs, ')'); - cElement.addClass('greet'); - return function linkFn(scope, lElement, attrs) { - console.log('linkingFn(', scope, lElement, attrs, ')', cElement == lElement); - - scope.leak = 'LEAKING'; - - scope.$watch(attrs.greet, function(name) { - lElement.text('Hello ' + name + '!'); - }); - - lElement.bind('click', function() { - scope.$apply(function() { - $parse(attrs.greet).assign(scope, 'WORLD'); - }); - }); - } - } + //restrict: 'E', + //templateUrl: 'partials/profile.html' }; }); diff --git a/app/js/filters.js b/app/js/filters.js index eb109ab..3eeabf7 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -1,2 +1,9 @@ 'use strict'; +myApp.filter('gravatar', function() { + return function(email) { + if (email) { + return 'http://www.gravatar.com/avatar/' + hex_md5(email) + '.jpg'; + } + } +}); diff --git a/app/partials/profile.html b/app/partials/profile.html new file mode 100644 index 0000000..874738a --- /dev/null +++ b/app/partials/profile.html @@ -0,0 +1,4 @@ ++ +{{email}}
+