add "copy shareable link" button to "profile" page

pull/1/head
yflory 5 years ago
parent 7816c17cb5
commit c7ca50c934

@ -122,9 +122,13 @@
#cp-app-profile-invite-button { #cp-app-profile-invite-button {
float: right; float: right;
} }
#cp-app-profile-viewprofile-button { .cp-app-profile-viewprofile-button {
margin-bottom: 20px; margin-bottom: 20px;
float: right; float: right;
margin-left: 5px;
&> span {
margin-left: 10px;
}
} }
#cp-app-profile-description { #cp-app-profile-description {
position: relative; position: relative;

@ -9,6 +9,7 @@ define([
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-ui-elements.js', '/common/common-ui-elements.js',
'/common/common-realtime.js', '/common/common-realtime.js',
'/common/clipboard.js',
'/common/hyperscript.js', '/common/hyperscript.js',
'/customize/messages.js', '/customize/messages.js',
'/customize/application_config.js', '/customize/application_config.js',
@ -36,6 +37,7 @@ define([
UI, UI,
UIElements, UIElements,
Realtime, Realtime,
Clipboard,
h, h,
Messages, Messages,
AppConfig, AppConfig,
@ -96,15 +98,20 @@ define([
var hash = common.getMetadataMgr().getPrivateData().hashes.viewHash; var hash = common.getMetadataMgr().getPrivateData().hashes.viewHash;
var url = APP.origin + '/profile/#' + hash; var url = APP.origin + '/profile/#' + hash;
var $button = $('<button>', { $('<button>', {
'class': 'btn btn-success', 'class': 'btn btn-success '+VIEW_PROFILE_BUTTON,
id: VIEW_PROFILE_BUTTON, }).text(Messages.profile_viewMyProfile).click(function () {
})
.text(Messages.profile_viewMyProfile)
.click(function () {
window.open(url, '_blank'); window.open(url, '_blank');
}); }).appendTo($container);
$container.append($button);
$('<button>', {
'class': 'btn btn-success '+VIEW_PROFILE_BUTTON,
}).append(h('i.fa.fa-shhare-alt'))
.append(h('span', Messages.shareButton))
.click(function () {
var success = Clipboard.copy(url);
if (success) { UI.log(Messages.shareSuccess); }
}).appendTo($container);
}; };
var addDisplayName = function ($container) { var addDisplayName = function ($container) {

Loading…
Cancel
Save