Commit b15e84e7 authored by Clement Ho's avatar Clement Ho

Merge branch 'multiple_assignees_review' into add-multiple-assignees-to-create-issue-page

parents 1402b79b 8bf5936d
......@@ -24,7 +24,7 @@ export default class TemplateSelector {
search: {
fields: ['name'],
},
clicked: (item, el, e) => this.fetchFileTemplate(item, el, e),
clicked: options => this.fetchFileTemplate(options),
text: item => item.name,
});
}
......@@ -51,7 +51,10 @@ export default class TemplateSelector {
return this.$dropdownContainer.removeClass('hidden');
}
fetchFileTemplate(item, el, e) {
fetchFileTemplate(options) {
const { e } = options;
const item = options.selectedObj;
e.preventDefault();
return this.requestFile(item);
}
......
......@@ -52,7 +52,9 @@
filterable: true,
selectable: true,
multiSelect: true,
clicked (label, $el, e) {
clicked (options) {
const { e } = options;
const label = options.selectedObj;
e.preventDefault();
if (!Store.findList('title', label.title)) {
......
......@@ -43,7 +43,9 @@
return $el.text();
},
clicked: (selected, $link) => {
clicked: (options) => {
const $link = options.$el;
if (!$link.data('revert')) {
this.formSubmit(null, $link);
} else {
......
......@@ -58,7 +58,8 @@
});
}
NamespaceSelect.prototype.onSelectItem = function(item, el, e) {
NamespaceSelect.prototype.onSelectItem = function(options) {
const { e } = options;
return e.preventDefault();
};
......
......@@ -119,7 +119,8 @@ import Cookies from 'js-cookie';
toggleLabel: function(obj, $el) {
return $el.text().trim();
},
clicked: function(selected, $el, e) {
clicked: function(options) {
const { e } = options;
e.preventDefault();
if ($('input[name="ref"]').length) {
var $form = $dropdown.closest('form');
......
......@@ -53,7 +53,10 @@
onHide();
}
},
clicked(item, $el, e) {
clicked(opts) {
const { $el, e } = opts;
const item = opts.selectedObj;
e.preventDefault();
if ($el.is('.is-active')) {
......
......@@ -35,7 +35,8 @@ class ProtectedBranchDropdown {
return _.escape(protectedBranch.id);
},
onFilter: this.toggleCreateNewButton.bind(this),
clicked: (item, $el, e) => {
clicked: (options) => {
const { $el, e } = options;
e.preventDefault();
this.onSelect();
}
......
......@@ -16,6 +16,10 @@ export default {
type: Array,
required: true,
},
editable: {
type: Boolean,
required: true,
},
},
computed: {
firstUser() {
......@@ -142,14 +146,17 @@ export default {
<div class="value hide-collapsed">
<template v-if="hasNoUsers">
<span class="assign-yourself no-value">
No assignee -
<button
type="button"
class="btn-link"
@click="assignSelf"
>
assign yourself
</button>
No assignee
<template v-if="editable">
-
<button
type="button"
class="btn-link"
@click="assignSelf"
>
assign yourself
</button>
</template>
</span>
</template>
<template v-else-if="hasOneUser">
......
......@@ -76,6 +76,7 @@ export default {
class="value"
:root-path="store.rootPath"
:users="store.assignees"
:editable="store.editable"
@assign-self="assignSelf"
/>
</div>
......
......@@ -27,7 +27,7 @@ export default class SidebarStore {
this.timeEstimate = data.time_estimate;
this.totalTimeSpent = data.total_time_spent;
this.humanTimeEstimate = data.human_time_estimate;
this.humanTimeSpent = data.human_time_spent;
this.humanTotalTimeSpent = data.human_total_time_spent;
}
addAssignee(assignee) {
......
......@@ -86,7 +86,7 @@ class GlobalMilestone
end
def issues
@issues ||= Issue.of_milestones(milestoneish_ids).includes(:project, :assignee, :labels)
@issues ||= Issue.of_milestones(milestoneish_ids).includes(:project, :assignees, :labels)
end
def merge_requests
......
......@@ -5,6 +5,7 @@
":editable" => can?(current_user, :admin_issue, @project) }
%assignees.value{ "root-path" => "#{root_url}",
":users" => "issue.assignees",
":editable" => can?(current_user, :admin_issue, @project),
"@assign-self" => "assignSelf" }
- if can?(current_user, :admin_issue, @project)
......
......@@ -77,7 +77,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
step 'project "Shop" has issue "Bugfix1" with label "feature"' do
project = Project.find_by(name: "Shop")
issue = create(:issue, title: "Bugfix1", project: project, assignee: current_user)
issue = create(:issue, title: "Bugfix1", project: project, assignees: [current_user])
issue.labels << project.labels.find_by(title: 'feature')
end
end
......@@ -110,7 +110,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps
create :issue,
project: project,
assignee: current_user,
assignees: [current_user],
author: current_user,
milestone: milestone
......@@ -122,7 +122,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps
issue = create :issue,
project: project,
assignee: current_user,
assignees: [current_user],
author: current_user,
milestone: milestone
......
......@@ -61,7 +61,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'project from group "Owned" has issues assigned to me' do
create :issue,
project: project,
assignee: current_user,
assignees: [current_user],
author: current_user
end
......@@ -168,7 +168,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'the archived project have some issues' do
create :issue,
project: @archived_project,
assignee: current_user,
assignees: [current_user],
author: current_user
end
......
......@@ -166,7 +166,7 @@ describe Projects::IssuesController do
body = JSON.parse(response.body)
expect(body['assignees'].first.keys)
.to match_array(%w(name username avatar_url))
.to match_array(%w(id name username avatar_url))
end
end
......
......@@ -437,9 +437,13 @@ describe 'Issues', feature: true do
click_link 'Edit'
click_link 'Unassigned'
first('.title').click
expect(page).to have_content 'No assignee'
end
# wait_for_ajax does not work with vue-resource at the moment
sleep 1
expect(issue.reload.assignees).to be_empty
end
......
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