Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request mozilla-b2g#7428 from albertopq/issue-827957
Bug 827292 - Adding favorite diffrentation r=basiclines
  • Loading branch information
vingtetun committed Jan 10, 2013
2 parents 15e6c92 + f92cc8c commit 2b8b03b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
13 changes: 10 additions & 3 deletions apps/communications/contacts/js/contacts_details.js
Expand Up @@ -187,6 +187,9 @@ contacts.Details = (function() {
} }
} }


// Disabling button while saving the contact
favoriteMessage.style.pointerEvents = 'none';

var request = navigator.mozContacts.save(contact); var request = navigator.mozContacts.save(contact);
request.onsuccess = function onsuccess() { request.onsuccess = function onsuccess() {
var cList = contacts.List; var cList = contacts.List;
Expand All @@ -207,19 +210,23 @@ contacts.Details = (function() {
cList.refresh(contact); cList.refresh(contact);
} }
renderFavorite(contactData); renderFavorite(contactData);
favoriteMessage.style.pointerEvents = 'auto';
}, function onError() { }, function onError() {
console.error('Error reloading contact'); console.error('Error reloading contact');
favoriteMessage.style.pointerEvents = 'auto';
}); });
}; };
request.onerror = function onerror() { request.onerror = function onerror() {
favoriteMessage.style.pointerEvents = 'auto';
console.error('Error saving favorite'); console.error('Error saving favorite');
}; };
}; };


var toggleFavoriteMessage = function toggleFavMessage(isFav) { var toggleFavoriteMessage = function toggleFavMessage(isFav) {
favoriteMessage.textContent = !isFav ? var cList = favoriteMessage.classList;
_('addFavorite') : var text = isFav ? _('removeFavorite') : _('addFavorite');
_('removeFavorite'); favoriteMessage.textContent = text;
isFav ? cList.add('on') : cList.remove('on');
}; };


var renderOrg = function cd_renderOrg(contact) { var renderOrg = function cd_renderOrg(contact) {
Expand Down
7 changes: 6 additions & 1 deletion apps/communications/contacts/style/app.css
Expand Up @@ -467,7 +467,12 @@ li button.icon-link:before {


/* Extending icons */ /* Extending icons */
li button.icon-fav:before { li button.icon-fav:before {
background-image: url(/contacts/style/images/icon-fav-button.png); background-image: url(/contacts/style/images/icon-fav-button-off.png);
right: 0.5rem;
}

li button.icon-fav.on:before {
background-image: url(/contacts/style/images/icon-fav-button-on.png);
} }


li button.icon-fb-profile:before { li button.icon-fb-profile:before {
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 2b8b03b

Please sign in to comment.