Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
80
gaia/apps/communications/contacts/js/header_ui.js
Executable file
80
gaia/apps/communications/contacts/js/header_ui.js
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
/* globals ActivityHandler, MainNavigation */
|
||||
|
||||
(function(exports) {
|
||||
'use strict';
|
||||
|
||||
exports.HeaderUI = {
|
||||
_lastCustomHeaderCallback: null,
|
||||
settings: document.getElementById('view-settings'),
|
||||
settingsButton: document.getElementById('settings-button'),
|
||||
header: document.getElementById('contacts-list-header'),
|
||||
addButton: document.getElementById('add-contact-button'),
|
||||
editModeTitleElement: document.getElementById('edit-title'),
|
||||
appTitleElement: document.getElementById('app-title'),
|
||||
|
||||
setupActionableHeader: function() {
|
||||
this.header.removeAttribute('action');
|
||||
this.settingsButton.hidden = false;
|
||||
this.addButton.hidden = false;
|
||||
|
||||
this.appTitleElement.setAttribute('data-l10n-id', 'contacts');
|
||||
},
|
||||
|
||||
setCancelableHeader: function(cb, titleId) {
|
||||
this.setupCancelableHeader(titleId);
|
||||
this.header.removeEventListener('action', this.handleCancel);
|
||||
this._lastCustomHeaderCallback = cb;
|
||||
this.header.addEventListener('action', cb);
|
||||
},
|
||||
|
||||
setNormalHeader: function() {
|
||||
this.setupActionableHeader();
|
||||
this.header.removeEventListener('action', this._lastCustomHeaderCallback);
|
||||
this.header.addEventListener('action', this.handleCancel);
|
||||
},
|
||||
|
||||
setupCancelableHeader: function(alternativeTitle) {
|
||||
this.header.setAttribute('action', 'close');
|
||||
this.settingsButton.hidden = true;
|
||||
this.addButton.hidden = true;
|
||||
if (alternativeTitle) {
|
||||
this.appTitleElement.setAttribute('data-l10n-id', alternativeTitle);
|
||||
}
|
||||
// Trigger the title to re-run font-fit/centering logic
|
||||
this.appTitleElement.textContent = this.appTitleElement.textContent;
|
||||
},
|
||||
|
||||
handleCancel: function() {
|
||||
//If in an activity, cancel it
|
||||
if (ActivityHandler.currentlyHandling) {
|
||||
ActivityHandler.postCancel();
|
||||
MainNavigation.home();
|
||||
} else {
|
||||
MainNavigation.back();
|
||||
}
|
||||
},
|
||||
|
||||
updateSelectCountTitle: function(count) {
|
||||
navigator.mozL10n.setAttributes(this.editModeTitleElement,
|
||||
'SelectedTxt',
|
||||
{n: count});
|
||||
},
|
||||
|
||||
hideAddButton: function() {
|
||||
this.addButton.classList.add('hide');
|
||||
},
|
||||
|
||||
updateHeader: function(isCancelable) {
|
||||
if (isCancelable) {
|
||||
var alternativeTitle = null;
|
||||
var activityName = ActivityHandler.activityName;
|
||||
if (activityName === 'pick' || activityName === 'update') {
|
||||
alternativeTitle = 'selectContact';
|
||||
}
|
||||
this.setupCancelableHeader(alternativeTitle);
|
||||
} else {
|
||||
this.setupActionableHeader();
|
||||
}
|
||||
}
|
||||
};
|
||||
})(window);
|
||||
Loading…
Reference in a new issue