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
Boxiang Sun
gitlab-ce
Commits
4f6b570f
Commit
4f6b570f
authored
Feb 17, 2014
by
Tudor Pavel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter issues by multiple labels with Spinach feature spec
parent
8a55636f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
19 deletions
+134
-19
app/assets/stylesheets/main/variables.scss
app/assets/stylesheets/main/variables.scss
+1
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+25
-0
app/views/projects/issues/_issues.html.haml
app/views/projects/issues/_issues.html.haml
+0
-19
app/views/shared/_project_filter.html.haml
app/views/shared/_project_filter.html.haml
+12
-0
features/project/issues/filter_labels.feature
features/project/issues/filter_labels.feature
+26
-0
features/steps/project/project_filter_labels.rb
features/steps/project/project_filter_labels.rb
+70
-0
No files found.
app/assets/stylesheets/main/variables.scss
View file @
4f6b570f
...
...
@@ -5,6 +5,7 @@ $primary_color: #2FA0BB;
$link_color
:
#3A89A3
;
$style_color
:
#474D57
;
$bg_style_color
:
#2299BB
;
$list-group-active-bg
:
$bg_style_color
;
$hover
:
#D9EDF7
;
/**
...
...
app/helpers/projects_helper.rb
View file @
4f6b570f
...
...
@@ -64,6 +64,31 @@ module ProjectsHelper
project_nav_tabs
.
include?
name
end
def
selected_label?
(
label_name
)
params
[
:label_name
].
to_s
.
split
(
','
).
include?
(
label_name
)
end
def
labels_filter_path
(
label_name
)
label_name
=
if
selected_label?
(
label_name
)
params
[
:label_name
].
split
(
','
).
reject
{
|
l
|
l
==
label_name
}.
join
(
','
)
elsif
params
[
:label_name
].
present?
"
#{
params
[
:label_name
]
}
,
#{
label_name
}
"
else
label_name
end
project_filter_path
(
label_name:
label_name
)
end
def
label_filter_class
(
label_name
)
if
selected_label?
(
label_name
)
'list-group-item active'
else
'list-group-item'
end
end
def
project_filter_path
(
options
=
{})
exist_opts
=
{
state:
params
[
:state
],
...
...
app/views/projects/issues/_issues.html.haml
View file @
4f6b570f
...
...
@@ -2,25 +2,6 @@
.check-all-holder
=
check_box_tag
"check_all_issues"
,
nil
,
false
,
class:
"check_all_issues left"
.issues-filters
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.icon-tags
%span
.light
labels:
-
if
params
[
:label_name
].
present?
%strong
=
params
[
:label_name
]
-
else
Any
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
project_filter_path
(
label_name:
nil
)
do
Any
-
issue_label_names
.
each
do
|
label_name
|
%li
=
link_to
project_filter_path
(
label_name:
label_name
)
do
%span
{
class:
"label #{label_css_class(label_name)}"
}
%i
.icon-tag
=
label_name
.dropdown.inline.prepend-left-10
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.icon-user
...
...
app/views/shared/_project_filter.html.haml
View file @
4f6b570f
...
...
@@ -26,6 +26,18 @@
=
link_to
project_filter_path
(
state:
'all'
)
do
All
%fieldset
%legend
Labels
%ul
.list-group
-
issue_label_names
.
each
do
|
label_name
|
=
link_to
labels_filter_path
(
label_name
),
class:
label_filter_class
(
label_name
)
do
%span
{
class:
"label #{label_css_class(label_name)}"
}
%i
.icon-tag
=
label_name
-
if
selected_label?
(
label_name
)
.pull-right
%i
.icon-remove
%fieldset
-
if
%w(state scope milestone_id assignee_id label_name)
.
select
{
|
k
|
params
[
k
].
present?
}.
any?
=
link_to
project_entities_path
,
class:
'cgray pull-right'
do
...
...
features/project/issues/filter_labels.feature
0 → 100644
View file @
4f6b570f
Feature
:
Project Filter Labels
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And project "Shop" has issue "Bugfix1" with tags
:
"bug",
"feature"
And project "Shop" has issue "Bugfix2" with tags
:
"bug",
"enhancement"
And project "Shop" has issue "Feature1" with tags
:
"feature"
Given
I visit project
"Shop"
issues page
Scenario
:
I
should see project issues
Then
I should see
"bug"
in labels filter
And
I should see
"feature"
in labels filter
And
I should see
"enhancement"
in labels filter
Scenario
:
I
filter by one label
Given
I click link
"bug"
Then
I should see
"Bugfix1"
in issues list
And
I should see
"Bugfix2"
in issues list
And
I should not see
"Feature1"
in issues list
Scenario
:
I
filter by two labels
Given
I click link
"bug"
And
I click link
"feature"
Then
I should see
"Bugfix1"
in issues list
And
I should not see
"Bugfix2"
in issues list
And
I should not see
"Feature1"
in issues list
features/steps/project/project_filter_labels.rb
0 → 100644
View file @
4f6b570f
class
ProjectFilterLabels
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
Then
'I should see "bug" in labels filter'
do
within
".list-group"
do
page
.
should
have_content
"bug"
end
end
And
'I should see "feature" in labels filter'
do
within
".list-group"
do
page
.
should
have_content
"feature"
end
end
And
'I should see "enhancement" in labels filter'
do
within
".list-group"
do
page
.
should
have_content
"enhancement"
end
end
Then
'I should see "Bugfix1" in issues list'
do
within
".issues-list"
do
page
.
should
have_content
"Bugfix1"
end
end
And
'I should see "Bugfix2" in issues list'
do
within
".issues-list"
do
page
.
should
have_content
"Bugfix2"
end
end
And
'I should not see "Bugfix2" in issues list'
do
within
".issues-list"
do
page
.
should_not
have_content
"Bugfix2"
end
end
And
'I should not see "Feature1" in issues list'
do
within
".issues-list"
do
page
.
should_not
have_content
"Feature1"
end
end
Given
'I click link "bug"'
do
click_link
"bug"
end
Given
'I click link "feature"'
do
click_link
"feature"
end
And
'project "Shop" has issue "Bugfix1" with tags: "bug", "feature"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:issue
,
title:
"Bugfix1"
,
project:
project
,
label_list:
[
'bug'
,
'feature'
])
end
And
'project "Shop" has issue "Bugfix2" with tags: "bug", "enhancement"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:issue
,
title:
"Bugfix2"
,
project:
project
,
label_list:
[
'bug'
,
'enhancement'
])
end
And
'project "Shop" has issue "Feature1" with tags: "feature"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:issue
,
title:
"Feature1"
,
project:
project
,
label_list:
'feature'
)
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