From a0f4b8af14d2022e8a00f45fbc9b1c147d261d88 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Wed, 1 Feb 2012 14:44:54 +0000 Subject: [PATCH] [#1602,js/data-viewer][xs]: make errors a bit nicer esp for case where we can't preview. --- ckan/public/scripts/application.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ckan/public/scripts/application.js b/ckan/public/scripts/application.js index 020ed65c267..e96f5ddc3e6 100644 --- a/ckan/public/scripts/application.js +++ b/ckan/public/scripts/application.js @@ -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 = $('

We are unable to preview this type of resource: ' + resourceData.formatNormalized + '

'); my.showError({ - title: 'Unable to preview' - , message: _msg + title: 'Preview not available for data type: ' + resourceData.formatNormalized + , message: '' }); } }; @@ -929,7 +928,10 @@ CKAN.View.ResourceAddLink = Backbone.View.extend({ }; my.showError = function (error) { - var _html = '' + $.trim(error.title) + '
' + $.trim(error.message); + var _html = _.template( + '
<%= title %>
<%= message %>
' + , error + ); my.$dialog.html(_html); };