Module: ExploreHelper
- Defined in:
- app/helpers/explore_helper.rb
Instance Method Summary collapse
- #explore_nav_link?(link) ⇒ Boolean
- #explore_nav_links ⇒ Object
- #filter_groups_path(options = {}) ⇒ Object
- #filter_projects_path(options = {}) ⇒ Object
- #projects_filter_items ⇒ Object
- #projects_filter_selected(visibility_level) ⇒ Object
- #public_visibility_restricted? ⇒ Boolean
Instance Method Details
#explore_nav_link?(link) ⇒ Boolean
32 33 34 |
# File 'app/helpers/explore_helper.rb', line 32 def explore_nav_link?(link) explore_nav_links.include?(link) end |
#explore_nav_links ⇒ Object
28 29 30 |
# File 'app/helpers/explore_helper.rb', line 28 def explore_nav_links @explore_nav_links ||= get_explore_nav_links end |
#filter_groups_path(options = {}) ⇒ Object
24 25 26 |
# File 'app/helpers/explore_helper.rb', line 24 def filter_groups_path( = {}) () end |
#filter_projects_path(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/explore_helper.rb', line 4 def filter_projects_path( = {}) 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] } exist_opts[:language] = params[:language] = exist_opts.merge().delete_if { |key, value| value.blank? } () end |
#projects_filter_items ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/explore_helper.rb', line 40 def projects_filter_items [ { value: _('Any'), text: _('Any'), href: filter_projects_path(visibility_level: nil) }, *Gitlab::VisibilityLevel..keys.map do |key| { value: key, text: key, href: filter_projects_path(visibility_level: Gitlab::VisibilityLevel.[key]) } end ] end |
#projects_filter_selected(visibility_level) ⇒ Object
53 54 55 |
# File 'app/helpers/explore_helper.rb', line 53 def projects_filter_selected(visibility_level) visibility_level.present? ? visibility_level_label(visibility_level.to_i) : _('Any') end |
#public_visibility_restricted? ⇒ Boolean
36 37 38 |
# File 'app/helpers/explore_helper.rb', line 36 def public_visibility_restricted? Gitlab::VisibilityLevel.public_visibility_restricted? end |