debian-mirror-gitlab/app/helpers/tags_helper.rb

51 lines
1.2 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
module TagsHelper
2015-04-26 12:48:37 +05:30
def tag_path(tag)
2014-09-02 18:07:02 +05:30
"/tags/#{tag}"
end
2016-09-29 09:46:39 +05:30
def filter_tags_path(options = {})
exist_opts = {
search: params[:search],
sort: params[:sort]
}
options = exist_opts.merge(options)
2017-09-10 17:25:29 +05:30
project_tags_path(@project, @id, options)
2016-09-29 09:46:39 +05:30
end
2015-04-26 12:48:37 +05:30
def tag_list(project)
2018-12-05 23:21:45 +05:30
html = []
2014-09-02 18:07:02 +05:30
project.tag_list.each do |tag|
2015-04-26 12:48:37 +05:30
html << link_to(tag, tag_path(tag))
2014-09-02 18:07:02 +05:30
end
2018-12-05 23:21:45 +05:30
html.join.html_safe
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
def protected_tag?(project, tag)
ProtectedTag.protected?(project, tag.name)
end
2019-12-21 20:55:43 +05:30
def tag_description_help_text
text = s_('TagsPage|Optionally, add a message to the tag. Leaving this blank creates '\
'a %{link_start}lightweight tag.%{link_end}') % {
link_start: '<a href="https://git-scm.com/book/en/v2/Git-Basics-Tagging\" target="_blank" rel="noopener noreferrer">',
link_end: '</a>'
}
text.html_safe
end
2021-01-03 14:25:43 +05:30
def delete_tag_modal_attributes(tag_name)
{
title: s_('TagsPage|Delete tag'),
message: s_('TagsPage|Deleting the %{tag_name} tag cannot be undone. Are you sure?') % { tag_name: tag_name },
okVariant: 'danger',
okTitle: s_('TagsPage|Delete tag')
}.to_json
end
2014-09-02 18:07:02 +05:30
end