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
Jérome Perrin
gitlab-ce
Commits
a0a423fe
Commit
a0a423fe
authored
Apr 15, 2016
by
Arinde Eniola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix failing tests
parent
d0ad5669
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
11 deletions
+50
-11
app/assets/javascripts/issues.js.coffee
app/assets/javascripts/issues.js.coffee
+23
-4
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+8
-1
app/views/shared/issuable/_nav.html.haml
app/views/shared/issuable/_nav.html.haml
+5
-5
spec/features/issues/filter_issues_spec.rb
spec/features/issues/filter_issues_spec.rb
+8
-1
spec/features/merge_requests/filter_by_milestone_spec.rb
spec/features/merge_requests/filter_by_milestone_spec.rb
+6
-0
No files found.
app/assets/javascripts/issues.js.coffee
View file @
a0a423fe
...
@@ -36,19 +36,37 @@
...
@@ -36,19 +36,37 @@
$
(
".selected_issue"
).
bind
"change"
,
Issues
.
checkChanged
$
(
".selected_issue"
).
bind
"change"
,
Issues
.
checkChanged
getLabelsQueryString
:
->
pageURL
=
decodeURIComponent
(
window
.
location
.
search
.
substring
(
1
))
urlVariables
=
pageURL
.
split
(
'&'
)
labelParams
=
(
variables
for
variables
in
urlVariables
when
variables
.
indexOf
(
'label_name[]'
)
>
-
1
).
join
(
'&'
)
removeLabelsQueryString
:
(
url
)
->
pageURL
=
decodeURIComponent
(
url
)
urlVariables
=
pageURL
.
split
(
'&'
)
Params
=
(
variables
for
variables
in
urlVariables
when
variables
.
indexOf
(
'label_name[]'
)
is
-
1
).
join
(
'&'
)
# Update state filters if present in page
# Update state filters if present in page
updateStateFilters
:
->
updateStateFilters
:
->
stateFilters
=
$
(
'.issues-state-filters'
)
stateFilters
=
$
(
'.issues-state-filters'
)
newParams
=
{}
newParams
=
{}
paramKeys
=
[
'author_id'
,
'
label_name'
,
'
milestone_title'
,
'assignee_id'
,
'issue_search'
]
paramKeys
=
[
'author_id'
,
'milestone_title'
,
'assignee_id'
,
'issue_search'
]
for
paramKey
in
paramKeys
for
paramKey
in
paramKeys
newParams
[
paramKey
]
=
gl
.
utils
.
getUrlParameter
(
paramKey
)
or
''
newParams
[
paramKey
]
=
gl
.
utils
.
getUrlParameter
(
paramKey
)
or
''
if
stateFilters
.
length
if
stateFilters
.
length
stateFilters
.
find
(
'a'
).
each
->
stateFilters
.
find
(
'a'
).
each
->
initialUrl
=
$
(
this
).
attr
'href'
initialUrl
=
Issues
.
removeLabelsQueryString
(
$
(
this
).
attr
'href'
)
$
(
this
).
attr
'href'
,
gl
.
utils
.
mergeUrlParams
(
newParams
,
initialUrl
)
if
Issues
.
getLabelsQueryString
()
newUrl
=
"
#{
gl
.
utils
.
mergeUrlParams
(
newParams
,
initialUrl
)
}
&
#{
Issues
.
getLabelsQueryString
()
}
"
else
newUrl
=
gl
.
utils
.
mergeUrlParams
(
newParams
,
initialUrl
)
$
(
this
).
attr
'href'
,
newUrl
# Make sure we trigger ajax request only after user stop typing
# Make sure we trigger ajax request only after user stop typing
initSearch
:
->
initSearch
:
->
...
@@ -91,7 +109,8 @@
...
@@ -91,7 +109,8 @@
opacity
:
0
opacity
:
0
}
}
}).
then
(
->
}).
then
(
->
$filteredLabels
.
html
(
Issue
.
labelRow
(
data
))
if
typeof
Issue
.
labelRow
is
'function'
$filteredLabels
.
html
(
Issue
.
labelRow
(
data
))
$spans
=
$filteredLabels
.
find
(
'span'
)
$spans
=
$filteredLabels
.
find
(
'span'
)
$spans
.
css
(
'opacity'
,
0
)
$spans
.
css
(
'opacity'
,
0
)
return
gl
.
animate
.
animateEach
(
$spans
,
'fadeInUp'
,
20
,
{
return
gl
.
animate
.
animateEach
(
$spans
,
'fadeInUp'
,
20
,
{
...
...
app/helpers/application_helper.rb
View file @
a0a423fe
...
@@ -254,11 +254,11 @@ module ApplicationHelper
...
@@ -254,11 +254,11 @@ module ApplicationHelper
def
page_filter_path
(
options
=
{})
def
page_filter_path
(
options
=
{})
without
=
options
.
delete
(
:without
)
without
=
options
.
delete
(
:without
)
add_label
=
options
.
delete
(
:label
)
exist_opts
=
{
exist_opts
=
{
state:
params
[
:state
],
state:
params
[
:state
],
scope:
params
[
:scope
],
scope:
params
[
:scope
],
label_name:
params
[
:label_name
],
milestone_title:
params
[
:milestone_title
],
milestone_title:
params
[
:milestone_title
],
assignee_id:
params
[
:assignee_id
],
assignee_id:
params
[
:assignee_id
],
author_id:
params
[
:author_id
],
author_id:
params
[
:author_id
],
...
@@ -275,6 +275,13 @@ module ApplicationHelper
...
@@ -275,6 +275,13 @@ module ApplicationHelper
path
=
request
.
path
path
=
request
.
path
path
<<
"?
#{
options
.
to_param
}
"
path
<<
"?
#{
options
.
to_param
}
"
if
add_label
if
params
[
:label_name
].
present?
and
params
[
:label_name
].
respond_to?
(
'any?'
)
params
[
:label_name
].
each
do
|
label
|
path
<<
"&label_name[]=
#{
label
}
"
end
end
end
path
path
end
end
...
...
app/views/shared/issuable/_nav.html.haml
View file @
a0a423fe
...
@@ -4,22 +4,22 @@
...
@@ -4,22 +4,22 @@
-
else
-
else
-
page_context_word
=
'issues'
-
page_context_word
=
'issues'
%li
{
class:
(
"active"
if
params
[
:state
]
==
'opened'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'opened'
)}
=
link_to
page_filter_path
(
state:
'opened'
),
title:
"Filter by
#{
page_context_word
}
that are currently opened."
do
=
link_to
page_filter_path
(
state:
'opened'
,
label:
true
),
title:
"Filter by
#{
page_context_word
}
that are currently opened."
do
#{
state_filters_text_for
(
:opened
,
@project
)
}
#{
state_filters_text_for
(
:opened
,
@project
)
}
-
if
defined?
(
type
)
&&
type
==
:merge_requests
-
if
defined?
(
type
)
&&
type
==
:merge_requests
%li
{
class:
(
"active"
if
params
[
:state
]
==
'merged'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'merged'
)}
=
link_to
page_filter_path
(
state:
'merged'
),
title:
'Filter by merge requests that are currently merged.'
do
=
link_to
page_filter_path
(
state:
'merged'
,
label:
true
),
title:
'Filter by merge requests that are currently merged.'
do
#{
state_filters_text_for
(
:merged
,
@project
)
}
#{
state_filters_text_for
(
:merged
,
@project
)
}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
=
link_to
page_filter_path
(
state:
'closed'
),
title:
'Filter by merge requests that are currently closed and unmerged.'
do
=
link_to
page_filter_path
(
state:
'closed'
,
label:
true
),
title:
'Filter by merge requests that are currently closed and unmerged.'
do
#{
state_filters_text_for
(
:closed
,
@project
)
}
#{
state_filters_text_for
(
:closed
,
@project
)
}
-
else
-
else
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
=
link_to
page_filter_path
(
state:
'closed'
),
title:
'Filter by issues that are currently closed.'
do
=
link_to
page_filter_path
(
state:
'closed'
,
label:
true
),
title:
'Filter by issues that are currently closed.'
do
#{
state_filters_text_for
(
:closed
,
@project
)
}
#{
state_filters_text_for
(
:closed
,
@project
)
}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'all'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'all'
)}
=
link_to
page_filter_path
(
state:
'all'
),
title:
"Show all
#{
page_context_word
}
."
do
=
link_to
page_filter_path
(
state:
'all'
,
label:
true
),
title:
"Show all
#{
page_context_word
}
."
do
#{
state_filters_text_for
(
:all
,
@project
)
}
#{
state_filters_text_for
(
:all
,
@project
)
}
spec/features/issues/filter_issues_spec.rb
View file @
a0a423fe
...
@@ -84,14 +84,20 @@ describe 'Filter issues', feature: true do
...
@@ -84,14 +84,20 @@ describe 'Filter issues', feature: true do
it
'should filter by any label'
do
it
'should filter by any label'
do
find
(
'.dropdown-menu-labels a'
,
text:
'Any Label'
).
click
find
(
'.dropdown-menu-labels a'
,
text:
'Any Label'
).
click
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
sleep
2
page
.
within
'.labels-filter'
do
page
.
within
'.labels-filter'
do
expect
(
page
).
to
have_content
'Any Label'
expect
(
page
).
to
have_content
'Any Label'
end
end
expect
(
find
(
'.js-label-select .dropdown-toggle-text'
)).
to
have_content
(
'Label'
)
expect
(
find
(
'.js-label-select .dropdown-toggle-text'
)).
to
have_content
(
'
Any
Label'
)
end
end
it
'should filter by no label'
do
it
'should filter by no label'
do
find
(
'.dropdown-menu-labels a'
,
text:
'No Label'
).
click
find
(
'.dropdown-menu-labels a'
,
text:
'No Label'
).
click
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
sleep
2
page
.
within
'.labels-filter'
do
page
.
within
'.labels-filter'
do
expect
(
page
).
to
have_content
'No Label'
expect
(
page
).
to
have_content
'No Label'
end
end
...
@@ -121,6 +127,7 @@ describe 'Filter issues', feature: true do
...
@@ -121,6 +127,7 @@ describe 'Filter issues', feature: true do
find
(
'.js-label-select'
).
click
find
(
'.js-label-select'
).
click
find
(
'.dropdown-menu-labels .dropdown-content a'
,
text:
label
.
title
).
click
find
(
'.dropdown-menu-labels .dropdown-content a'
,
text:
label
.
title
).
click
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
sleep
2
sleep
2
end
end
...
...
spec/features/merge_requests/filter_by_milestone_spec.rb
View file @
a0a423fe
...
@@ -2,8 +2,14 @@ require 'rails_helper'
...
@@ -2,8 +2,14 @@ require 'rails_helper'
feature
'Merge Request filtering by Milestone'
,
feature:
true
do
feature
'Merge Request filtering by Milestone'
,
feature:
true
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:user
)
{
create
(
:user
)}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
scenario
'filters by no Milestone'
,
js:
true
do
scenario
'filters by no Milestone'
,
js:
true
do
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
create
(
:merge_request
,
:simple
,
source_project:
project
,
milestone:
milestone
)
create
(
:merge_request
,
:simple
,
source_project:
project
,
milestone:
milestone
)
...
...
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