summaryrefslogtreecommitdiff
path: root/app/helpers/tags_helper.rb
blob: de0b92b6fd71c9bac34129267eb1fb861d39d527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module TagsHelper
  def tag_path(tag)
    "/tags/#{tag}"
  end

  def filter_tags_path(options = {})
    exist_opts = {
      search: params[:search],
      sort: params[:sort]
    }

    options = exist_opts.merge(options)
    project_tags_path(@project, @id, options)
  end

  def tag_list(project)
    html = []

    project.tag_list.each do |tag|
      html << link_to(tag, tag_path(tag))
    end

    html.join.html_safe
  end

  def protected_tag?(project, tag)
    ProtectedTag.protected?(project, tag.name)
  end
end