Prepare home img and properly close weather panel when removing the current opened city
parent
c3b095e677
commit
6486e87d54
|
@ -31,6 +31,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil
|
|||
|
||||
$scope.cityLoadError = '';
|
||||
$scope.currentCity = null;
|
||||
$scope.selectedCityId = 0;
|
||||
$scope.domCity = null;
|
||||
$scope.homeCity = '';
|
||||
|
||||
|
@ -84,6 +85,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil
|
|||
if (data != null) {
|
||||
$scope.domCity = city;
|
||||
$scope.currentCity = data;
|
||||
$scope.selectedCityId = city.id;
|
||||
$scope.currentCity.image = $scope.imageMapper[$scope.currentCity.weather[0].main];
|
||||
$scope.currentCity.wind.desc = "";
|
||||
if ($scope.currentCity.wind.deg > 0 && $scope.currentCity.wind.deg < 23 ||
|
||||
|
@ -172,6 +174,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil
|
|||
$scope.cities.splice(i, 1);
|
||||
// If current city is the removed city, close it
|
||||
if ($scope.selectedCityId === city.id) {
|
||||
$scope.currentCity = null;
|
||||
$scope.selectedCityId = 0;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
</div>
|
||||
<div id="city-right" ng-show="currentCity != null" style="background-image: url('{{ owncloudAppImgPath }}/img/{{ currentCity.image }}');">
|
||||
<div id="city-weather-panel">
|
||||
<div class="city-name">{{ currentCity.name }}, {{ currentCity.sys.country }}</div>
|
||||
<div class="city-name">
|
||||
{{ currentCity.name }}, {{ currentCity.sys.country }}
|
||||
<img class="home-icon" src="{{ owncloudAppImgPath }}/img/home-{{ selectedCityId == homeCity ? 'no' : '' }}pick.png" />
|
||||
</div>
|
||||
<div class="city-current-temp">{{ currentCity.main.temp }}°C</div>
|
||||
<div class="city-current-pressure">Pressure: {{ currentCity.main.pressure }} hpa</div>
|
||||
<div class="city-current-humidity">Humidity: {{ currentCity.main.humidity}}%</div>
|
||||
|
|
Loading…
Reference in New Issue