Commit 9ad83f65 authored by Clement Ho's avatar Clement Ho

[skip ci] add rootPath

parent b2714763
......@@ -11,6 +11,9 @@ export default {
assignees: { type: Object, required: true },
},
computed: {
rootPath() {
return this.assignees.rootPath;
},
shouldShowMoreAssignees() {
return this.assignees.users.length > 5;
},
......@@ -34,11 +37,11 @@ export default {
v-if="showMore || (index < 5 && !showMore)" >
<a class="user-link has-tooltip"
data-placement="bottom"
:href="'/' + user.username"
:href="rootPath + user.username"
:data-title="user.name" >
<img width="32"
class="avatar avatar-inline s32"
alt="PLACEHOLDER"
:alt="user.name + '\\'s avatar'"
:src="user.avatarUrl" >
</a>
</div>
......
......@@ -4,6 +4,9 @@ export default {
assignees: { type: Object, required: true },
},
computed: {
rootPath() {
return this.assignees.rootPath;
},
user() {
return this.assignees.users[0];
},
......@@ -13,7 +16,7 @@ export default {
},
template: `
<div class="hide-collapsed">
<a class="author_link bold" :href="'/' + user.username">
<a class="author_link bold" :href="rootPath + user.username">
<img width="32"
class="avatar avatar-inline s32"
:alt="avatarAlt"
......
......@@ -19,13 +19,14 @@ const sidebarAssigneesOptions = () => ({
data() {
const selector = this.$options.el;
const element = document.querySelector(selector);
const rootPath = element.dataset.rootPath;
const path = element.dataset.path;
const field = element.dataset.field;
const editable = element.hasAttribute('data-editable');
const currentUserId = parseInt(element.dataset.userId, 10);
const service = new SidebarAssigneesService(path, field);
const assignees = new SidebarAssigneesStore(currentUserId, service, editable);
const assignees = new SidebarAssigneesStore(currentUserId, service, rootPath, editable);
return {
assignees,
......
export default class SidebarAssigneesStore {
constructor(currentUserId, service, editable) {
constructor(currentUserId, service, rootPath, editable) {
this.currentUserId = currentUserId;
this.service = service;
this.rootPath = rootPath;
this.users = [];
this.saved = true;
this.loading = false;
......
......@@ -24,7 +24,7 @@
= form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f|
.block.assignee
- if issuable.instance_of?(Issue)
#js-vue-sidebar-assignees{ data: { path: issuable_json_path(issuable), field: "#{issuable.to_ability_name}[assignee_id]",'editable' => can_edit_issuable ? true : false, user: { id: current_user.id } } }
#js-vue-sidebar-assignees{ data: { path: issuable_json_path(issuable), field: "#{issuable.to_ability_name}[assignee_id]",'editable' => can_edit_issuable ? true : false, user: { id: current_user.id }, root: { path: root_path } } }
.title.hide-collapsed
Assignee
= icon('spinner spin', class: 'block-loading', 'aria-hidden': 'true')
......
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