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