summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-01-04 16:34:01 +0100
committerTim Zallmann <tzallmann@gitlab.com>2019-01-04 16:34:01 +0100
commit1484a7eb7d4f943cd770ad2988b5e73fdc665860 (patch)
tree4c26559a1355ceeb8a8e3da3e411c43a10ea93e2
parent4543ef099d29b383462bcc1c71973c43385cd8dc (diff)
downloadgitlab-ce-1484a7eb7d4f943cd770ad2988b5e73fdc665860.tar.gz
Added User Popovers to Commit Items and Member Lists
-rw-r--r--app/assets/javascripts/diffs/components/commit_item.vue20
-rw-r--r--app/helpers/commits_helper.rb2
-rw-r--r--app/views/admin/users/_user.html.haml2
-rw-r--r--app/views/shared/members/_member.html.haml2
4 files changed, 22 insertions, 4 deletions
diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue
index ebc4a83af4d..3e362ecf0b2 100644
--- a/app/assets/javascripts/diffs/components/commit_item.vue
+++ b/app/assets/javascripts/diffs/components/commit_item.vue
@@ -5,6 +5,7 @@ import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import CIIcon from '~/vue_shared/components/ci_icon.vue';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
+import initUserPopovers from '../../user_popovers';
/**
* CommitItem
@@ -38,6 +39,12 @@ export default {
authorName() {
return (this.commit.author && this.commit.author.name) || this.commit.author_name;
},
+ authorClass() {
+ return this.commit.author && this.commit.author.name ? 'js-user-link' : '';
+ },
+ authorId() {
+ return this.commit.author && this.commit.author.name ? this.commit.author.id : '';
+ },
authorUrl() {
return (
(this.commit.author && this.commit.author.web_url) || `mailto:${this.commit.author_email}`
@@ -49,6 +56,11 @@ export default {
);
},
},
+ created() {
+ this.$nextTick(() => {
+ initUserPopovers(this.$el.querySelectorAll('.js-user-link'));
+ });
+ },
};
</script>
@@ -81,7 +93,13 @@ export default {
</button>
<div class="commiter">
- <a :href="authorUrl" v-text="authorName"></a> {{ s__('CommitWidget|authored') }}
+ <a
+ :href="authorUrl"
+ :class="authorClass"
+ :data-user-id="authorId"
+ v-text="authorName"
+ ></a>
+ {{ s__('CommitWidget|authored') }}
<time-ago-tooltip :time="commit.authored_date" />
</div>
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index d52cfd6e37a..7abd355287f 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -154,7 +154,7 @@ module CommitsHelper
if user.nil?
mail_to(source_email, text, link_options)
else
- link_to(text, user_path(user), link_options)
+ link_to(text, user_path(user), {class: "commit-#{options[:source]}-link js-user-link",data: {user_id: user.id}})
end
end
diff --git a/app/views/admin/users/_user.html.haml b/app/views/admin/users/_user.html.haml
index b2163ee85fa..a4e2c3252af 100644
--- a/app/views/admin/users/_user.html.haml
+++ b/app/views/admin/users/_user.html.haml
@@ -3,7 +3,7 @@
= image_tag avatar_icon_for_user(user), class: "avatar", alt: ''
.row-main-content
.user-name.row-title.str-truncated-100
- = link_to user.name, [:admin, user]
+ = link_to user.name, [:admin, user], class: "js-user-link", data: { user_id: user.id }
- if user.blocked?
%span.badge.badge-danger blocked
- if user.admin?
diff --git a/app/views/shared/members/_member.html.haml b/app/views/shared/members/_member.html.haml
index 6b3841ebbc4..2db1f67a793 100644
--- a/app/views/shared/members/_member.html.haml
+++ b/app/views/shared/members/_member.html.haml
@@ -10,7 +10,7 @@
- if user
= image_tag avatar_icon_for_user(user, 40), class: "avatar s40", alt: ''
.user-info
- = link_to user.name, user_path(user), class: 'member'
+ = link_to user.name, user_path(user), class: 'member js-user-link', data: { user_id: user.id }
= user_status(user)
%span.cgray= user.to_reference