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
951fbe6d
Commit
951fbe6d
authored
Jul 27, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix board form for project and make it re-usable for groups
parent
5dedc534
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
49 additions
and
33 deletions
+49
-33
app/controllers/concerns/boards_authorizations.rb
app/controllers/concerns/boards_authorizations.rb
+1
-3
app/controllers/ee/boards/boards_controller.rb
app/controllers/ee/boards/boards_controller.rb
+1
-1
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+2
-0
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+1
-1
app/helpers/boards_helper.rb
app/helpers/boards_helper.rb
+15
-5
app/models/namespace.rb
app/models/namespace.rb
+4
-0
app/models/project.rb
app/models/project.rb
+4
-0
app/policies/ee/group_policy.rb
app/policies/ee/group_policy.rb
+8
-0
app/services/boards/destroy_service.rb
app/services/boards/destroy_service.rb
+1
-1
app/services/boards/update_service.rb
app/services/boards/update_service.rb
+1
-1
app/views/shared/boards/_switcher.html.haml
app/views/shared/boards/_switcher.html.haml
+9
-7
app/views/shared/boards/components/_form.html.haml
app/views/shared/boards/components/_form.html.haml
+1
-1
config/routes/group.rb
config/routes/group.rb
+1
-13
No files found.
app/controllers/concerns/boards_authorizations.rb
View file @
951fbe6d
...
...
@@ -22,9 +22,7 @@ module BoardsAuthorizations
end
def
authorize_admin_list!
ability
=
board
.
is_group_board?
?
:admin_milestones
:
:admin_list
return
render_403
unless
action_allowed_for?
(
board
.
parent
,
ability
)
return
render_403
unless
action_allowed_for?
(
board
.
parent
,
:admin_list
)
end
...
...
app/controllers/ee/
project
s/boards_controller.rb
→
app/controllers/ee/
board
s/boards_controller.rb
View file @
951fbe6d
module
EE
module
Project
s
module
Board
s
module
BoardsController
extend
ActiveSupport
::
Concern
prepended
do
...
...
app/controllers/groups/boards_controller.rb
View file @
951fbe6d
class
Groups::BoardsController
<
Groups
::
ApplicationController
prepend
EE
::
Boards
::
BoardsController
before_action
:check_group_issue_boards_available!
before_action
:assign_endpoint_vars
...
...
app/controllers/projects/boards_controller.rb
View file @
951fbe6d
class
Projects::BoardsController
<
Projects
::
ApplicationController
prepend
EE
::
Project
s
::
BoardsController
prepend
EE
::
Board
s
::
BoardsController
include
IssuableCollections
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
...
...
app/helpers/boards_helper.rb
View file @
951fbe6d
...
...
@@ -36,11 +36,21 @@ module BoardsHelper
end
end
def
multiple_boards_available
if
@project
@project
.
feature_available?
(
:multiple_issue_boards
)
elsif
@group
@group
.
feature_available?
(
:multiple_issue_boards
)
def
multiple_boards_available?
current_board_parent
.
multiple_issue_boards_available?
(
current_user
)
end
def
board_path
(
board
)
@board_path
||=
begin
if
board
.
is_group_board?
group_board_path
(
current_board_parent
,
board
)
else
project_board_path
(
current_board_parent
,
board
)
end
end
end
def
current_board_parent
@current_board_parent
||=
@project
||
@group
end
end
app/models/namespace.rb
View file @
951fbe6d
...
...
@@ -235,6 +235,10 @@ class Namespace < ActiveRecord::Base
feature_available?
(
:multiple_issue_boards
)
end
def
issue_board_milestone_available?
(
user
=
nil
)
feature_available?
(
:issue_board_milestone
)
end
private
def
repository_storage_paths
...
...
app/models/project.rb
View file @
951fbe6d
...
...
@@ -1438,6 +1438,10 @@ class Project < ActiveRecord::Base
feature_available?
(
:multiple_issue_boards
,
user
)
end
def
issue_board_milestone_available?
(
user
=
nil
)
feature_available?
(
:issue_board_milestone
,
user
)
end
alias_method
:name_with_namespace
,
:full_name
alias_method
:human_name
,
:full_name
alias_method
:path_with_namespace
,
:full_path
...
...
app/policies/ee/group_policy.rb
View file @
951fbe6d
...
...
@@ -6,6 +6,14 @@ module EE
with_scope
:subject
condition
(
:ldap_synced
)
{
@subject
.
ldap_synced?
}
rule
{
reporter
}.
policy
do
enable
:admin_list
enable
:admin_board
end
rule
{
public_group
}
.
enable
:read_board
rule
{
guest
}
.
enable
:read_board
rule
{
ldap_synced
}.
prevent
:admin_group_member
rule
{
ldap_synced
&
admin
}.
policy
do
...
...
app/services/boards/destroy_service.rb
View file @
951fbe6d
module
Boards
class
DestroyService
<
BaseService
def
execute
(
board
)
return
false
if
p
rojec
t
.
boards
.
size
==
1
return
false
if
p
aren
t
.
boards
.
size
==
1
board
.
destroy
end
...
...
app/services/boards/update_service.rb
View file @
951fbe6d
module
Boards
class
UpdateService
<
BaseService
def
execute
(
board
)
params
.
delete
(
:milestone_id
)
unless
p
rojec
t
.
feature_available?
(
:issue_board_milestone
)
params
.
delete
(
:milestone_id
)
unless
p
aren
t
.
feature_available?
(
:issue_board_milestone
)
board
.
update
(
params
)
end
...
...
app/views/shared/boards/_switcher.html.haml
View file @
951fbe6d
-
parent
=
board
.
parent
%boards-selector
{
"inline-template"
=>
true
,
":current-board"
=>
current_board_json
,
"milestone-path"
=>
milestones_filter_path
(
:json
)
}
...
...
@@ -22,38 +24,38 @@
%li
{
"v-for"
=>
"board in boards"
}
%a
{
":href"
=>
"'#{board_base_url}/' + board.id"
}
{{ board.name }}
-
if
!
multiple_boards_available
&&
@boards
.
size
>
1
-
if
!
multiple_boards_available
?
&&
@boards
.
size
>
1
%li
.small
Some of your boards are hidden, activate a license to see them again.
.dropdown-loading
{
"v-if"
=>
"loading"
}
=
icon
(
"spin spinner"
)
-
if
can?
(
current_user
,
:admin_board
,
@group
)
-
if
can?
(
current_user
,
:admin_board
,
parent
)
%board-selector-form
{
"inline-template"
=>
true
,
":milestone-path"
=>
"milestonePath"
,
"v-if"
=>
"currentPage === 'new' || currentPage === 'edit' || currentPage === 'milestone'"
}
=
render
"
group
/boards/components/form"
=
render
"
shared
/boards/components/form"
.dropdown-content.board-selector-page-two
{
"v-if"
=>
"currentPage === 'delete'"
}
%p
Are you sure you want to delete this board?
.board-delete-btns.clearfix
=
link_to
group_board_path
(
@group
,
board
),
=
link_to
board_path
(
board
),
class:
"btn btn-danger pull-left"
,
method: :delete
do
Delete
%button
.btn.btn-default.pull-right
{
type:
"button"
,
"@click.stop.prevent"
=>
"showPage('')"
}
Cancel
-
if
can?
(
current_user
,
:admin_board
,
@group
)
-
if
can?
(
current_user
,
:admin_board
,
parent
)
.dropdown-footer
{
"v-if"
=>
"currentPage === ''"
}
%ul
.dropdown-footer-list
-
if
@group
.
feature_available?
(
:multiple_issue_boards
)
-
if
parent
.
feature_available?
(
:multiple_issue_boards
)
%li
%a
{
"href"
=>
"#"
,
"@click.stop.prevent"
=>
"showPage('new')"
}
Create new board
%li
%a
{
"href"
=>
"#"
,
"@click.stop.prevent"
=>
"showPage('edit')"
}
Edit board name
-
if
@group
.
feature_available?
(
:issue_board_milestone
,
current_user
)
-
if
parent
.
issue_board_milestone_available?
(
current_user
)
%li
%a
{
"href"
=>
"#"
,
"@click.stop.prevent"
=>
"showPage('milestone')"
}
Edit board milestone
...
...
app/views/shared/boards/components/_form.html.haml
View file @
951fbe6d
...
...
@@ -10,7 +10,7 @@
%input
.form-control
{
type:
"text"
,
id:
"board-new-name"
,
"v-model"
=>
"board.name"
}
-
if
@project
.
feature_available?
(
:issue_board_milestone
,
current_user
)
-
if
current_board_parent
.
issue_board_milestone_available?
(
current_user
)
.dropdown.board-inner-milestone-dropdown
{
":class"
=>
"{ open: milestoneDropdownOpen }"
,
"v-if"
=>
"currentPage === 'new'"
}
%label
.label-light
{
for:
"board-milestone"
}
...
...
config/routes/group.rb
View file @
951fbe6d
...
...
@@ -63,19 +63,7 @@ scope(path: 'groups/*group_id',
end
## EE-specific
resources
:boards
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
]
do
scope
module: :boards
do
resources
:issues
,
only:
[
:index
,
:update
]
resources
:lists
,
only:
[
:index
,
:create
,
:update
,
:destroy
]
do
collection
do
post
:generate
end
resources
:issues
,
only:
[
:index
,
:create
]
end
end
end
resources
:boards
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
]
end
scope
(
path:
'groups/*id'
,
...
...
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