Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7732 from lodr/bug-832274-no-data-usage
Browse files Browse the repository at this point in the history
Bug 832274 - Restoring default visibility attributes when updating the UI to undo the effects of the FTE

Merged cause tef+ and r+
  • Loading branch information
delapuente authored and vingtetun committed Jan 23, 2013
1 parent a56d9d9 commit 869e317
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
14 changes: 14 additions & 0 deletions apps/costcontrol/index.html
Expand Up @@ -271,6 +271,20 @@ <h1 data-l10n-id="settings">Settings</h1>
</li>
</ul>

<!-- XXX: Only available if DEBUGGING === true -->
<header class="debug-only">
<h2>Development</h2>
</header>
<ul class="settings debug-only">
<li>
<label class="end">
<input class="settings-option" data-option="fte" type="checkbox" data-type="switch" />
<span></span>
</label>
<p>Enable first time experience</p>
</li>
</ul>

<!-- Phone activity -->
<header id="phone-activity-settings" aria-hidden="true">
<h2 data-l10n-id="phone-activity">Phone Activity</h2>
Expand Down
8 changes: 8 additions & 0 deletions apps/costcontrol/js/settings/settings.js
Expand Up @@ -67,6 +67,14 @@ var Settings = (function() {

initialized = true;

// Debug options
if (DEBUGGING) {
var debugOnlyItems = document.querySelectorAll('.debug-only');
[].forEach.call(debugOnlyItems, function _showItem(item) {
item.classList.remove('debug-only');
});
}

updateUI();
});
}
Expand Down
3 changes: 2 additions & 1 deletion apps/costcontrol/js/utils/debug.js
@@ -1,8 +1,9 @@
var DEBUGGING = false;

var debug = (function() {
var SEQ_ID = 0;
var PROCESS_ID = Date.now();

var DEBUGGING = false;
var DEBUG_PREFIX = 'CC';

return function _debug() {
Expand Down
27 changes: 13 additions & 14 deletions apps/costcontrol/js/widget.js
Expand Up @@ -131,6 +131,8 @@
function setupFte(provider, mode) {

fte.setAttribute('aria-hidden', false);
leftPanel.setAttribute('aria-hidden', true);
rightPanel.setAttribute('aria-hidden', true);

if (hasSim) {
fte.addEventListener('click', function launchFte() {
Expand All @@ -139,22 +141,16 @@
});
}

leftPanel.setAttribute('aria-hidden', true);
rightPanel.setAttribute('aria-hidden', true);

var keyLookup = {
PREPAID: 'widget-authed-sim',
POSTPAID: 'widget-authed-sim',
DATA_USAGE_ONLY: 'widget-nonauthed-sim'
};

var simKey = hasSim ? keyLookup[mode] : 'widget-no-sim2';

document.getElementById('fte-icon').className = 'icon ' + simKey;

fte.querySelector('p:first-child').innerHTML = _(simKey + '-heading',
{ provider: provider });

fte.querySelector('p:last-child').innerHTML = _(simKey + '-meta');
}

Expand All @@ -168,21 +164,24 @@
var isPrepaid = (mode === 'PREPAID');
var isDataUsageOnly = (mode === 'DATA_USAGE_ONLY');

// Show fte mode widget
if (settings.fte) {
setupFte(configuration.provider, mode);
debug('Widget in FTE mode');
return;
}

// Layout
fte.setAttribute('aria-hidden', true);
leftPanel.setAttribute('aria-hidden', false);
rightPanel.setAttribute('aria-hidden', false);

var isLimited = settings.dataLimit;
views.dataUsage.setAttribute('aria-hidden', isLimited);
views.limitedDataUsage.setAttribute('aria-hidden', !isLimited);

if (currentMode !== mode) {

// Show fte mode widget
if (settings.fte) {
setupFte(configuration.provider, mode);
return;
} else {
fte.setAttribute('aria-hidden', true);
}

// Always data usage
leftPanel.setAttribute('aria-hidden', isDataUsageOnly);

Expand Down
4 changes: 4 additions & 0 deletions apps/costcontrol/style/app.css
Expand Up @@ -281,3 +281,7 @@ section.content .error-messages {
#message-handler {
visibility: hidden;
}

.debug-only {
display: none !important;
}

0 comments on commit 869e317

Please sign in to comment.