Commit 37ce3fb7 authored by JC Brand's avatar JC Brand

Add a button to refresh a contact's vcard

parent 63ce5017
...@@ -7005,7 +7005,7 @@ body.reset { ...@@ -7005,7 +7005,7 @@ body.reset {
color: #fff; } color: #fff; }
#conversejs .btn .fa { #conversejs .btn .fa {
color: #fff; color: #fff;
padding-right: 0.5em; } margin-right: 0.5em; }
#conversejs .no-text-select { #conversejs .no-text-select {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
...@@ -7299,6 +7299,8 @@ body.reset { ...@@ -7299,6 +7299,8 @@ body.reset {
#conversejs .chat-head.chat-head-chatbox { #conversejs .chat-head.chat-head-chatbox {
background-color: #3AA569; } background-color: #3AA569; }
#conversejs .chat-head .avatar { #conversejs .chat-head .avatar {
height: 36px;
width: 36px;
margin-right: 0.5em; } margin-right: 0.5em; }
#conversejs .chat-head .chatbox-buttons { #conversejs .chat-head .chatbox-buttons {
flex-direction: row-reverse; flex-direction: row-reverse;
......
...@@ -7005,7 +7005,7 @@ body.reset { ...@@ -7005,7 +7005,7 @@ body.reset {
color: #fff; } color: #fff; }
#conversejs .btn .fa { #conversejs .btn .fa {
color: #fff; color: #fff;
padding-right: 0.5em; } margin-right: 0.5em; }
#conversejs .no-text-select { #conversejs .no-text-select {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
...@@ -7350,6 +7350,8 @@ body { ...@@ -7350,6 +7350,8 @@ body {
#conversejs .chat-head.chat-head-chatbox { #conversejs .chat-head.chat-head-chatbox {
background-color: #3AA569; } background-color: #3AA569; }
#conversejs .chat-head .avatar { #conversejs .chat-head .avatar {
height: 36px;
width: 36px;
margin-right: 0.5em; } margin-right: 0.5em; }
#conversejs .chat-head .chatbox-buttons { #conversejs .chat-head .chatbox-buttons {
flex-direction: row-reverse; flex-direction: row-reverse;
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
} }
.avatar { .avatar {
height: 36px;
width: 36px;
margin-right: 0.5em; margin-right: 0.5em;
} }
......
...@@ -252,7 +252,7 @@ body.reset { ...@@ -252,7 +252,7 @@ body.reset {
color: #fff; color: #fff;
.fa { .fa {
color: #fff; color: #fff;
padding-right: 0.5em; margin-right: 0.5em;
} }
} }
......
...@@ -237,7 +237,8 @@ ...@@ -237,7 +237,8 @@
_converse.UserDetailsModal = _converse.BootstrapModal.extend({ _converse.UserDetailsModal = _converse.BootstrapModal.extend({
events: { events: {
'click button.remove-contact': 'removeContact' 'click button.remove-contact': 'removeContact',
'click button.refresh-contact': 'refreshContact'
}, },
initialize () { initialize () {
...@@ -260,6 +261,7 @@ ...@@ -260,6 +261,7 @@
'label_jid': __('Jabber ID'), 'label_jid': __('Jabber ID'),
'label_nickname': __('Nickname'), 'label_nickname': __('Nickname'),
'label_remove': __('Remove as contact'), 'label_remove': __('Remove as contact'),
'label_refresh': __('Refresh'),
'label_role': __('Role'), 'label_role': __('Role'),
'label_url': __('URL') 'label_url': __('URL')
})); }));
...@@ -276,6 +278,15 @@ ...@@ -276,6 +278,15 @@
} }
}, },
refreshContact (ev) {
if (ev && ev.preventDefault) { ev.preventDefault(); }
const refresh_icon = this.el.querySelector('.fa-refresh');
u.addClass('fa-spin', refresh_icon);
_converse.api.vcard.update(this.model.contact.vcard, true)
.then(() => u.removeClass('fa-spin', refresh_icon))
.catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
},
removeContact (ev) { removeContact (ev) {
if (ev && ev.preventDefault) { ev.preventDefault(); } if (ev && ev.preventDefault) { ev.preventDefault(); }
if (!_converse.allow_contact_removal) { return; } if (!_converse.allow_contact_removal) { return; }
......
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
{[ if (o.allow_contact_removal && o.is_roster_contact) { ]} {[ if (o.allow_contact_removal && o.is_roster_contact) { ]}
<button type="button" class="btn btn-danger remove-contact" data-dismiss="modal"><i class="fa fa-trash"> </i>{{{o.label_remove}}}</button> <button type="button" class="btn btn-danger remove-contact"><i class="fa fa-trash"> </i>{{{o.label_remove}}}</button>
{[ } ]} {[ } ]}
<button type="button" class="btn btn-info refresh-contact"><i class="fa fa-refresh"> </i>{{{o.label_refresh}}}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{{o.label_close}}}</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">{{{o.label_close}}}</button>
</div> </div>
</div> </div>
......
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