Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_profile: Add copy button for text external account fields.

Niloth Pd0daa308de1d
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index ede68145f87..bd03055a9b5 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -1580,5 +1580,12 @@ export function initialize(): void {
});
});
+ new ClipboardJS(".copy-external-account-field").on("success", (e) => {
+ assert(e.trigger instanceof HTMLElement);
+ show_copied_confirmation(e.trigger, {
+ show_check_icon: true,
+ });
+ });
+
bot_helper.initialize_clipboard_handlers();
}
diff --git a/web/styles/popovers.css b/web/styles/popovers.css
index c75194b4d50..39483860b64 100644
--- a/web/styles/popovers.css
+++ b/web/styles/popovers.css
@@ -203,7 +203,8 @@
}
}
-.custom-user-url-field {
+.custom-user-url-field,
+.external-account-text-field {
display: flex;
align-items: center;
/* Maintain space between URL and copy icon. */
@@ -216,7 +217,8 @@
text-overflow: ellipsis;
}
- .copy-custom-field-url {
+ .copy-custom-field-url,
+ .copy-external-account-field {
height: 1em;
}
}
diff --git a/web/templates/user_custom_profile_fields.hbs b/web/templates/user_custom_profile_fields.hbs
index 49be78fdc31..aa15ec32ae6 100644
--- a/web/templates/user_custom_profile_fields.hbs
+++ b/web/templates/user_custom_profile_fields.hbs
@@ -17,8 +17,13 @@
{{this.value}}
</a>
{{else}}
- {{> default_external_account_icon subtype=this.subtype}}
- {{this.value}}
+ <div class="external-account-text-field">
+ {{> default_external_account_icon subtype=this.subtype}}
+ {{this.value}}
+ <span tabindex="0" class="copy-button copy-external-account-field tippy-zulip-tooltip" aria-label="{{t 'Copy value' }}" data-tippy-content="{{t 'Copy value' }}" data-clipboard-text="{{this.value}}">
+ <i class="zulip-icon zulip-icon-copy" aria-hidden="true"></i>
+ </span>
+ </div>
{{/if}}
{{else if this.is_user_field}}
<div class="user-type-custom-field-pill-container" data-field-id="{{this.id}}"></div>