Skip to content

Commit

Permalink
refactor, fix GhVisualization to ghVisualization
Browse files Browse the repository at this point in the history
  • Loading branch information
btford committed Aug 1, 2012
1 parent 808e5ec commit 3969dd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions app.js
Expand Up @@ -103,7 +103,7 @@ d3DemoApp.controller('AppCtrl', function AppCtrl ($scope, $http) {
}); });




d3DemoApp.directive('GhVisualization', function () { d3DemoApp.directive('ghVisualization', function () {


// constants // constants
var margin = 20, var margin = 20,
Expand All @@ -115,8 +115,8 @@ d3DemoApp.directive('GhVisualization', function () {
restrict: 'E', restrict: 'E',
terminal: true, terminal: true,
scope: { scope: {
val: '=val', val: '=',
grouped: '=grouped' grouped: '='
}, },
link: function (scope, element, attrs) { link: function (scope, element, attrs) {


Expand Down Expand Up @@ -290,6 +290,7 @@ d3DemoApp.directive('GhVisualization', function () {


// setup a watch on 'grouped' to switch between views // setup a watch on 'grouped' to switch between views
scope.$watch('grouped', function (newVal, oldVal) { scope.$watch('grouped', function (newVal, oldVal) {
// ignore first call which happens before we even have data from the Github API
if (newVal === oldVal) { if (newVal === oldVal) {
return; return;
} }
Expand Down
14 changes: 9 additions & 5 deletions index.html
Expand Up @@ -25,18 +25,22 @@
font-weight: 300; font-weight: 300;
margin-bottom: .3em; margin-bottom: .3em;
} }
.error {
color: red;
}
</style> </style>
</head> </head>
<body ng-controller="AppCtrl"> <body ng-controller="AppCtrl">
<h1>Github Commit Graph</h1> <h1>Github Commit Graph</h1>


<div> <form ng-submit="getCommitData()">
User: <input ng-change="getCommitData()" ng-model="user"></input> User: <input ng-model="user"></input>
Repo: <input ng-change="getCommitData()" ng-model="repo"></input> Repo: <input ng-model="repo"></input>
<input type="submit" value="Get Data">
Grouped <input type="checkbox" ng-model="grouped"> Grouped <input type="checkbox" ng-model="grouped">
</div> </form>


<p>{{error}}</p> <p class="error">{{error}}</p>
<gh-visualization val="data" grouped="grouped"></gh-visualization> <gh-visualization val="data" grouped="grouped"></gh-visualization>
</body> </body>
</html> </html>

0 comments on commit 3969dd3

Please sign in to comment.