From e4f705ff366b71c213e4352b5b238071e6dff0bc Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Fri, 13 Mar 2020 19:33:19 +0100
Subject: [PATCH] [fix] Fix API locale flag

---
 www/js/api/app.js            | 2 +-
 www/templates/api/home.html  | 2 +-
 www/templates/home/home.html | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/www/js/api/app.js b/www/js/api/app.js
index a5d1fa6ac..6c967d4ca 100644
--- a/www/js/api/app.js
+++ b/www/js/api/app.js
@@ -82,7 +82,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
 
     $scope.showLocalesPopover = function(event) {
       UIUtils.popover.show(event, {
-        templateUrl: 'templates/api/locales_popover.html',
+        templateUrl: 'templates/api/popover_locales.html',
         scope: $scope,
         autoremove: true,
         afterShow: function(popover) {
diff --git a/www/templates/api/home.html b/www/templates/api/home.html
index e7d90af69..59170b661 100644
--- a/www/templates/api/home.html
+++ b/www/templates/api/home.html
@@ -7,7 +7,7 @@
     <!-- locales  -->
     <button class="button button-clear hidden-xs hidden-sm flag"
             ng-click="showLocalesPopover($event)" style="align-content: center">
-      <i class="flag-image" style="background-image: url(../img/flag-{{$root.settings.locale.flag}}.png);"></i>
+      <i class="flag-image" ng-if="$root.settings.locale" style="background-image: url(../img/flag-{{$root.settings.locale.flag}}.png);"></i>
       <b class="ion-arrow-down-b gray"></b>
     </button>
   </ion-nav-buttons>
diff --git a/www/templates/home/home.html b/www/templates/home/home.html
index 580448d6b..f04c64c84 100644
--- a/www/templates/home/home.html
+++ b/www/templates/home/home.html
@@ -6,7 +6,9 @@
     <!-- locales  -->
     <button class="button button-clear hidden-xs hidden-sm flag"
             ng-click="showLocalesPopover($event)" style="align-content: center">
-      <i class="flag-image" style="background-image: url(./img/flag-{{$root.settings.locale.flag}}.png);"></i>
+      <i class="flag-image"
+         ng-if=":locale:$root.settings.locale"
+         style="background-image: url(./img/flag-{{$root.settings.locale.flag}}.png);"></i>
       <b class="ion-arrow-down-b gray"></b>
     </button>
   </ion-nav-buttons>
-- 
GitLab