Commit 34d050f6 authored by Felipe Artur's avatar Felipe Artur

Code improvements

parent d700c6f0
......@@ -7,7 +7,6 @@ class Board < ActiveRecord::Base
validates :name, presence: true
# if block needed only for EE which has group boards feature
validates :project, presence: true, if: -> { respond_to?(:group_id) && !group }
def backlog_list
......
......@@ -11,7 +11,7 @@ module RelativePositioning
end
def project_ids
project.id
[project.id]
end
def max_relative_position
......
- parent = board.parent
- milestone_filter_opts = { format: :json }
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.is_group_board?
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.group_board?
%boards-selector{ "inline-template" => true,
":current-board" => current_board_json,
......
- milestone_filter_opts = { format: :json }
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.is_group_board?
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.group_board?
.block.milestone
.title
......
# Group issue board
> Introduced in GitLab 9.5.
> Introduced in GitLab 10.0.
Group issue boards help users manage teams in organizations
that have a team-centered or product-centered approach which spans
......@@ -8,7 +8,7 @@ many projects.
![Group Issue Board](img/group_issue_board.png)
The design and functionality are the same of [project boards](../project/issue_board.md) with some small differences:
The design and functionality are the same as [project boards](../project/issue_board.md) with some small differences:
* In a group board all issues within group projects will be displayed
on backlog or closed lists. Users don't need to filter them by project on search bar.
......
......@@ -2,15 +2,13 @@ module EE
module Boards
module IssuesController
def issues_finder
if board.is_group_board?
return super unless board.group_board?
IssuesFinder.new(current_user, group_id: board_parent.id)
else
super
end
end
def project
@project ||= board.is_group_board? ? super : board.parent
@project ||= board.group_board? ? super : board.parent
end
end
end
......
......@@ -3,13 +3,13 @@ module EE
# Shared authorizations between projects and groups which
# have different policies on EE.
def authorize_read_list
ability = board.is_group_board? ? :read_group : :read_list
ability = board.group_board? ? :read_group : :read_list
authorize_action_for!(board.parent, ability)
end
def authorize_read_issue
ability = board.is_group_board? ? :read_group : :read_issue
ability = board.group_board? ? :read_group : :read_issue
authorize_action_for!(board.parent, ability)
end
......
......@@ -6,7 +6,7 @@ module EE
end
def build_issue_link_base
return super unless @board.is_group_board?
return super unless @board.group_board?
"/#{@board.group.path}/:project_path/issues"
end
......@@ -17,7 +17,7 @@ module EE
def board_path(board)
@board_path ||= begin
if board.is_group_board?
if board.group_board?
group_board_path(current_board_parent, board)
else
super(board)
......
......@@ -12,11 +12,9 @@ module EE
end
def project_ids
if has_group_boards?
board_group.projects.pluck(:id)
else
super
end
return super unless has_group_boards?
board_group.projects.select(:id)
end
end
end
......@@ -23,7 +23,7 @@ module EE
@parent ||= group || project
end
def is_group_board?
def group_board?
group_id.present?
end
......
......@@ -3,7 +3,7 @@ module EE
module Lists
module CreateService
def available_labels_for(board)
if board.is_group_board?
if board.group_board?
parent.labels
else
super
......
......@@ -5,7 +5,7 @@ module EE
label_ids =
if moving_to_list.movable?
moving_from_list.label_id
elsif board.is_group_board?
elsif board.group_board?
::Label.on_group_boards(parent.id).pluck(:label_id)
else
::Label.on_project_boards(parent.id).pluck(:label_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment