Module: ExploreHelper

Defined in:
app/helpers/explore_helper.rb

Instance Method Summary collapse

Instance Method Details

#explore_nav_link?(link) ⇒ Boolean

Returns:

  • (Boolean)

30
31
32
# File 'app/helpers/explore_helper.rb', line 30

def explore_nav_link?(link)
  explore_nav_links.include?(link)
end

26
27
28
# File 'app/helpers/explore_helper.rb', line 26

def explore_nav_links
  @explore_nav_links ||= get_explore_nav_links
end

#filter_groups_path(options = {}) ⇒ Object


22
23
24
# File 'app/helpers/explore_helper.rb', line 22

def filter_groups_path(options = {})
  request_path_with_options(options)
end

#filter_projects_path(options = {}) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/explore_helper.rb', line 4

def filter_projects_path(options = {})
  exist_opts = {
    sort: params[:sort] || @sort,
    scope: params[:scope],
    group: params[:group],
    tag: params[:tag],
    visibility_level: params[:visibility_level],
    name: params[:name],
    personal: params[:personal],
    archived: params[:archived],
    shared: params[:shared],
    namespace_id: params[:namespace_id]
  }

  options = exist_opts.merge(options).delete_if { |key, value| value.blank? }
  request_path_with_options(options)
end

#projects_filter_itemsObject


38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/helpers/explore_helper.rb', line 38

def projects_filter_items
  [
    { value: _('Any'), text: _('Any'), href: filter_projects_path(visibility_level: nil) },
    *Gitlab::VisibilityLevel.options.keys.map do |key|
      {
        value: key,
        text: key,
        href: filter_projects_path(visibility_level: Gitlab::VisibilityLevel.options[key])
      }
    end
  ]
end

#projects_filter_selected(visibility_level) ⇒ Object


51
52
53
# File 'app/helpers/explore_helper.rb', line 51

def projects_filter_selected(visibility_level)
  visibility_level.present? ? visibility_level_label(visibility_level.to_i) : _('Any')
end

#public_visibility_restricted?Boolean

Returns:

  • (Boolean)

34
35
36
# File 'app/helpers/explore_helper.rb', line 34

def public_visibility_restricted?
  Gitlab::VisibilityLevel.public_visibility_restricted?
end