Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
a4d71cba
Commit
a4d71cba
authored
Nov 07, 2017
by
George Andrinopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group milestone to feature spec and minor changes
parent
f4ed780e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
30 deletions
+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
No files found.
app/views/groups/milestones/index.html.haml
View file @
a4d71cba
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
=
render
'shared/milestones_filter'
,
counts:
@milestone_states
=
render
'shared/milestones_filter'
,
counts:
@milestone_states
.nav-controls
.nav-controls
=
render
'shared/
group_
milestones_sort_dropdown'
=
render
'shared/milestones_sort_dropdown'
-
if
can?
(
current_user
,
:admin_milestones
,
@group
)
-
if
can?
(
current_user
,
:admin_milestones
,
@group
)
=
link_to
"New milestone"
,
new_group_milestone_path
(
@group
),
class:
"btn btn-new"
=
link_to
"New milestone"
,
new_group_milestone_path
(
@group
),
class:
"btn btn-new"
...
...
app/views/shared/_group_milestones_sort_dropdown.html.haml
deleted
100644 → 0
View file @
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
View file @
a4d71cba
...
@@ -13,7 +13,7 @@ module MilestoneArray
...
@@ -13,7 +13,7 @@ module MilestoneArray
when
'name_asc'
when
'name_asc'
sort_asc
(
array
,
'title'
)
sort_asc
(
array
,
'title'
)
when
'name_desc'
when
'name_desc'
sort_
desc
(
array
,
'title'
)
sort_
asc
(
array
,
'title'
).
reverse
else
else
array
array
end
end
...
@@ -22,19 +22,19 @@ module MilestoneArray
...
@@ -22,19 +22,19 @@ module MilestoneArray
private
private
def
sort_asc_nulls_last
(
array
,
attribute
)
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
end
def
sort_desc_nulls_last
(
array
,
attribute
)
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
end
def
sort_asc
(
array
,
attribute
)
def
sort_asc
(
array
,
attribute
)
array
.
sort_by
(
&
attribute
.
to_sym
)
array
.
sort_by
(
&
attribute
.
to_sym
)
end
end
def
sort_desc
(
array
,
attribute
)
array
.
sort_by
(
&
attribute
.
to_sym
).
reverse
end
end
end
end
end
spec/features/groups/milestones_sorting_spec.rb
View file @
a4d71cba
...
@@ -8,6 +8,7 @@ feature 'Milestones sorting', :js do
...
@@ -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!
(
: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!
(
: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!
(
: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
}
let
(
:user
)
{
create
(
:group_member
,
:master
,
user:
create
(
:user
),
group:
group
).
user
}
before
do
before
do
...
@@ -22,6 +23,7 @@ feature 'Milestones sorting', :js do
...
@@ -22,6 +23,7 @@ feature 'Milestones sorting', :js do
# assert default sorting
# assert default sorting
within
'.milestones'
do
within
'.milestones'
do
expect
(
page
.
all
(
'ul.content-list > li'
).
first
.
text
).
to
include
(
'v2.0'
)
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'
)
expect
(
page
.
all
(
'ul.content-list > li'
).
last
.
text
).
to
include
(
'v1.0'
)
end
end
...
@@ -33,6 +35,8 @@ feature 'Milestones sorting', :js do
...
@@ -33,6 +35,8 @@ feature 'Milestones sorting', :js do
expect
(
sort_options
[
1
]).
to
eq
(
'Due later'
)
expect
(
sort_options
[
1
]).
to
eq
(
'Due later'
)
expect
(
sort_options
[
2
]).
to
eq
(
'Start soon'
)
expect
(
sort_options
[
2
]).
to
eq
(
'Start soon'
)
expect
(
sort_options
[
3
]).
to
eq
(
'Start later'
)
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'
click_link
'Due later'
...
@@ -40,6 +44,7 @@ feature 'Milestones sorting', :js do
...
@@ -40,6 +44,7 @@ feature 'Milestones sorting', :js do
within
'.milestones'
do
within
'.milestones'
do
expect
(
page
.
all
(
'ul.content-list > li'
).
first
.
text
).
to
include
(
'v1.0'
)
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'
)
expect
(
page
.
all
(
'ul.content-list > li'
).
last
.
text
).
to
include
(
'v2.0'
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment