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
bf9d928b
Commit
bf9d928b
authored
Sep 19, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow user to create a board list based on a group label
parent
398ab263
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+4
-1
app/services/boards/lists/create_service.rb
app/services/boards/lists/create_service.rb
+5
-1
spec/services/boards/lists/create_service_spec.rb
spec/services/boards/lists/create_service_spec.rb
+4
-0
spec/services/boards/lists/generate_service_spec.rb
spec/services/boards/lists/generate_service_spec.rb
+4
-0
No files found.
app/controllers/projects/issues_controller.rb
View file @
bf9d928b
...
...
@@ -25,7 +25,10 @@ class Projects::IssuesController < Projects::ApplicationController
def
index
@issues
=
issues_collection
@issues
=
@issues
.
page
(
params
[
:page
])
@labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
title:
params
[
:label_name
]).
execute
if
params
[
:label_name
].
presence
if
params
[
:label_name
].
presence
@labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
title:
params
[
:label_name
]).
execute
end
respond_to
do
|
format
|
format
.
html
...
...
app/services/boards/lists/create_service.rb
View file @
bf9d928b
...
...
@@ -3,7 +3,7 @@ module Boards
class
CreateService
<
BaseService
def
execute
(
board
)
List
.
transaction
do
label
=
project
.
labels
.
find
(
params
[
:label_id
])
label
=
available_
labels
.
find
(
params
[
:label_id
])
position
=
next_position
(
board
)
create_list
(
board
,
label
,
position
)
...
...
@@ -12,6 +12,10 @@ module Boards
private
def
available_labels
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
).
execute
end
def
next_position
(
board
)
max_position
=
board
.
lists
.
movable
.
maximum
(
:position
)
max_position
.
nil?
?
0
:
max_position
.
succ
...
...
spec/services/boards/lists/create_service_spec.rb
View file @
bf9d928b
...
...
@@ -9,6 +9,10 @@ describe Boards::Lists::CreateService, services: true do
subject
(
:service
)
{
described_class
.
new
(
project
,
user
,
label_id:
label
.
id
)
}
before
do
project
.
team
<<
[
user
,
:developer
]
end
context
'when board lists is empty'
do
it
'creates a new list at beginning of the list'
do
list
=
service
.
execute
(
board
)
...
...
spec/services/boards/lists/generate_service_spec.rb
View file @
bf9d928b
...
...
@@ -8,6 +8,10 @@ describe Boards::Lists::GenerateService, services: true do
subject
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
before
do
project
.
team
<<
[
user
,
:developer
]
end
context
'when board lists is empty'
do
it
'creates the default lists'
do
expect
{
service
.
execute
(
board
)
}.
to
change
(
board
.
lists
,
:count
).
by
(
2
)
...
...
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