Replace accept/decline buttons with font icons

This commit is contained in:
JC Brand 2014-07-19 14:50:25 +02:00
parent 9bf4eba33b
commit a338ede0d1
5 changed files with 80 additions and 68 deletions

View File

@ -2841,18 +2841,22 @@
}, },
acceptRequest: function (ev) { acceptRequest: function (ev) {
if (ev && ev.preventDefault) { ev.preventDefault(); }
var jid = this.model.get('jid'); var jid = this.model.get('jid');
converse.connection.roster.authorize(jid); converse.connection.roster.authorize(jid);
converse.connection.roster.add(jid, this.model.get('fullname'), [], function (iq) { converse.connection.roster.add(jid, this.model.get('fullname'), [], function (iq) {
converse.connection.roster.subscribe(jid, null, converse.xmppstatus.get('fullname')); converse.connection.roster.subscribe(jid, null, converse.xmppstatus.get('fullname'));
}); });
ev.preventDefault();
}, },
declineRequest: function (ev) { declineRequest: function (ev) {
ev.preventDefault(); if (ev && ev.preventDefault) { ev.preventDefault(); }
converse.connection.roster.unauthorize(this.model.get('jid')); var result = confirm(__("Are you sure you want to decline this contact request?"));
this.model.destroy(); if (result === true) {
converse.connection.roster.unauthorize(this.model.get('jid'));
this.model.destroy();
}
return this;
}, },
render: function () { render: function () {
@ -2887,8 +2891,8 @@
this.$el.addClass('requesting-xmpp-contact'); this.$el.addClass('requesting-xmpp-contact');
this.$el.html(converse.templates.requesting_contact( this.$el.html(converse.templates.requesting_contact(
_.extend(item.toJSON(), { _.extend(item.toJSON(), {
'label_accept': __('Accept'), 'desc_accept': __("Click to accept this contact request"),
'label_decline': __('Decline') 'desc_decline': __("Click to decline this contact request"),
}) })
)); ));
converse.controlboxtoggle.showControlBox(); converse.controlboxtoggle.showControlBox();

View File

@ -851,16 +851,14 @@ dl.add-converse-contact {
background-color: #DCEAC5; background-color: #DCEAC5;
/* Make this difference */ /* Make this difference */
} }
#conversejs #converse-roster dd.current-xmpp-contact {
clear: both;
}
#conversejs #converse-roster dd.current-xmpp-contact span { #conversejs #converse-roster dd.current-xmpp-contact span {
font-size: 16px; font-size: 16px;
float: left; float: left;
color: #4f4f4f; color: #4f4f4f;
} }
#conversejs #converse-roster dd.requesting-xmpp-contact button { #conversejs .requesting-xmpp-contact .request-actions {
margin-left: 0.5em; margin-left: 0.5em;
float: right;
} }
#conversejs #converse-roster dd a, #conversejs #converse-roster dd a,
#conversejs #converse-roster dd span { #conversejs #converse-roster dd span {
@ -871,7 +869,7 @@ dl.add-converse-contact {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
#conversejs #converse-roster dd span { #conversejs #converse-roster dd span {
padding: 2px 5px 0 0; padding: 0 5px 0 0;
} }
#conversejs #converse-roster { #conversejs #converse-roster {
overflow-y: auto; overflow-y: auto;
@ -887,7 +885,6 @@ dl.add-converse-contact {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: inline-block; display: inline-block;
width: 175px;
} }
#conversejs dd.available-chatroom a.open-room { #conversejs dd.available-chatroom a.open-room {
width: 148px; width: 148px;
@ -898,21 +895,12 @@ dl.add-converse-contact {
font-size: 13px; font-size: 13px;
color: #666; color: #666;
border: none; border: none;
padding: 0.3em 0em 0em 0.5em; padding: 0.3em 0 0 0.5em;
text-shadow: 0 1px 0 #fafafa; text-shadow: 0 1px 0 #fafafa;
} }
#conversejs #converse-roster dt { #conversejs #converse-roster dt {
display: none; display: none;
} }
#conversejs dd.available-chatroom,
#conversejs #converse-roster dd {
font-weight: bold;
border: none;
display: block;
padding: 0 0em 0 0.5em;
color: #666;
text-shadow: 0 1px 0 #fafafa;
}
#conversejs .room-info { #conversejs .room-info {
font-size: 11px; font-size: 11px;
font-style: normal; font-style: normal;
@ -949,8 +937,27 @@ dl.add-converse-contact {
margin-top: 3px; margin-top: 3px;
font-size: 15px; font-size: 15px;
} }
#conversejs dd.available-chatroom,
#conversejs #converse-roster dd {
font-weight: bold;
border: none;
display: block;
padding: 1px 0 0 0.5em;
color: #666;
text-shadow: 0 1px 0 #fafafa;
clear: both;
}
#conversejs #converse-roster dd {
line-height: 16px;
}
#conversejs dd.available-chatroom:hover,
#conversejs #converse-roster dd:hover {
background-color: #eee;
}
#conversejs #converse-roster dd a.decline-xmpp-request {
margin-left: 5px;
}
#conversejs #converse-roster dd a.remove-xmpp-contact { #conversejs #converse-roster dd a.remove-xmpp-contact {
line-height: 21px;
float: right; float: right;
width: 22px; width: 22px;
margin: 0; margin: 0;
@ -961,14 +968,7 @@ dl.add-converse-contact {
display: inline-block; display: inline-block;
} }
#conversejs #converse-roster a.open-chat { #conversejs #converse-roster a.open-chat {
line-height: 21px; width: 80%;
width: 85%;
}
#conversejs #converse-roster dd:hover a.open-chat {
width: 70%;
}
#conversejs #converse-roster dd.pending-xmpp-contact:hover span {
width: 70%;
} }
#conversejs .chatbox, #conversejs .chatbox,
#conversejs .chatroom { #conversejs .chatroom {

View File

@ -943,18 +943,15 @@ dl.add-converse-contact {
background-color: #DCEAC5; /* Make this difference */ background-color: #DCEAC5; /* Make this difference */
} }
#conversejs #converse-roster dd.current-xmpp-contact {
clear: both;
}
#conversejs #converse-roster dd.current-xmpp-contact span { #conversejs #converse-roster dd.current-xmpp-contact span {
font-size: 16px; font-size: 16px;
float: left; float: left;
color: rgb(79, 79, 79); color: rgb(79, 79, 79);
} }
#conversejs #converse-roster dd.requesting-xmpp-contact button{ #conversejs .requesting-xmpp-contact .request-actions {
margin-left: 0.5em; margin-left: 0.5em;
float: right;
} }
#conversejs #converse-roster dd a, #conversejs #converse-roster dd a,
@ -967,7 +964,7 @@ dl.add-converse-contact {
} }
#conversejs #converse-roster dd span { #conversejs #converse-roster dd span {
padding: 2px 5px 0 0; padding: 0 5px 0 0;
} }
#conversejs #converse-roster { #conversejs #converse-roster {
@ -985,7 +982,6 @@ dl.add-converse-contact {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: inline-block; display: inline-block;
width: 175px;
} }
#conversejs dd.available-chatroom a.open-room { #conversejs dd.available-chatroom a.open-room {
@ -998,7 +994,7 @@ dl.add-converse-contact {
font-size: 13px; font-size: 13px;
color: #666; color: #666;
border: none; border: none;
padding: 0.3em 0em 0em 0.5em; padding: 0.3em 0 0 0.5em;
text-shadow: 0 1px 0 rgba(250, 250, 250, 1); text-shadow: 0 1px 0 rgba(250, 250, 250, 1);
} }
@ -1006,16 +1002,6 @@ dl.add-converse-contact {
display: none; display: none;
} }
#conversejs dd.available-chatroom,
#conversejs #converse-roster dd {
font-weight: bold;
border: none;
display: block;
padding: 0 0em 0 0.5em;
color: #666;
text-shadow: 0 1px 0 rgba(250, 250, 250, 1);
}
#conversejs .room-info { #conversejs .room-info {
font-size: 11px; font-size: 11px;
font-style: normal; font-style: normal;
@ -1059,8 +1045,31 @@ dl.add-converse-contact {
font-size: 15px; font-size: 15px;
} }
#conversejs dd.available-chatroom,
#conversejs #converse-roster dd {
font-weight: bold;
border: none;
display: block;
padding: 1px 0 0 0.5em;
color: #666;
text-shadow: 0 1px 0 rgba(250, 250, 250, 1);
clear: both;
}
#conversejs #converse-roster dd {
line-height: 16px;
}
#conversejs dd.available-chatroom:hover,
#conversejs #converse-roster dd:hover {
background-color: #eee;
}
#conversejs #converse-roster dd a.decline-xmpp-request {
margin-left: 5px;
}
#conversejs #converse-roster dd a.remove-xmpp-contact { #conversejs #converse-roster dd a.remove-xmpp-contact {
line-height: 21px;
float: right; float: right;
width: 22px; width: 22px;
margin: 0; margin: 0;
@ -1073,14 +1082,7 @@ dl.add-converse-contact {
} }
#conversejs #converse-roster a.open-chat { #conversejs #converse-roster a.open-chat {
line-height: 21px; width: 80%;
width: 85%;
}
#conversejs #converse-roster dd:hover a.open-chat {
width: 70%;
}
#conversejs #converse-roster dd.pending-xmpp-contact:hover span {
width: 70%;
} }
#conversejs .chatbox, #conversejs .chatbox,
@ -1427,7 +1429,7 @@ input.custom-xmpp-status {
} }
#conversejs .chatbox .dropdown dt a span { #conversejs .chatbox .dropdown dt a span {
cursor:pointer; cursor: pointer;
display:block; display:block;
padding: 4px 7px 0 5px; padding: 4px 7px 0 5px;
color: rgb(79, 79, 79); color: rgb(79, 79, 79);

View File

@ -143,14 +143,18 @@
<dt id="xmpp-contact-requests" style="display: block;">Contact requests</dt> <dt id="xmpp-contact-requests" style="display: block;">Contact requests</dt>
<dd class="offline requesting-xmpp-contact"> <dd class="offline requesting-xmpp-contact">
<div>Bob Skinstad</div> <span>Bob Skinstad</span>
<button type="button" class="accept-xmpp-request">Accept</button> <span class="request-actions">
<button type="button" class="decline-xmpp-request">Decline</button> <a class="accept-xmpp-request icon-checkmark" title="Click here to accept this contact's request" href="#"></a>
<a class="decline-xmpp-request icon-close" title="Click here to decline this contact's request" href="#"></a>
</span>
</dd> </dd>
<dd class="offline requesting-xmpp-contact"> <dd class="offline requesting-xmpp-contact">
<div>André Vos</div> <span>André Vos</span>
<button type="button" class="accept-xmpp-request">Accept</button> <span class="request-actions">
<button type="button" class="decline-xmpp-request">Decline</button> <a class="accept-xmpp-request icon-checkmark" title="Click here to accept this contact's request" href="#"></a>
<a class="decline-xmpp-request icon-close" title="Click here to decline this contact's request" href="#"></a>
</span>
</dd> </dd>
<dt id="pending-xmpp-contacts" style="display: block;">Pending contacts</dt> <dt id="pending-xmpp-contacts" style="display: block;">Pending contacts</dt>

View File

@ -1,3 +1,5 @@
<div>{{fullname}}</div> <span>{{fullname}}</span>
<button type="button" class="accept-xmpp-request">{{label_accept}}</button> <span class="request-actions">
<button type="button" class="decline-xmpp-request">{{label_decline}}</button> <a class="accept-xmpp-request icon-checkmark" title="{{desc_accept}}" href="#"></a>
<a class="decline-xmpp-request icon-close" title="{{desc_decline}}" href="#"></a>
</span>