Add branches and tags Repo methods
Simplifies the actions in RepositoriesController
This commit is contained in:
parent
2df3b310f9
commit
f8c02f6e39
2 changed files with 12 additions and 2 deletions
|
@ -14,11 +14,11 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def branches
|
def branches
|
||||||
@branches = @project.repo.heads.sort_by(&:name)
|
@branches = @project.branches
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags
|
def tags
|
||||||
@tags = @project.repo.tags.sort_by(&:name).reverse
|
@tags = @project.tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
|
|
|
@ -50,11 +50,21 @@ module Repository
|
||||||
repo.branches.collect(&:name).sort
|
repo.branches.collect(&:name).sort
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns an Array of Branches
|
||||||
|
def branches
|
||||||
|
repo.branches.sort_by(&:name)
|
||||||
|
end
|
||||||
|
|
||||||
# Returns an Array of tag names
|
# Returns an Array of tag names
|
||||||
def tag_names
|
def tag_names
|
||||||
repo.tags.collect(&:name).sort.reverse
|
repo.tags.collect(&:name).sort.reverse
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns an Array of Tags
|
||||||
|
def tags
|
||||||
|
repo.tags.sort_by(&:name).reverse
|
||||||
|
end
|
||||||
|
|
||||||
# Returns an Array of branch and tag names
|
# Returns an Array of branch and tag names
|
||||||
def ref_names
|
def ref_names
|
||||||
[branch_names + tag_names].flatten
|
[branch_names + tag_names].flatten
|
||||||
|
|
Loading…
Reference in a new issue