diff options
author | Brett Walker <bwalker@gitlab.com> | 2017-10-12 16:31:43 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2017-10-12 16:31:43 +0300 |
commit | 528f9cde0588b0a6e70b1fa971a99eca439d0aa6 (patch) | |
tree | 9a9fb939858962ab7b49ca046606fc49acb27509 /app/helpers/commits_helper.rb | |
parent | 6d3eea7b46d4b363b39a59e1fa17264de33d14d1 (diff) |
moved throttling into the controller. if we hit the throttling
threshhold, a message is shown indicating we didn't perform the search
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r-- | app/helpers/commits_helper.rb | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index ef22cafc2e2..8aaf3318f90 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -60,23 +60,33 @@ module CommitsHelper branches.include?(project.default_branch) ? branches.delete(project.default_branch) : branches.pop end + # returns a link formatted as a commit branch link + def commit_branch_link(url, text) + link_to(url, class: 'label label-gray ref-name') do + icon('code-fork') + " #{text}" + end + end + # Returns the sorted alphabetically links to branches, separated by a comma def commit_branches_links(project, branches) branches.sort.map do |branch| - link_to(project_ref_path(project, branch), class: "label label-gray ref-name") do - icon('code-fork') + " #{branch}" - end - end.join(" ").html_safe + commit_branch_link(project_ref_path(project, branch), branch) + end.join(' ').html_safe + end + + # returns a link formatted as a commit tag link + def commit_tag_link(url, text) + link_to(url, class: 'label label-gray ref-name') do + icon('tag') + " #{text}" + end end # Returns the sorted links to tags, separated by a comma def commit_tags_links(project, tags) sorted = VersionSorter.rsort(tags) sorted.map do |tag| - link_to(project_ref_path(project, tag), class: "label label-gray ref-name") do - icon('tag') + " #{tag}" - end - end.join(" ").html_safe + commit_tag_link(project_ref_path(project, tag), tag) + end.join(' ').html_safe end def link_to_browse_code(project, commit) |