Merge branch 'master' of abf.rosalinux.ru:abf/rosa-build

This commit is contained in:
Vokhmin Alexey V 2015-03-04 13:13:17 +03:00
commit f6257a97f6
3 changed files with 9 additions and 7 deletions

View File

@ -13,12 +13,14 @@ RosaABF.controller('GitTreeCtrl', ['$scope', '$http', '$location', function($sco
};
$scope.refresh = function(more) {
$scope.processing = true;
var params = { format: 'json', path: $scope.path };
if(more) {
params.page = $scope.next_page;
$scope.load_more = true;
}
else {
$scope.processing = true;
}
$http.get(Routes.tree_path($scope.project, $scope.treeish, params)).then(function(res) {
@ -28,11 +30,12 @@ RosaABF.controller('GitTreeCtrl', ['$scope', '$http', '$location', function($sco
$scope.next_page = res.data.next_page;
if(more) {
$scope.tree.push.apply($scope.tree, res.data.tree);
$scope.load_more = false;
}
else {
$scope.tree = res.data.tree;
}
$scope.processing = false;
}
});
};

View File

@ -59,6 +59,6 @@
%td{ 'ng-hide' => 'el.commit' }
%hr
%btn.center-block.btn.btn-primary{ 'ng-show' => 'next_page', 'ng-disabled' => 'processing',
%btn.center-block.btn.btn-primary{ 'ng-show' => 'next_page', 'ng-disabled' => 'load_more || processing',
'ng-click' => 'getTree($event, null, true)' }
= t 'layout.activity_feed.load_more'

View File

@ -64,6 +64,5 @@ else
json.path @path
json.root_path @path.present? ? @path.split('/')[0...-1].join('/') : nil
params[:page].to_i
json.next_page page.next if @tree && @tree.contents.count >= Project::CONTENT_LIMIT*(page+1)
end