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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
631d9284
Commit
631d9284
authored
Jul 31, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to add labels on group boards and serveral code improvements
parent
26ee6f34
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
58 additions
and
26 deletions
+58
-26
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+12
-4
app/assets/javascripts/boards/components/new_list_dropdown.js
...assets/javascripts/boards/components/new_list_dropdown.js
+1
-1
app/controllers/boards/issues_controller.rb
app/controllers/boards/issues_controller.rb
+6
-1
app/controllers/concerns/boards_responses.rb
app/controllers/concerns/boards_responses.rb
+1
-1
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+2
-0
app/controllers/groups/labels_controller.rb
app/controllers/groups/labels_controller.rb
+12
-4
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+3
-1
app/helpers/boards_helper.rb
app/helpers/boards_helper.rb
+5
-6
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+8
-0
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+2
-2
app/policies/ee/group_policy.rb
app/policies/ee/group_policy.rb
+2
-2
app/services/boards/issues/create_service.rb
app/services/boards/issues/create_service.rb
+2
-2
app/views/shared/issuable/_label_page_default.html.haml
app/views/shared/issuable/_label_page_default.html.haml
+1
-1
app/views/shared/issuable/_search_bar.html.haml
app/views/shared/issuable/_search_bar.html.haml
+1
-1
No files found.
app/assets/javascripts/api.js
View file @
631d9284
...
@@ -6,7 +6,8 @@ const Api = {
...
@@ -6,7 +6,8 @@ const Api = {
namespacesPath
:
'
/api/:version/namespaces.json
'
,
namespacesPath
:
'
/api/:version/namespaces.json
'
,
groupProjectsPath
:
'
/api/:version/groups/:id/projects.json
'
,
groupProjectsPath
:
'
/api/:version/groups/:id/projects.json
'
,
projectsPath
:
'
/api/:version/projects.json?simple=true
'
,
projectsPath
:
'
/api/:version/projects.json?simple=true
'
,
labelsPath
:
'
/:namespace_path/:project_path/labels
'
,
projectLabelsPath
:
'
/:namespace_path/:project_path/labels
'
,
groupLabelsPath
:
'
/groups/:namespace_path/labels
'
,
licensePath
:
'
/api/:version/templates/licenses/:key
'
,
licensePath
:
'
/api/:version/templates/licenses/:key
'
,
gitignorePath
:
'
/api/:version/templates/gitignores/:key
'
,
gitignorePath
:
'
/api/:version/templates/gitignores/:key
'
,
gitlabCiYmlPath
:
'
/api/:version/templates/gitlab_ci_ymls/:key
'
,
gitlabCiYmlPath
:
'
/api/:version/templates/gitlab_ci_ymls/:key
'
,
...
@@ -67,9 +68,16 @@ const Api = {
...
@@ -67,9 +68,16 @@ const Api = {
},
},
newLabel
(
namespacePath
,
projectPath
,
data
,
callback
)
{
newLabel
(
namespacePath
,
projectPath
,
data
,
callback
)
{
const
url
=
Api
.
buildUrl
(
Api
.
labelsPath
)
var
url
=
""
.
replace
(
'
:namespace_path
'
,
namespacePath
)
.
replace
(
'
:project_path
'
,
projectPath
);
if
(
projectPath
)
{
url
=
Api
.
buildUrl
(
Api
.
projectLabelsPath
)
.
replace
(
'
:namespace_path
'
,
namespacePath
)
.
replace
(
'
:project_path
'
,
projectPath
);
}
else
{
url
=
Api
.
buildUrl
(
Api
.
groupLabelsPath
).
replace
(
'
:namespace_path
'
,
namespacePath
)
}
return
$
.
ajax
({
return
$
.
ajax
({
url
,
url
,
type
:
'
POST
'
,
type
:
'
POST
'
,
...
...
app/assets/javascripts/boards/components/new_list_dropdown.js
View file @
631d9284
...
@@ -26,7 +26,7 @@ gl.issueBoards.newListDropdownInit = () => {
...
@@ -26,7 +26,7 @@ gl.issueBoards.newListDropdownInit = () => {
$this
.
glDropdown
({
$this
.
glDropdown
({
data
(
term
,
callback
)
{
data
(
term
,
callback
)
{
$
.
get
(
$this
.
attr
(
'
data-l
abels
'
))
$
.
get
(
$this
.
attr
(
'
data-l
ist-labels-path
'
))
.
then
((
resp
)
=>
{
.
then
((
resp
)
=>
{
callback
(
resp
);
callback
(
resp
);
});
});
...
...
app/controllers/boards/issues_controller.rb
View file @
631d9284
...
@@ -18,7 +18,7 @@ module Boards
...
@@ -18,7 +18,7 @@ module Boards
end
end
def
create
def
create
service
=
Boards
::
Issues
::
CreateService
.
new
(
board_paren
t
,
current_user
,
issue_params
)
service
=
Boards
::
Issues
::
CreateService
.
new
(
projec
t
,
current_user
,
issue_params
)
issue
=
service
.
execute
issue
=
service
.
execute
if
issue
.
valid?
if
issue
.
valid?
...
@@ -62,6 +62,11 @@ module Boards
...
@@ -62,6 +62,11 @@ module Boards
end
end
end
end
def
project
@project
||=
board
.
is_group_board?
?
Project
.
find
(
params
[
:project_id
])
:
board
.
parent
end
def
move_params
def
move_params
params
.
permit
(
:board_id
,
:id
,
:from_list_id
,
:to_list_id
,
:move_before_iid
,
:move_after_iid
)
params
.
permit
(
:board_id
,
:id
,
:from_list_id
,
:to_list_id
,
:move_before_iid
,
:move_after_iid
)
end
end
...
...
app/controllers/concerns/boards_responses.rb
View file @
631d9284
...
@@ -18,7 +18,7 @@ module BoardsResponses
...
@@ -18,7 +18,7 @@ module BoardsResponses
end
end
def
authorize_create_issue
def
authorize_create_issue
authorize_action_for!
(
board
.
paren
t
,
:admin_issue
)
authorize_action_for!
(
projec
t
,
:admin_issue
)
end
end
def
authorize_admin_list
def
authorize_admin_list
...
...
app/controllers/groups/boards_controller.rb
View file @
631d9284
...
@@ -20,5 +20,7 @@ class Groups::BoardsController < Groups::ApplicationController
...
@@ -20,5 +20,7 @@ class Groups::BoardsController < Groups::ApplicationController
def
assign_endpoint_vars
def
assign_endpoint_vars
@boards_endpoint
=
group_boards_path
(
group
)
@boards_endpoint
=
group_boards_path
(
group
)
@issues_path
=
issues_group_path
(
group
)
@issues_path
=
issues_group_path
(
group
)
@namespace_path
=
group
.
path
@labels_endpoint
=
group_labels_path
(
group
)
end
end
end
end
app/controllers/groups/labels_controller.rb
View file @
631d9284
...
@@ -34,10 +34,18 @@ class Groups::LabelsController < Groups::ApplicationController
...
@@ -34,10 +34,18 @@ class Groups::LabelsController < Groups::ApplicationController
def
create
def
create
@label
=
Labels
::
CreateService
.
new
(
label_params
).
execute
(
group:
group
)
@label
=
Labels
::
CreateService
.
new
(
label_params
).
execute
(
group:
group
)
if
@label
.
valid?
respond_to
do
|
format
|
redirect_to
group_labels_path
(
@group
)
format
.
html
do
else
if
@label
.
valid?
render
:new
redirect_to
group_labels_path
(
@group
)
else
render
:new
end
end
format
.
json
do
render
json:
LabelSerializer
.
new
.
represent_appearance
(
@label
)
end
end
end
end
end
...
...
app/controllers/projects/boards_controller.rb
View file @
631d9284
...
@@ -23,7 +23,9 @@ class Projects::BoardsController < Projects::ApplicationController
...
@@ -23,7 +23,9 @@ class Projects::BoardsController < Projects::ApplicationController
def
assign_endpoint_vars
def
assign_endpoint_vars
@boards_endpoint
=
project_boards_path
(
project
)
@boards_endpoint
=
project_boards_path
(
project
)
@issues_path
=
project_issues_path
(
project
)
@issues_path
=
project_issues_path
(
project
)
@bulk_issues_path
=
bulk_update_project_issues_path
(
@project
)
@bulk_issues_path
=
bulk_update_project_issues_path
(
project
)
@namespace_path
=
project
.
namespace
.
path
@labels_endpoint
=
project_labels_path
(
project
)
end
end
def
authorize_read_board!
def
authorize_read_board!
...
...
app/helpers/boards_helper.rb
View file @
631d9284
...
@@ -55,14 +55,13 @@ module BoardsHelper
...
@@ -55,14 +55,13 @@ module BoardsHelper
end
end
def
board_list_data
def
board_list_data
namespace_path
=
current_board_parent
.
try
(
:path
)
||
current_board_parent
.
namespace
.
try
(
:path
)
{
{
toggle:
"dropdown"
,
toggle:
"dropdown"
,
labels:
labels_filter_path
(
true
),
list_labels_path:
labels_filter_path
(
true
),
namespace_path:
namespace_path
,
labels_endpoint:
@labels_endpoint
,
project_path:
@project
&
.
try
(
:path
),
# Change this one on JS to use a single property: parent_path
namespace_path:
@namespace_path
,
group_path:
@group
&
.
try
(
:path
)
# Same here
project_path:
@project
&
.
try
(
:path
),
group_path:
@group
&
.
try
(
:path
)
}
}
end
end
...
...
app/helpers/issuables_helper.rb
View file @
631d9284
...
@@ -362,4 +362,12 @@ module IssuablesHelper
...
@@ -362,4 +362,12 @@ module IssuablesHelper
params
[
:format
]
=
:json
if
issuable
.
is_a?
(
Issue
)
params
[
:format
]
=
:json
if
issuable
.
is_a?
(
Issue
)
end
end
end
end
def
labels_path
if
@project
project_labels_path
(
@project
)
elsif
@group
group_labels_path
(
@group
)
end
end
end
end
app/helpers/labels_helper.rb
View file @
631d9284
...
@@ -122,12 +122,12 @@ module LabelsHelper
...
@@ -122,12 +122,12 @@ module LabelsHelper
end
end
def
labels_filter_path
(
only_group_labels
=
false
)
def
labels_filter_path
(
only_group_labels
=
false
)
return
group_labels_path
(
@group
,
:json
,
only_group_labels:
only_group_labels
)
if
@group
project
=
@target_project
||
@project
project
=
@target_project
||
@project
if
project
if
project
project_labels_path
(
project
,
:json
)
project_labels_path
(
project
,
:json
)
elsif
@group
group_labels_path
(
@group
,
:json
,
only_group_labels:
only_group_labels
)
else
else
dashboard_labels_path
(
:json
)
dashboard_labels_path
(
:json
)
end
end
...
...
app/policies/ee/group_policy.rb
View file @
631d9284
...
@@ -11,8 +11,8 @@ module EE
...
@@ -11,8 +11,8 @@ module EE
enable
:admin_board
enable
:admin_board
end
end
rule
{
public_group
}
.
enable
:read_board
rule
{
public_group
}.
enable
:read_board
rule
{
guest
}
.
enable
:read_board
rule
{
guest
}.
enable
:read_board
rule
{
ldap_synced
}.
prevent
:admin_group_member
rule
{
ldap_synced
}.
prevent
:admin_group_member
...
...
app/services/boards/issues/create_service.rb
View file @
631d9284
...
@@ -8,7 +8,7 @@ module Boards
...
@@ -8,7 +8,7 @@ module Boards
private
private
def
board
def
board
@board
||=
p
rojec
t
.
boards
.
find
(
params
.
delete
(
:board_id
))
@board
||=
p
aren
t
.
boards
.
find
(
params
.
delete
(
:board_id
))
end
end
def
list
def
list
...
@@ -16,7 +16,7 @@ module Boards
...
@@ -16,7 +16,7 @@ module Boards
end
end
def
create_issue
(
params
)
def
create_issue
(
params
)
::
Issues
::
CreateService
.
new
(
p
rojec
t
,
current_user
,
params
).
execute
::
Issues
::
CreateService
.
new
(
p
aren
t
,
current_user
,
params
).
execute
end
end
end
end
end
end
...
...
app/views/shared/issuable/_label_page_default.html.haml
View file @
631d9284
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
%a
.dropdown-toggle-page
{
href:
"#"
}
%a
.dropdown-toggle-page
{
href:
"#"
}
Create new label
Create new label
%li
%li
=
link_to
labels_
filter_
path
,
:"data-is-link"
=>
true
do
=
link_to
labels_path
,
:"data-is-link"
=>
true
do
-
if
show_create
&&
can?
(
current_user
,
:admin_label
,
current_board_parent
)
-
if
show_create
&&
can?
(
current_user
,
:admin_label
,
current_board_parent
)
Manage labels
Manage labels
-
else
-
else
...
...
app/views/shared/issuable/_search_bar.html.haml
View file @
631d9284
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
Add list
Add list
.dropdown-menu.dropdown-menu-paging.dropdown-menu-align-right.dropdown-menu-issues-board-new.dropdown-menu-selectable
.dropdown-menu.dropdown-menu-paging.dropdown-menu-align-right.dropdown-menu-issues-board-new.dropdown-menu-selectable
=
render
partial:
"shared/issuable/label_page_default"
,
locals:
{
show_footer:
true
,
show_create:
true
,
show_boards_content:
true
,
title:
"Add list"
}
=
render
partial:
"shared/issuable/label_page_default"
,
locals:
{
show_footer:
true
,
show_create:
true
,
show_boards_content:
true
,
title:
"Add list"
}
-
if
can?
(
current_user
,
:admin_label
,
board
.
parent
)
-
if
can?
(
current_user
,
:admin_label
,
board
.
parent
)
=
render
partial:
"shared/issuable/label_page_create"
=
render
partial:
"shared/issuable/label_page_create"
=
dropdown_loading
=
dropdown_loading
-
if
@project
-
if
@project
...
...
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