fixed app install error display issue (mobile only)

This commit is contained in:
Davor Spasovski 2011-12-15 02:07:23 -08:00
Родитель f374a50cc4
Коммит 276c0e6d46
3 изменённых файлов: 22 добавлений и 12 удалений

Просмотреть файл

@ -18,7 +18,7 @@
{% for link in links %} {% for link in links %}
{% set extra = "platform " + link.os.shortname if link.os else "" %} {% set extra = "platform " + link.os.shortname if link.os else "" %}
<!-- install error messages --> <!-- install error messages -->
<div class="apps-error-msg"></div> <div class="apps-error-msg"><h2></h2><p></p></div>
{% include 'addons/includes/install_button.html' %} {% include 'addons/includes/install_button.html' %}
{% endfor %} {% endfor %}
</div> </div>

Просмотреть файл

@ -39,7 +39,7 @@ exports.install = function(manifestUrl, opt) {
'success': undefined, 'success': undefined,
'error': undefined, 'error': undefined,
'errModalCallback': undefined}, opt || {}); 'errModalCallback': undefined}, opt || {});
var self = this, var self = apps,
errSummary, errSummary,
showError = true; showError = true;
/* Try and install the app. */ /* Try and install the app. */
@ -84,15 +84,24 @@ exports.install = function(manifestUrl, opt) {
}; };
exports._showError = function(errSummary, errMessage, opt) { exports._showError = function(errSummary, errMessage, opt) {
var $errTarget = $('<a>'), var $errTarget = $('<a>');
$modal = $('.apps-error-msg:first', opt.domContext).modal( if (opt.mobile) {
var $errBox = $('.apps-error-msg h2', opt.domContext);
$('.apps-error-msg h2', opt.domContext).text(errSummary);
$('.apps-error-msg p', opt.domContext).text(errMessage);
$('.apps-error-msg').show();
} else {
var $modal = $('.apps-error-msg:first', opt.domContext).modal(
$errTarget, $errTarget,
{width: '400px', close: true, {width: '400px', close: true,
callback: opt.errModalCallback}); callback: opt.errModalCallback
});
$errTarget.trigger('click'); // show the modal $errTarget.trigger('click'); // show the modal
$('.apps-error-msg h2', opt.domContext).text(errSummary); $('.apps-error-msg h2', opt.domContext).text(errSummary);
$('.apps-error-msg p', opt.domContext).text(errMessage); $('.apps-error-msg p', opt.domContext).text(errMessage);
$(opt.domContext).trigger('error_shown.apps'); $(opt.domContext).trigger('error_shown.apps');
}
}; };
})(typeof exports === 'undefined' ? (this.apps = {}) : exports); })(typeof exports === 'undefined' ? (this.apps = {}) : exports);

Просмотреть файл

@ -136,7 +136,8 @@
if (classes.webapp) { if (classes.webapp) {
install(attr.manifest_url, { install(attr.manifest_url, {
url: href, url: href,
el: activeInstaller[0] el: el,
mobile: true
}); });
} else { } else {
install(attr.name, href, attr.icon, hash); install(attr.name, href, attr.icon, hash);