Commit d44add57 authored by Simon Knox's avatar Simon Knox

Merge branch 'issue_928_group_boards' of gitlab.com:gitlab-org/gitlab-ee into...

Merge branch 'issue_928_group_boards' of gitlab.com:gitlab-org/gitlab-ee into issue_928_group_boards
parents 132a51ee ed38eb55
...@@ -10,6 +10,7 @@ import './models/issue'; ...@@ -10,6 +10,7 @@ import './models/issue';
import './models/label'; import './models/label';
import './models/list'; import './models/list';
import './models/milestone'; import './models/milestone';
import './models/project';
import './models/assignee'; import './models/assignee';
import './stores/boards_store'; import './stores/boards_store';
import './stores/modal_store'; import './stores/modal_store';
......
...@@ -16,6 +16,7 @@ export default { ...@@ -16,6 +16,7 @@ export default {
:list="list" :list="list"
:issue="issue" :issue="issue"
:issue-link-base="issueLinkBase" :issue-link-base="issueLinkBase"
:group-id="groupId"
:root-path="rootPath" :root-path="rootPath"
:update-filters="true" /> :update-filters="true" />
</li> </li>
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
disabled: Boolean, disabled: Boolean,
index: Number, index: Number,
rootPath: String, rootPath: String,
groupId: Number,
}, },
data() { data() {
return { return {
......
...@@ -188,6 +188,7 @@ export default { ...@@ -188,6 +188,7 @@ export default {
:list="list" :list="list"
:issue="issue" :issue="issue"
:issue-link-base="issueLinkBase" :issue-link-base="issueLinkBase"
:group-id="groupId"
:root-path="rootPath" :root-path="rootPath"
:disabled="disabled" :disabled="disabled"
:key="issue.id" /> :key="issue.id" />
......
...@@ -58,7 +58,11 @@ gl.issueBoards.BoardSidebar = Vue.extend({ ...@@ -58,7 +58,11 @@ gl.issueBoards.BoardSidebar = Vue.extend({
this.list = this.detail.list; this.list = this.detail.list;
this.$nextTick(() => { this.$nextTick(() => {
this.endpoint = this.$refs.assigneeDropdown.dataset.issueUpdate; var issueUrl = this.$refs.assigneeDropdown.dataset.issueUpdate
issueUrl = issueUrl.replace(":project_path", this.issue.project.path);
this.endpoint = issueUrl;
}); });
}, },
deep: true deep: true
......
...@@ -31,6 +31,10 @@ gl.issueBoards.IssueCardInner = Vue.extend({ ...@@ -31,6 +31,10 @@ gl.issueBoards.IssueCardInner = Vue.extend({
required: false, required: false,
default: false, default: false,
}, },
groupId: {
type: Number,
required: false,
},
}, },
data() { data() {
return { return {
...@@ -64,7 +68,13 @@ gl.issueBoards.IssueCardInner = Vue.extend({ ...@@ -64,7 +68,13 @@ gl.issueBoards.IssueCardInner = Vue.extend({
return this.issue.assignees.length > this.numberOverLimit; return this.issue.assignees.length > this.numberOverLimit;
}, },
cardUrl() { cardUrl() {
return `${this.issueLinkBase}/${this.issue.id}`; var baseUrl = this.issueLinkBase;
if(this.groupId) {
baseUrl = this.issueLinkBase.replace(":project_path", this.issue.project.path);
}
return `${baseUrl}/${this.issue.id}`;
}, },
issueId() { issueId() {
return `#${this.issue.id}`; return `#${this.issue.id}`;
......
/* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */ /* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */
/* global ListLabel */ /* global ListLabel */
/* global ListMilestone */ /* global ListMilestone */
/* global IssueProject */
/* global ListAssignee */ /* global ListAssignee */
import Vue from 'vue'; import Vue from 'vue';
...@@ -19,7 +20,10 @@ class ListIssue { ...@@ -19,7 +20,10 @@ class ListIssue {
this.position = obj.relative_position || Infinity; this.position = obj.relative_position || Infinity;
this.milestone_id = obj.milestone_id; this.milestone_id = obj.milestone_id;
this.updateUrl = obj.update_url; this.updateUrl = obj.update_url;
this.project_id = obj.project_id;
if (obj.project) {
this.project = new IssueProject(obj.project);
}
if (obj.milestone) { if (obj.milestone) {
this.milestone = new ListMilestone(obj.milestone); this.milestone = new ListMilestone(obj.milestone);
...@@ -32,6 +36,10 @@ class ListIssue { ...@@ -32,6 +36,10 @@ class ListIssue {
this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar));
} }
updateUrl() {
"vsf"
}
addLabel (label) { addLabel (label) {
if (!this.findLabel(label)) { if (!this.findLabel(label)) {
this.labels.push(new ListLabel(label)); this.labels.push(new ListLabel(label));
......
/* eslint-disable no-unused-vars */
class IssueProject {
constructor(obj) {
this.id = obj.id;
this.path = obj.path;
}
}
window.IssueProject = IssueProject;
...@@ -18,7 +18,7 @@ module Boards ...@@ -18,7 +18,7 @@ module Boards
end end
def create def create
service = Boards::Issues::CreateService.new(project, current_user, issue_params) service = Boards::Issues::CreateService.new(board_parent, project, current_user, issue_params)
issue = service.execute issue = service.execute
if issue.valid? if issue.valid?
...@@ -64,7 +64,7 @@ module Boards ...@@ -64,7 +64,7 @@ module Boards
def project def project
@project ||= @project ||=
board.is_group_board? ? Project.find(params[:project_id]) : board.parent board.is_group_board? ? Project.find(issue_params[:project_id]) : board.parent
end end
def move_params def move_params
...@@ -72,14 +72,17 @@ module Boards ...@@ -72,14 +72,17 @@ module Boards
end end
def issue_params def issue_params
params.require(:issue).permit(:title, :milestone_id).merge(board_id: params[:board_id], list_id: params[:list_id], request: request) params.require(:issue).
permit(:title, :milestone_id, :project_id).
merge(board_id: params[:board_id], list_id: params[:list_id], request: request)
end end
def serialize_as_json(resource) def serialize_as_json(resource)
resource.as_json( resource.preload(:project).as_json(
labels: true, labels: true,
only: [:id, :iid, :title, :confidential, :due_date, :relative_position], only: [:id, :iid, :title, :confidential, :due_date, :relative_position],
include: { include: {
project: { only: [:id, :path] },
assignees: { only: [:id, :name, :username], methods: [:avatar_url] }, assignees: { only: [:id, :name, :username], methods: [:avatar_url] },
milestone: { only: [:id, :title] } milestone: { only: [:id, :title] }
}, },
......
...@@ -19,7 +19,6 @@ class Groups::BoardsController < Groups::ApplicationController ...@@ -19,7 +19,6 @@ 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)
@namespace_path = group.path @namespace_path = group.path
@labels_endpoint = group_labels_path(group) @labels_endpoint = group_labels_path(group)
end end
......
...@@ -22,7 +22,6 @@ class Projects::BoardsController < Projects::ApplicationController ...@@ -22,7 +22,6 @@ 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)
@bulk_issues_path = bulk_update_project_issues_path(project) @bulk_issues_path = bulk_update_project_issues_path(project)
@namespace_path = project.namespace.path @namespace_path = project.namespace.path
@labels_endpoint = project_labels_path(project) @labels_endpoint = project_labels_path(project)
......
module BoardsHelper module BoardsHelper
prepend EE::BoardsHelper prepend EE::BoardsHelper
def board_data def board
board = @board || @boards.first @board ||= @board || @boards.first
end
def board_data
{ {
boards_endpoint: @boards_endpoint, boards_endpoint: @boards_endpoint,
lists_endpoint: board_lists_path(board), lists_endpoint: board_lists_path(board),
board_id: board.id, board_id: board.id,
board_milestone_title: board&.milestone&.title, board_milestone_title: board&.milestone&.title,
disabled: "#{!can?(current_user, :admin_list, current_board_parent)}", disabled: "#{!can?(current_user, :admin_list, current_board_parent)}",
issue_link_base: @issues_path, issue_link_base: build_issue_link_base,
root_path: root_path, root_path: root_path,
bulk_update_path: @bulk_issues_path, bulk_update_path: @bulk_issues_path,
default_avatar: image_path(default_avatar) default_avatar: image_path(default_avatar)
} }
end end
def build_issue_link_base
return project_issues_path(@project) unless @board.is_group_board?
"/#{@board.group.path}/:project_path/issues"
end
def current_board_json def current_board_json
board = @board || @boards.first board = @board || @boards.first
...@@ -55,11 +63,7 @@ module BoardsHelper ...@@ -55,11 +63,7 @@ module BoardsHelper
end end
def can_admin_issue def can_admin_issue
if @project can?(current_user, :admin_issue, current_board_parent)
can?(current_user, :admin_issue, @project)
elsif @group
can?(current_user, :admin_board, @group)
end
end end
def board_list_data def board_list_data
......
...@@ -9,6 +9,9 @@ module EE ...@@ -9,6 +9,9 @@ module EE
rule { reporter }.policy do rule { reporter }.policy do
enable :admin_list enable :admin_list
enable :admin_board enable :admin_board
# Only used for group issue boards
enable :admin_issue
end end
rule { public_group }.enable :read_board rule { public_group }.enable :read_board
......
module Boards module Boards
module Issues module Issues
class CreateService < BaseService class CreateService < BaseService
attr_accessor :project
def initialize(parent, project, user, params = {})
@project = project
super(parent, user, params)
end
def execute def execute
create_issue(params.merge(label_ids: [list.label_id])) create_issue(params.merge(label_ids: [list.label_id]))
end end
...@@ -16,7 +24,7 @@ module Boards ...@@ -16,7 +24,7 @@ module Boards
end end
def create_issue(params) def create_issue(params)
::Issues::CreateService.new(parent, current_user, params).execute ::Issues::CreateService.new(project, current_user, params).execute
end end
end end
end end
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- dropdown_options = issue_assignees_dropdown_options - dropdown_options = issue_assignees_dropdown_options
%button.dropdown-menu-toggle.js-user-search.js-author-search.js-multiselect.js-save-user-data.js-issue-board-sidebar{ type: 'button', ref: 'assigneeDropdown', data: board_sidebar_user_data, %button.dropdown-menu-toggle.js-user-search.js-author-search.js-multiselect.js-save-user-data.js-issue-board-sidebar{ type: 'button', ref: 'assigneeDropdown', data: board_sidebar_user_data,
":data-issuable-id" => "issue.id", ":data-issuable-id" => "issue.id",
":data-issue-update" => "'#{@issues_path}/' + issue.id + '.json'" } ":data-issue-update" => "'#{build_issue_link_base}/' + issue.id + '.json'" }
= dropdown_options[:title] = dropdown_options[:title]
= icon("chevron-down") = icon("chevron-down")
.dropdown-menu.dropdown-select.dropdown-menu-user.dropdown-menu-selectable.dropdown-menu-author .dropdown-menu.dropdown-select.dropdown-menu-user.dropdown-menu-selectable.dropdown-menu-author
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
.dropdown .dropdown
%button.dropdown-menu-toggle.js-due-date-select.js-issue-boards-due-date{ type: 'button', %button.dropdown-menu-toggle.js-due-date-select.js-issue-boards-due-date{ type: 'button',
data: { toggle: 'dropdown', field_name: "issue[due_date]", ability_name: "issue" }, data: { toggle: 'dropdown', field_name: "issue[due_date]", ability_name: "issue" },
":data-issue-update" => "'#{@issues_path}/' + issue.id + '.json'" } ":data-issue-update" => "'#{build_issue_link_base}/' + issue.id + '.json'" }
%span.dropdown-toggle-text Due date %span.dropdown-toggle-text Due date
= icon('chevron-down') = icon('chevron-down')
.dropdown-menu.dropdown-menu-due-date .dropdown-menu.dropdown-menu-due-date
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
labels: labels_filter_path(true), labels: labels_filter_path(true),
namespace_path: @project.try(:namespace).try(:full_path), namespace_path: @project.try(:namespace).try(:full_path),
project_path: @project.try(:path) }, project_path: @project.try(:path) },
":data-issue-update" => "'#{@issues_path}/' + issue.id + '.json'" } ":data-issue-update" => "'#{build_issue_link_base}/' + issue.id + '.json'" }
%span.dropdown-toggle-text %span.dropdown-toggle-text
Label Label
= icon('chevron-down') = icon('chevron-down')
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
%button.dropdown-menu-toggle.js-milestone-select.js-issue-board-sidebar{ type: "button", data: { toggle: "dropdown", show_no: "true", field_name: "issue[milestone_id]", milestones: milestones_filter_path(:json), ability_name: "issue", use_id: "true", default_no: "true" }, %button.dropdown-menu-toggle.js-milestone-select.js-issue-board-sidebar{ type: "button", data: { toggle: "dropdown", show_no: "true", field_name: "issue[milestone_id]", milestones: milestones_filter_path(:json), ability_name: "issue", use_id: "true", default_no: "true" },
":data-selected" => "milestoneTitle", ":data-selected" => "milestoneTitle",
":data-issuable-id" => "issue.id", ":data-issuable-id" => "issue.id",
":data-issue-update" => "'#{milestones_label_path}/' + issue.id + '.json'" } ":data-issue-update" => "'#{build_issue_link_base}/' + issue.id + '.json'" }
Milestone Milestone
= icon("chevron-down") = icon("chevron-down")
.dropdown-menu.dropdown-select.dropdown-menu-selectable .dropdown-menu.dropdown-select.dropdown-menu-selectable
......
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