From 90c239ef666ca9516ed2f3bb8c0d04d006d00d83 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Mar 2018 16:36:41 +0100 Subject: [PATCH] Handle errors in instance listing --- content/home.en.md | 3 ++- content/home.fr.md | 3 ++- .../static/js/instances.js | 24 +++++++++++-------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/content/home.en.md b/content/home.en.md index 02253c7..bd9d3fc 100644 --- a/content/home.en.md +++ b/content/home.en.md @@ -119,7 +119,8 @@ or the entire fediverse. Liste des instances
-
This is like picking an e-mail hosting provider: the domain will also be part of your username!
+ +
This is like picking an e-mail hosting provider: the domain will be part of your username!
{{% /grid %}} diff --git a/content/home.fr.md b/content/home.fr.md index 3d2b81d..37d1f63 100644 --- a/content/home.fr.md +++ b/content/home.fr.md @@ -119,7 +119,8 @@ Liste des instances
-
This is like picking an e-mail hosting provider: the domain will also be part of your username!
+ +
C'est comme choisir un fournisseur d'email : le nom de domaine fera partie de votre identifiant !
{{% /grid %}} {{% /grid %}} diff --git a/themes/hugo-bootstrap-premium/static/js/instances.js b/themes/hugo-bootstrap-premium/static/js/instances.js index 3dab9d7..761d67c 100644 --- a/themes/hugo-bootstrap-premium/static/js/instances.js +++ b/themes/hugo-bootstrap-premium/static/js/instances.js @@ -6,19 +6,23 @@ $(function () { signup: true, healthy: true } + const instancesListElement = $('#instances-list') - $.get(instancesApi, data, function (res) { - const instances = res.data + $.get(instancesApi, data) + .done(function (res) { + const instances = res.data - const lis = [] - instances.forEach(function (instance) { - const el = createInstanceElement(instance.host, instance.name, instance.shortDescription) - lis.push(el) + const lis = [] + instances.forEach(function (instance) { + const el = createInstanceElement(instance.host, instance.name, instance.shortDescription) + lis.push(el) + }) + + instancesListElement.append(lis) + }) + .fail(function (err) { + $('#instances-list-error').css('display', 'block') }) - - $('#instances-list').append(lis) - - }) function createInstanceElement (host, name, description) { const a = $('', {