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';
import './models/label';
import './models/list';
import './models/milestone';
import './models/project';
import './models/assignee';
import './stores/boards_store';
import './stores/modal_store';
......
......@@ -16,6 +16,7 @@ export default {
:list="list"
:issue="issue"
:issue-link-base="issueLinkBase"
:group-id="groupId"
:root-path="rootPath"
:update-filters="true" />
</li>
......@@ -30,6 +31,7 @@ export default {
disabled: Boolean,
index: Number,
rootPath: String,
groupId: Number,
},
data() {
return {
......
......@@ -188,6 +188,7 @@ export default {
:list="list"
:issue="issue"
:issue-link-base="issueLinkBase"
:group-id="groupId"
:root-path="rootPath"
:disabled="disabled"
:key="issue.id" />
......
......@@ -58,7 +58,11 @@ gl.issueBoards.BoardSidebar = Vue.extend({
this.list = this.detail.list;
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
......
......@@ -31,6 +31,10 @@ gl.issueBoards.IssueCardInner = Vue.extend({
required: false,
default: false,
},
groupId: {
type: Number,
required: false,
},
},
data() {
return {
......@@ -64,7 +68,13 @@ gl.issueBoards.IssueCardInner = Vue.extend({
return this.issue.assignees.length > this.numberOverLimit;
},
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() {
return `#${this.issue.id}`;
......
/* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */
/* global ListLabel */
/* global ListMilestone */
/* global IssueProject */
/* global ListAssignee */
import Vue from 'vue';
......@@ -19,7 +20,10 @@ class ListIssue {
this.position = obj.relative_position || Infinity;
this.milestone_id = obj.milestone_id;
this.updateUrl = obj.update_url;
this.project_id = obj.project_id;
if (obj.project) {
this.project = new IssueProject(obj.project);
}
if (obj.milestone) {
this.milestone = new ListMilestone(obj.milestone);
......@@ -32,6 +36,10 @@ class ListIssue {
this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar));
}
updateUrl() {
"vsf"
}
addLabel (label) {
if (!this.findLabel(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
end
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
if issue.valid?
......@@ -64,7 +64,7 @@ module Boards
def 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
def move_params
......@@ -72,14 +72,17 @@ module Boards
end
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
def serialize_as_json(resource)
resource.as_json(
resource.preload(:project).as_json(
labels: true,
only: [:id, :iid, :title, :confidential, :due_date, :relative_position],
include: {
project: { only: [:id, :path] },
assignees: { only: [:id, :name, :username], methods: [:avatar_url] },
milestone: { only: [:id, :title] }
},
......
......@@ -19,7 +19,6 @@ 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
......
......@@ -22,7 +22,6 @@ 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)
@namespace_path = project.namespace.path
@labels_endpoint = project_labels_path(project)
......
module BoardsHelper
prepend EE::BoardsHelper
def board_data
board = @board || @boards.first
def board
@board ||= @board || @boards.first
end
def board_data
{
boards_endpoint: @boards_endpoint,
lists_endpoint: board_lists_path(board),
board_id: board.id,
board_milestone_title: board&.milestone&.title,
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,
bulk_update_path: @bulk_issues_path,
default_avatar: image_path(default_avatar)
}
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
board = @board || @boards.first
......@@ -55,11 +63,7 @@ module BoardsHelper
end
def can_admin_issue
if @project
can?(current_user, :admin_issue, @project)
elsif @group
can?(current_user, :admin_board, @group)
end
can?(current_user, :admin_issue, current_board_parent)
end
def board_list_data
......
......@@ -9,6 +9,9 @@ module EE
rule { reporter }.policy do
enable :admin_list
enable :admin_board
# Only used for group issue boards
enable :admin_issue
end
rule { public_group }.enable :read_board
......
module Boards
module Issues
class CreateService < BaseService
attr_accessor :project
def initialize(parent, project, user, params = {})
@project = project
super(parent, user, params)
end
def execute
create_issue(params.merge(label_ids: [list.label_id]))
end
......@@ -16,7 +24,7 @@ module Boards
end
def create_issue(params)
::Issues::CreateService.new(parent, current_user, params).execute
::Issues::CreateService.new(project, current_user, params).execute
end
end
end
......
......@@ -22,7 +22,7 @@
- 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,
":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]
= icon("chevron-down")
.dropdown-menu.dropdown-select.dropdown-menu-user.dropdown-menu-selectable.dropdown-menu-author
......
......@@ -23,7 +23,7 @@
.dropdown
%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-issue-update" => "'#{@issues_path}/' + issue.id + '.json'" }
":data-issue-update" => "'#{build_issue_link_base}/' + issue.id + '.json'" }
%span.dropdown-toggle-text Due date
= icon('chevron-down')
.dropdown-menu.dropdown-menu-due-date
......
......@@ -27,7 +27,7 @@
labels: labels_filter_path(true),
namespace_path: @project.try(:namespace).try(:full_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
Label
= icon('chevron-down')
......
......@@ -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" },
":data-selected" => "milestoneTitle",
":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
= icon("chevron-down")
.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