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
Show 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 = {
namespacesPath
:
'
/api/:version/namespaces.json
'
,
groupProjectsPath
:
'
/api/:version/groups/:id/projects.json
'
,
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
'
,
gitignorePath
:
'
/api/:version/templates/gitignores/:key
'
,
gitlabCiYmlPath
:
'
/api/:version/templates/gitlab_ci_ymls/:key
'
,
...
...
@@ -67,9 +68,16 @@ const Api = {
},
newLabel
(
namespacePath
,
projectPath
,
data
,
callback
)
{
const
url
=
Api
.
buildUrl
(
Api
.
labelsPath
)
var
url
=
""
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
({
url
,
type
:
'
POST
'
,
...
...
app/assets/javascripts/boards/components/new_list_dropdown.js
View file @
631d9284
...
...
@@ -26,7 +26,7 @@ gl.issueBoards.newListDropdownInit = () => {
$this
.
glDropdown
({
data
(
term
,
callback
)
{
$
.
get
(
$this
.
attr
(
'
data-l
abels
'
))
$
.
get
(
$this
.
attr
(
'
data-l
ist-labels-path
'
))
.
then
((
resp
)
=>
{
callback
(
resp
);
});
...
...
app/controllers/boards/issues_controller.rb
View file @
631d9284
...
...
@@ -18,7 +18,7 @@ module Boards
end
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
if
issue
.
valid?
...
...
@@ -62,6 +62,11 @@ module Boards
end
end
def
project
@project
||=
board
.
is_group_board?
?
Project
.
find
(
params
[
:project_id
])
:
board
.
parent
end
def
move_params
params
.
permit
(
:board_id
,
:id
,
:from_list_id
,
:to_list_id
,
:move_before_iid
,
:move_after_iid
)
end
...
...
app/controllers/concerns/boards_responses.rb
View file @
631d9284
...
...
@@ -18,7 +18,7 @@ module BoardsResponses
end
def
authorize_create_issue
authorize_action_for!
(
board
.
paren
t
,
:admin_issue
)
authorize_action_for!
(
projec
t
,
:admin_issue
)
end
def
authorize_admin_list
...
...
app/controllers/groups/boards_controller.rb
View file @
631d9284
...
...
@@ -20,5 +20,7 @@ class Groups::BoardsController < Groups::ApplicationController
def
assign_endpoint_vars
@boards_endpoint
=
group_boards_path
(
group
)
@issues_path
=
issues_group_path
(
group
)
@namespace_path
=
group
.
path
@labels_endpoint
=
group_labels_path
(
group
)
end
end
app/controllers/groups/labels_controller.rb
View file @
631d9284
...
...
@@ -34,6 +34,8 @@ class Groups::LabelsController < Groups::ApplicationController
def
create
@label
=
Labels
::
CreateService
.
new
(
label_params
).
execute
(
group:
group
)
respond_to
do
|
format
|
format
.
html
do
if
@label
.
valid?
redirect_to
group_labels_path
(
@group
)
else
...
...
@@ -41,6 +43,12 @@ class Groups::LabelsController < Groups::ApplicationController
end
end
format
.
json
do
render
json:
LabelSerializer
.
new
.
represent_appearance
(
@label
)
end
end
end
def
edit
@previous_labels_path
=
previous_labels_path
end
...
...
app/controllers/projects/boards_controller.rb
View file @
631d9284
...
...
@@ -23,7 +23,9 @@ class Projects::BoardsController < Projects::ApplicationController
def
assign_endpoint_vars
@boards_endpoint
=
project_boards_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
def
authorize_read_board!
...
...
app/helpers/boards_helper.rb
View file @
631d9284
...
...
@@ -55,14 +55,13 @@ module BoardsHelper
end
def
board_list_data
namespace_path
=
current_board_parent
.
try
(
:path
)
||
current_board_parent
.
namespace
.
try
(
:path
)
{
toggle:
"dropdown"
,
labels:
labels_filter_path
(
true
),
namespace_path:
namespace_path
,
project_path:
@project
&
.
try
(
:path
),
# Change this one on JS to use a single property: parent_path
group_path:
@group
&
.
try
(
:path
)
# Same here
list_labels_path:
labels_filter_path
(
true
),
labels_endpoint:
@labels_endpoint
,
namespace_path:
@namespace_path
,
project_path:
@project
&
.
try
(
:path
),
group_path:
@group
&
.
try
(
:path
)
}
end
...
...
app/helpers/issuables_helper.rb
View file @
631d9284
...
...
@@ -362,4 +362,12 @@ module IssuablesHelper
params
[
:format
]
=
:json
if
issuable
.
is_a?
(
Issue
)
end
end
def
labels_path
if
@project
project_labels_path
(
@project
)
elsif
@group
group_labels_path
(
@group
)
end
end
end
app/helpers/labels_helper.rb
View file @
631d9284
...
...
@@ -122,12 +122,12 @@ module LabelsHelper
end
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
if
project
project_labels_path
(
project
,
:json
)
elsif
@group
group_labels_path
(
@group
,
:json
,
only_group_labels:
only_group_labels
)
else
dashboard_labels_path
(
:json
)
end
...
...
app/policies/ee/group_policy.rb
View file @
631d9284
...
...
@@ -11,8 +11,8 @@ module EE
enable
:admin_board
end
rule
{
public_group
}
.
enable
:read_board
rule
{
guest
}
.
enable
:read_board
rule
{
public_group
}.
enable
:read_board
rule
{
guest
}.
enable
:read_board
rule
{
ldap_synced
}.
prevent
:admin_group_member
...
...
app/services/boards/issues/create_service.rb
View file @
631d9284
...
...
@@ -8,7 +8,7 @@ module Boards
private
def
board
@board
||=
p
rojec
t
.
boards
.
find
(
params
.
delete
(
:board_id
))
@board
||=
p
aren
t
.
boards
.
find
(
params
.
delete
(
:board_id
))
end
def
list
...
...
@@ -16,7 +16,7 @@ module Boards
end
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
...
...
app/views/shared/issuable/_label_page_default.html.haml
View file @
631d9284
...
...
@@ -20,7 +20,7 @@
%a
.dropdown-toggle-page
{
href:
"#"
}
Create new label
%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
)
Manage labels
-
else
...
...
app/views/shared/issuable/_search_bar.html.haml
View file @
631d9284
...
...
@@ -122,7 +122,7 @@
Add list
.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"
}
-
if
can?
(
current_user
,
:admin_label
,
board
.
parent
)
-
if
can?
(
current_user
,
:admin_label
,
board
.
parent
)
=
render
partial:
"shared/issuable/label_page_create"
=
dropdown_loading
-
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