diff --git a/app/assets/stylesheets/gitlab_bootstrap/nav.scss b/app/assets/stylesheets/gitlab_bootstrap/nav.scss index de07730361751ad872aa5d4eff04a414a26175d0..f75d643aa0fc7edbe3792a48736fc010ac919626 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/nav.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/nav.scss @@ -10,6 +10,7 @@ > li > a { @include border-radius(0); } + &.nav-stacked { > li > a { border-left: 4px solid #EEE; @@ -30,6 +31,12 @@ } } } + + &.nav-pills-small { + > li > a { + padding: 8px 12px; + } + } } .nav-pills > .active > a > i[class^="icon-"] { background: inherit; } diff --git a/app/contexts/filter_context.rb b/app/contexts/filter_context.rb index 401d19b31c8a1e3b37bb23fcab84bb54d8612dd0..cd054e0c2c329adbfaf36beca323c5c7135b4039 100644 --- a/app/contexts/filter_context.rb +++ b/app/contexts/filter_context.rb @@ -11,7 +11,7 @@ class FilterContext end def apply_filter items - if params[:project_id] + if params[:project_id].present? items = items.where(project_id: params[:project_id]) end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index e3be07c9fe0a8da06e5bc6e150cd720c4dd2ee2e..35c7bcbd2cf2c5f815d04e52992dc285a99bd568 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -1,5 +1,5 @@ module DashboardHelper - def dashboard_filter_path(entity, options={}) + def filter_path(entity, options={}) exist_opts = { status: params[:status], project_id: params[:project_id], @@ -7,12 +7,9 @@ module DashboardHelper options = exist_opts.merge(options) - case entity - when 'issue' then - issues_dashboard_path(options) - when 'merge_request' - merge_requests_dashboard_path(options) - end + path = request.path + path << "?#{options.to_param}" + path end def entities_per_project project, entity diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 2ffbff7af8d0cbf1b082b72b95a518e276b0c72f..8573c59dc9486e82dc98c79f2ff88330afef377f 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,20 +1,4 @@ module GroupsHelper - def group_filter_path(entity, options={}) - exist_opts = { - status: params[:status], - project_id: params[:project_id], - } - - options = exist_opts.merge(options) - - case entity - when 'issue' then - issues_group_path(@group, options) - when 'merge_request' - merge_requests_group_path(@group, options) - end - end - def remove_user_from_group_message(group, user) "You are going to remove #{user.name} from #{group.name} Group. Are you sure?" end diff --git a/app/views/dashboard/_filter.html.haml b/app/views/dashboard/_filter.html.haml deleted file mode 100644 index d3208e6aad6f38a0118457bc5fa76f3f06aa0a22..0000000000000000000000000000000000000000 --- a/app/views/dashboard/_filter.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -= form_tag dashboard_filter_path(entity), method: 'get' do - %fieldset - %ul.nav.nav-pills.nav-stacked - %li{class: ("active" if !params[:status])} - = link_to dashboard_filter_path(entity, status: nil) do - Open - %li{class: ("active" if params[:status] == 'closed')} - = link_to dashboard_filter_path(entity, status: 'closed') do - Closed - %li{class: ("active" if params[:status] == 'all')} - = link_to dashboard_filter_path(entity, status: 'all') do - All - - %fieldset - %legend Projects: - %ul.nav.nav-pills.nav-stacked - - @projects.each do |project| - - unless entities_per_project(project, entity).zero? - %li{class: ("active" if params[:project_id] == project.id.to_s)} - = link_to dashboard_filter_path(entity, project_id: project.id) do - = project.name_with_namespace - %small.pull-right= entities_per_project(project, entity) - - %fieldset - %hr - = link_to "Reset", dashboard_filter_path(entity), class: 'btn pull-right' - diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 1041d9d1d51720a9423f44dabd1eba2e04d86e03..8b736fb50398a61d533d2c2b4898a1c35adbf13e 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -8,23 +8,6 @@ .row .span3 - = render 'filter', entity: 'issue' + = render 'shared/filter', entity: 'issue' .span9 - - if @issues.any? - - @issues.group_by(&:project).each do |group| - %div.ui-box - - project = group[0] - .title - = link_to_project project -   - %i.icon-angle-right -   - = link_to 'issues', project_issues_path(project) - - %ul.well-list.issues-list - - group[1].each do |issue| - = render 'projects/issues/issue', issue: issue - %hr - = paginate @issues, theme: "gitlab" - - else - %p.nothing_here_message Nothing to show here + = render 'shared/issues' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 77a40b2eef64401d975e2e977fd547cfc96af3f4..6ffe54028b56a0f2250dd117b15c63f382969741 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -8,6 +8,6 @@ %hr .row .span3 - = render 'filter', entity: 'merge_request' + = render 'shared/filter', entity: 'merge_request' .span9 = render 'shared/merge_requests' diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 5c76f1c22edcdb6d0506bf54500a0abcfa66dcc0..2785f92e41bed16fe4253ab825f4ffebddc7d301 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -6,18 +6,6 @@ %hr .row .span3 - = render 'filter', entity: 'issue' + = render 'shared/filter', entity: 'issue' .span9 - - if @issues.any? - - @issues.group_by(&:project).each do |group| - %div.ui-box - - project = group[0] - .title - = link_to_project project - %ul.well-list.issues-list - - group[1].each do |issue| - = render 'projects/issues/issue', issue: issue - %hr - = paginate @issues, theme: "gitlab" - - else - %p.nothing_here_message Nothing to show here + = render 'shared/issues' diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index eb8497c03f1905c406c47c5af9544a77d08d0b2a..93a07f4ed8939e56b525c27aa7b4f369ac6fc409 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -6,6 +6,6 @@ %hr .row .span3 - = render 'filter', entity: 'merge_request' + = render 'shared/filter', entity: 'merge_request' .span9 = render 'shared/merge_requests' diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..fc3232e0e0e64425feb6242ac0d67663ba78b203 --- /dev/null +++ b/app/views/shared/_filter.html.haml @@ -0,0 +1,29 @@ += form_tag filter_path(entity), method: 'get' do + %fieldset + %ul.nav.nav-pills.nav-stacked + %li{class: ("active" if params[:status].blank?)} + = link_to filter_path(entity, status: nil) do + Open + %li{class: ("active" if params[:status] == 'closed')} + = link_to filter_path(entity, status: 'closed') do + Closed + %li{class: ("active" if params[:status] == 'all')} + = link_to filter_path(entity, status: 'all') do + All + + %fieldset + %legend Projects: + %ul.nav.nav-pills.nav-pills-small.nav-stacked + - @projects.each do |project| + - unless entities_per_project(project, entity).zero? + %li{class: ("active" if params[:project_id] == project.id.to_s)} + = link_to filter_path(entity, project_id: project.id) do + = project.name_with_namespace + %small.pull-right= entities_per_project(project, entity) + + %fieldset + - if params[:status].present? || params[:project_id].present? + = link_to filter_path(entity, status: nil, project_id: nil), class: 'pull-right cgray' do + %i.icon-remove + Clear filter + diff --git a/app/views/shared/_issues.html.haml b/app/views/shared/_issues.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..33f8f5f4ad1c9255c44ac6207d0a1f4e417f3644 --- /dev/null +++ b/app/views/shared/_issues.html.haml @@ -0,0 +1,19 @@ +- if @issues.any? + - @issues.group_by(&:project).each do |group| + %div.ui-box + - project = group[0] + .title + = link_to_project project +   + %i.icon-angle-right +   + = link_to 'issues', project_issues_path(project) + + %ul.well-list.issues-list + - group[1].each do |issue| + = render 'projects/issues/issue', issue: issue + %hr + = paginate @issues, theme: "gitlab" +- else + %p.nothing_here_message Nothing to show here +