BigW Consortium Gitlab

explore_helper.rb 838 Bytes
Newer Older
1
module ExploreHelper
2
  def filter_projects_path(options = {})
3
    exist_opts = {
4
      sort: params[:sort] || @sort,
5 6 7 8
      scope: params[:scope],
      group: params[:group],
      tag: params[:tag],
      visibility_level: params[:visibility_level],
9 10 11 12
      name: params[:name],
      personal: params[:personal],
      archived: params[:archived],
      shared: params[:shared],
13
      namespace_id: params[:namespace_id]
14 15
    }

16
    options = exist_opts.merge(options).delete_if { |key, value| value.blank? }
17 18 19 20 21
    request_path_with_options(options)
  end

  def filter_groups_path(options = {})
    request_path_with_options(options)
22
  end
23 24 25 26

  def explore_controller?
    controller.class.name.split("::").first == "Explore"
  end
27 28 29 30 31 32

  private

  def request_path_with_options(options = {})
    request.path + "?#{options.to_param}"
  end
33
end