提交 512cd023 编写于 作者: D Dmitriy Zaporozhets

Dashboard/Group issues and mr pages refactoring

上级 21c70354
......@@ -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; }
......
......@@ -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
......
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
......
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
......
......@@ -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
&nbsp;
%i.icon-angle-right
&nbsp;
= 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'
......@@ -8,6 +8,6 @@
%hr
.row
.span3
= render 'filter', entity: 'merge_request'
= render 'shared/filter', entity: 'merge_request'
.span9
= render 'shared/merge_requests'
......@@ -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'
......@@ -6,6 +6,6 @@
%hr
.row
.span3
= render 'filter', entity: 'merge_request'
= render 'shared/filter', entity: 'merge_request'
.span9
= render 'shared/merge_requests'
= form_tag dashboard_filter_path(entity), method: 'get' do
= form_tag 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
%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 dashboard_filter_path(entity, status: 'closed') do
= link_to filter_path(entity, status: 'closed') do
Closed
%li{class: ("active" if params[:status] == 'all')}
= link_to dashboard_filter_path(entity, status: 'all') do
= link_to filter_path(entity, status: 'all') do
All
%fieldset
%legend Projects:
%ul.nav.nav-pills.nav-stacked
%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 dashboard_filter_path(entity, project_id: project.id) do
= link_to 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'
- 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
- if @issues.any?
- @issues.group_by(&:project).each do |group|
%div.ui-box
- project = group[0]
.title
= link_to_project project
&nbsp;
%i.icon-angle-right
&nbsp;
= 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册