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.refresh = function(more) {
$scope.processing = true;
var params = { format: 'json', path: $scope.path }; var params = { format: 'json', path: $scope.path };
if(more) { if(more) {
params.page = $scope.next_page; 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) { $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; $scope.next_page = res.data.next_page;
if(more) { if(more) {
$scope.tree.push.apply($scope.tree, res.data.tree); $scope.tree.push.apply($scope.tree, res.data.tree);
$scope.load_more = false;
} }
else { else {
$scope.tree = res.data.tree; $scope.tree = res.data.tree;
}
$scope.processing = false; $scope.processing = false;
}
}); });
}; };

View File

@ -59,6 +59,6 @@
%td{ 'ng-hide' => 'el.commit' } %td{ 'ng-hide' => 'el.commit' }
%hr %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)' } 'ng-click' => 'getTree($event, null, true)' }
= t 'layout.activity_feed.load_more' = t 'layout.activity_feed.load_more'

View File

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