Skip to content

Commit

Permalink
[#1602,js/data-viewer][xs]: make errors a bit nicer esp for case wher…
Browse files Browse the repository at this point in the history
…e we can't preview.
  • Loading branch information
rufuspollock committed Feb 1, 2012
1 parent f51d0e9 commit a0f4b8a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ckan/public/scripts/application.js
Expand Up @@ -861,10 +861,9 @@ CKAN.View.ResourceAddLink = Backbone.View.extend({
else {
// Cannot reliably preview this item - with no mimetype/format information,
// can't guarantee it's not a remote binary file such as an executable.
var _msg = $('<p class="error">We are unable to preview this type of resource: ' + resourceData.formatNormalized + '</p>');
my.showError({
title: 'Unable to preview'
, message: _msg
title: 'Preview not available for data type: ' + resourceData.formatNormalized
, message: ''
});
}
};
Expand Down Expand Up @@ -929,7 +928,10 @@ CKAN.View.ResourceAddLink = Backbone.View.extend({
};

my.showError = function (error) {
var _html = '<strong>' + $.trim(error.title) + '</strong><br />' + $.trim(error.message);
var _html = _.template(
'<div class="alert-message warning"><strong><%= title %></strong><br /><%= message %></div>'
, error
);
my.$dialog.html(_html);
};

Expand Down

0 comments on commit a0f4b8a

Please sign in to comment.