Add follow button to stdout

- fixed position in stdout window for easy clicking on fast scroll output
This commit is contained in:
Michael J. Schultz 2014-09-28 02:52:10 +00:00
parent bb8c64b157
commit e0ad97ff97
4 changed files with 34 additions and 4 deletions

View file

@ -273,12 +273,24 @@ app.controller("CommitController", function($scope, $http, $routeParams, stdout,
var el = document.querySelector('#output');
stdout.subscribe(data.id, function(out){
angular.element(el).append(lineFormatter.format(out));
if ($scope.following) {
window.scrollTo(0, document.body.scrollHeight);
}
});
}).
error(function(data, status, headers, config) {
console.log(data);
});
$scope.following = false;
$scope.follow = function() {
$scope.following = true;
window.scrollTo(0, document.body.scrollHeight);
}
$scope.unfollow = function() {
$scope.following = false;
}
$scope.rebuildCommit = function() {
$http({method: 'POST', url: '/api/repos/'+remote+'/'+owner+'/'+name+'/'+'branches/'+branch+'/'+'commits/'+commit+'?action=rebuild' })
}

File diff suppressed because one or more lines are too long

View file

@ -1315,6 +1315,21 @@ nav {
line-height:18px;
}
#follow button {
position: fixed;
right: 280px;
bottom: 21px;
z-index: 100;
padding: 0 1em;
border-radius: 7px;
background-color: rgba(238, 238, 238, 0.2);
padding: 0 1em;
cursor: pointer;
font-family: @sans;
border: none;
color: #fff;
}
&[data-result="Pending"]:after,
&[data-result="Started"]:after {
position: absolute;

View file

@ -51,7 +51,10 @@
<span>/</span>
<a href="#">{{ commit.sha | shortHash}}</a>
</nav>
<div id="follow">
<button ng-click="follow()" ng-if="following == false">follow</button>
<button ng-click="unfollow()" ng-if="following == true">unfollow</button>
</div>
<pre id="output"></pre>
</div>
</div>