Add UI/UX improvements
- Leave 'too many tags to search' always visible - Add different message to the branch/tags so it states its unavailable
This commit is contained in:
parent
2bdad7964a
commit
244bec9101
2 changed files with 20 additions and 14 deletions
|
@ -60,7 +60,7 @@ module CommitsHelper
|
|||
branches.include?(project.default_branch) ? branches.delete(project.default_branch) : branches.pop
|
||||
end
|
||||
|
||||
# returns a link formatted as a commit branch link
|
||||
# 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}"
|
||||
|
@ -74,13 +74,25 @@ module CommitsHelper
|
|||
end.join(' ').html_safe
|
||||
end
|
||||
|
||||
# returns a link formatted as a commit tag link
|
||||
# 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
|
||||
|
||||
def branches_unavailable_message
|
||||
link_to('#', class: 'label label-gray ref-name', title: 'Project has too many branches to search') do
|
||||
icon('tag') + ' Branches unavailable'
|
||||
end
|
||||
end
|
||||
|
||||
def tags_unavailable_message
|
||||
link_to('#', class: 'label label-gray ref-name', title: 'Project has too many tags to search') do
|
||||
icon('tag') + ' Tags unavailable'
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the sorted links to tags, separated by a comma
|
||||
def commit_tags_links(project, tags)
|
||||
sorted = VersionSorter.rsort(tags)
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
- if @branches_limit_exceeded
|
||||
= commit_branch_link('#', _('Too many branches to search'))
|
||||
= branches_unavailable_message
|
||||
- elsif @branches.any?
|
||||
- branch = commit_default_branch(@project, @branches)
|
||||
= commit_branch_link(project_ref_path(@project, branch), branch)
|
||||
|
||||
-# `commit_default_branch` deletes the default branch from `@branches`,
|
||||
-# so only render this if we have more branches or tags left
|
||||
- if @branches.any? || @tags.any? || @tags_limit_exceeded
|
||||
%span
|
||||
= link_to "…", "#", class: "js-details-expand label label-gray"
|
||||
|
||||
%span.js-details-content.hide
|
||||
= commit_branches_links(@project, @branches) if @branches.any?
|
||||
- if @tags_limit_exceeded
|
||||
= commit_tag_link('#', _('Too many tags to search'))
|
||||
- elsif @tags.any?
|
||||
= commit_tags_links(@project, @tags)
|
||||
-# so only render this if we have more branches or tags left
|
||||
- if @tags_limit_exceeded
|
||||
= tags_unavailable_message
|
||||
- elsif @tags.any?
|
||||
= commit_tags_links(@project, @tags)
|
||||
|
|
Loading…
Reference in a new issue