This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ask user to confirm switching regions when we detect new region from …
…SIM card (bug 877490)
- Loading branch information
Showing
10 changed files
with
367 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
define('confirmation', ['capabilities', 'helpers', 'jquery', 'templates', 'z'], function(caps, helpers, $, nunjucks, z) { | ||
var cloakEl = $('.cloak'); | ||
var confirmationEl = $('<div class="modal confirmation">'); | ||
var addedClasses = []; | ||
|
||
function confirmationShow() { | ||
cloakEl.addClass('show light'); | ||
confirmationEl.addClass('show'); | ||
} | ||
|
||
function confirmationHide() { | ||
cloakEl.removeClass('show light'); | ||
confirmationEl.removeClass('show'); | ||
} | ||
|
||
function confirmation(opts) { | ||
var def = $.Deferred(); | ||
def.always(confirmationHide); | ||
confirmationEl.removeClass(addedClasses.join(' ')); | ||
var contentEl = confirmationEl.find('.content'); | ||
contentEl.text(''); | ||
addedClasses = []; | ||
|
||
var message = opts.message; | ||
if (!message) return; | ||
|
||
if ('classes' in opts) { | ||
addedClasses = opts.classes.split(/\s+/); | ||
} | ||
|
||
if (opts.closable) { | ||
addedClasses.push('closable'); | ||
} | ||
if (opts.timeout) { | ||
setTimeout(function() {def.reject();}, opts.timeout); | ||
} | ||
|
||
confirmationEl.addClass(addedClasses.join(' ')); | ||
|
||
var fancyMessage = fancy(message); | ||
if (fancyMessage == message) { | ||
contentEl.text(message); | ||
} else { | ||
contentEl.html(fancyMessage); | ||
} | ||
|
||
show(); | ||
|
||
return def.promise(); | ||
} | ||
|
||
var content = nunjucks.env.getTemplate('confirmation.html').render(helpers); | ||
|
||
confirmationEl.html(content).on('touchstart click', function() { | ||
console.error('reject') | ||
def.reject(); | ||
}).on('touchstart click', '.yes', function() { | ||
console.error('resolve') | ||
def.resolve(); | ||
}); | ||
z.body.append(confirmationEl); | ||
|
||
return confirmation; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
lol