#214: updated logic of deleting of branch
This commit is contained in:
parent
ff646af607
commit
e096fc1bde
|
@ -17,6 +17,8 @@ RosaABF.controller('ProjectRefsController', function($scope, $http, $location, A
|
|||
$scope.getRefs = function() {
|
||||
//returns [ProjectRef, ProjectRef, ...]
|
||||
ApiProject.refs($scope.project_id, function(results){
|
||||
$scope.tags = [];
|
||||
$scope.branches = [];
|
||||
_.each(results, function(result){
|
||||
if (result.isTag) {
|
||||
if (result.ref == $scope.current_ref) {
|
||||
|
@ -36,9 +38,9 @@ RosaABF.controller('ProjectRefsController', function($scope, $http, $location, A
|
|||
};
|
||||
|
||||
$scope.destroy = function(branch) {
|
||||
var path = $location.$$absUrl.replace(/\/[\w\-]+$/, '') + '/' + branch.name;
|
||||
$http.delete(path).success(function(data) {
|
||||
$http.delete(branch.delete_path($scope.project)).success(function(data) {
|
||||
$scope.getRefs();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
|
@ -16,6 +16,10 @@ var ProjectRef = function(atts) {
|
|||
return '/' + project.fullname + '/tree/' + self.ref;
|
||||
}
|
||||
|
||||
self.delete_path = function(project) {
|
||||
return '/' + project.fullname + '/branches/' + self.ref;
|
||||
}
|
||||
|
||||
self.diff_path = function(project, current_ref) {
|
||||
return '/' + project.fullname + '/diff/' + current_ref + '...' + self.ref;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController
|
|||
|
||||
def destroy
|
||||
raise Grit::NoSuchPathError unless @branch
|
||||
@project.delete_branch @branch.name
|
||||
@project.delete_branch @branch, current_user
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ module Modules
|
|||
|
||||
def delete_branch(branch, user)
|
||||
message = repo.git.native(:branch, {}, '-D', branch.name)
|
||||
Resque.enqueue(GitHook, owner.uname, name, GitHook::ZERO, sha1, "refs/heads/#{branch.name}", 'commit', "user-#{user.id}", message)
|
||||
Resque.enqueue(GitHook,owner.uname, name, GitHook::ZERO, branch.commit.id, "refs/heads/#{branch.name}", 'commit', "user-#{user.id}", message)
|
||||
end
|
||||
|
||||
def update_file(path, data, options = {})
|
||||
|
|
Loading…
Reference in New Issue