Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a4d71cba
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a4d71cba
编写于
11月 07, 2017
作者:
G
George Andrinopoulos
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add group milestone to feature spec and minor changes
上级
f4ed780e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
30 deletion
+13
-30
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+1
-1
app/views/shared/_group_milestones_sort_dropdown.html.haml
app/views/shared/_group_milestones_sort_dropdown.html.haml
+0
-22
lib/milestone_array.rb
lib/milestone_array.rb
+7
-7
spec/features/groups/milestones_sorting_spec.rb
spec/features/groups/milestones_sorting_spec.rb
+5
-0
未找到文件。
app/views/groups/milestones/index.html.haml
浏览文件 @
a4d71cba
...
...
@@ -4,7 +4,7 @@
=
render
'shared/milestones_filter'
,
counts:
@milestone_states
.nav-controls
=
render
'shared/
group_
milestones_sort_dropdown'
=
render
'shared/milestones_sort_dropdown'
-
if
can?
(
current_user
,
:admin_milestones
,
@group
)
=
link_to
"New milestone"
,
new_group_milestone_path
(
@group
),
class:
"btn btn-new"
...
...
app/views/shared/_group_milestones_sort_dropdown.html.haml
已删除
100644 → 0
浏览文件 @
f4ed780e
.dropdown.inline.prepend-left-10
%button
.dropdown-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
}
}
%span
.light
-
if
@sort
.
present?
=
milestone_sort_options_hash
[
@sort
]
-
else
=
sort_title_due_date_soon
=
icon
(
'chevron-down'
)
%ul
.dropdown-menu.dropdown-menu-align-right.dropdown-menu-sort
%li
=
link_to
page_filter_path
(
sort:
sort_value_due_date_soon
,
label:
true
)
do
=
sort_title_due_date_soon
=
link_to
page_filter_path
(
sort:
sort_value_due_date_later
,
label:
true
)
do
=
sort_title_due_date_later
=
link_to
page_filter_path
(
sort:
sort_value_start_date_soon
,
label:
true
)
do
=
sort_title_start_date_soon
=
link_to
page_filter_path
(
sort:
sort_value_start_date_later
,
label:
true
)
do
=
sort_title_start_date_later
=
link_to
page_filter_path
(
sort:
sort_value_name
,
label:
true
)
do
=
sort_title_name_asc
=
link_to
page_filter_path
(
sort:
sort_value_name_desc
,
label:
true
)
do
=
sort_title_name_desc
lib/milestone_array.rb
浏览文件 @
a4d71cba
...
...
@@ -13,7 +13,7 @@ module MilestoneArray
when
'name_asc'
sort_asc
(
array
,
'title'
)
when
'name_desc'
sort_
desc
(
array
,
'title'
)
sort_
asc
(
array
,
'title'
).
reverse
else
array
end
...
...
@@ -22,19 +22,19 @@ module MilestoneArray
private
def
sort_asc_nulls_last
(
array
,
attribute
)
array
.
select
(
&
attribute
.
to_sym
).
sort_by
(
&
attribute
.
to_sym
)
+
array
.
reject
(
&
attribute
.
to_sym
)
attribute
=
attribute
.
to_sym
array
.
select
(
&
attribute
).
sort_by
(
&
attribute
)
+
array
.
reject
(
&
attribute
)
end
def
sort_desc_nulls_last
(
array
,
attribute
)
array
.
select
(
&
attribute
.
to_sym
).
sort_by
(
&
attribute
.
to_sym
).
reverse
+
array
.
reject
(
&
attribute
.
to_sym
)
attribute
=
attribute
.
to_sym
array
.
select
(
&
attribute
).
sort_by
(
&
attribute
).
reverse
+
array
.
reject
(
&
attribute
)
end
def
sort_asc
(
array
,
attribute
)
array
.
sort_by
(
&
attribute
.
to_sym
)
end
def
sort_desc
(
array
,
attribute
)
array
.
sort_by
(
&
attribute
.
to_sym
).
reverse
end
end
end
spec/features/groups/milestones_sorting_spec.rb
浏览文件 @
a4d71cba
...
...
@@ -8,6 +8,7 @@ feature 'Milestones sorting', :js do
let!
(
:other_project_milestone1
)
{
create
(
:milestone
,
project:
other_project
,
title:
'v1.0'
,
due_date:
10
.
days
.
from_now
)
}
let!
(
:project_milestone2
)
{
create
(
:milestone
,
project:
project
,
title:
'v2.0'
,
due_date:
5
.
days
.
from_now
)
}
let!
(
:other_project_milestone2
)
{
create
(
:milestone
,
project:
other_project
,
title:
'v2.0'
,
due_date:
5
.
days
.
from_now
)
}
let!
(
:group_milestone
)
{
create
(
:milestone
,
group:
group
,
title:
'v3.0'
,
due_date:
7
.
days
.
from_now
)
}
let
(
:user
)
{
create
(
:group_member
,
:master
,
user:
create
(
:user
),
group:
group
).
user
}
before
do
...
...
@@ -22,6 +23,7 @@ feature 'Milestones sorting', :js do
# assert default sorting
within
'.milestones'
do
expect
(
page
.
all
(
'ul.content-list > li'
).
first
.
text
).
to
include
(
'v2.0'
)
expect
(
page
.
all
(
'ul.content-list > li'
)[
1
].
text
).
to
include
(
'v3.0'
)
expect
(
page
.
all
(
'ul.content-list > li'
).
last
.
text
).
to
include
(
'v1.0'
)
end
...
...
@@ -33,6 +35,8 @@ feature 'Milestones sorting', :js do
expect
(
sort_options
[
1
]).
to
eq
(
'Due later'
)
expect
(
sort_options
[
2
]).
to
eq
(
'Start soon'
)
expect
(
sort_options
[
3
]).
to
eq
(
'Start later'
)
expect
(
sort_options
[
4
]).
to
eq
(
'Name, ascending'
)
expect
(
sort_options
[
5
]).
to
eq
(
'Name, descending'
)
click_link
'Due later'
...
...
@@ -40,6 +44,7 @@ feature 'Milestones sorting', :js do
within
'.milestones'
do
expect
(
page
.
all
(
'ul.content-list > li'
).
first
.
text
).
to
include
(
'v1.0'
)
expect
(
page
.
all
(
'ul.content-list > li'
)[
1
].
text
).
to
include
(
'v3.0'
)
expect
(
page
.
all
(
'ul.content-list > li'
).
last
.
text
).
to
include
(
'v2.0'
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录