Commit 89d0d75c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Better filter var for MR. show reset filter only if makes sense

parent a43a3803
......@@ -2,7 +2,7 @@
# based on filtering passed via params for @project
class MergeRequestsLoadContext < BaseContext
def execute
type = params[:f]
type = params[:status]
merge_requests = project.merge_requests
......
......@@ -18,6 +18,9 @@
All
%fieldset
%hr
= link_to "Reset", project_issues_path(@project), class: 'btn pull-right'
- if %w(status milestone_id assignee_id label_name).select { |k| params[k].present? }.any?
= link_to project_issues_path(@project), class: 'cgray pull-right' do
%i.icon-remove
Clear filter
= form_tag project_issues_path(@project), method: 'get' do
%fieldset
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if (params[:f] == 'open' || !params[:f]))}
= link_to project_merge_requests_path(@project, f: 'open', milestone_id: params[:milestone_id]) do
%li{class: ("active" if (params[:status] == 'open' || !params[:status]))}
= link_to project_merge_requests_path(@project, status: 'open', milestone_id: params[:milestone_id]) do
Open
%li{class: ("active" if params[:f] == "closed")}
= link_to project_merge_requests_path(@project, f: "closed", milestone_id: params[:milestone_id]) do
%li{class: ("active" if params[:status] == "closed")}
= link_to project_merge_requests_path(@project, status: "closed", milestone_id: params[:milestone_id]) do
Closed
%li{class: ("active" if params[:f] == 'assigned-to-me')}
= link_to project_merge_requests_path(@project, f: 'assigned-to-me', milestone_id: params[:milestone_id]) do
%li{class: ("active" if params[:status] == 'assigned-to-me')}
= link_to project_merge_requests_path(@project, status: 'assigned-to-me', milestone_id: params[:milestone_id]) do
Assigned To Me
%li{class: ("active" if params[:f] == 'all')}
= link_to project_merge_requests_path(@project, f: 'all', milestone_id: params[:milestone_id]) do
%li{class: ("active" if params[:status] == 'all')}
= link_to project_merge_requests_path(@project, status: 'all', milestone_id: params[:milestone_id]) do
All
%fieldset
%hr
= link_to "Reset", project_merge_requests_path(@project), class: 'btn pull-right'
- if %w(status milestone_id assignee_id label_name).select { |k| params[k].present? }.any?
= link_to project_merge_requests_path(@project), class: 'cgray pull-right' do
%i.icon-remove
Clear filter
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment