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

[skip ci] add rootPath

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