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

34 lines
839 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
module ExploreHelper
2016-09-13 17:45:13 +05:30
def filter_projects_path(options = {})
2015-04-26 12:48:37 +05:30
exist_opts = {
2017-08-17 22:00:37 +05:30
sort: params[:sort] || @sort,
2015-04-26 12:48:37 +05:30
scope: params[:scope],
group: params[:group],
tag: params[:tag],
visibility_level: params[:visibility_level],
2017-08-17 22:00:37 +05:30
name: params[:name],
personal: params[:personal],
archived: params[:archived],
shared: params[:shared],
namespace_id: params[:namespace_id],
2015-04-26 12:48:37 +05:30
}
2017-08-17 22:00:37 +05:30
options = exist_opts.merge(options).delete_if { |key, value| value.blank? }
request_path_with_options(options)
end
def filter_groups_path(options = {})
request_path_with_options(options)
2015-04-26 12:48:37 +05:30
end
2016-04-02 18:10:28 +05:30
def explore_controller?
controller.class.name.split("::").first == "Explore"
end
2017-08-17 22:00:37 +05:30
private
def request_path_with_options(options = {})
request.path + "?#{options.to_param}"
end
2015-04-26 12:48:37 +05:30
end