bannerService fixes + some space for the loader
This commit is contained in:
parent
bbe78ea4ca
commit
de32460fd7
3 changed files with 12 additions and 11 deletions
|
|
@ -25,11 +25,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
startupService.ready();
|
startupService.ready();
|
||||||
|
|
||||||
bannerService.getBanner(function (banner) {
|
bannerService.getBanner(function (banner) {
|
||||||
$scope.$apply(function () {
|
$scope.bannerImageUrl = banner.imageURL;
|
||||||
$scope.bannerImageUrl = banner.imageURL;
|
$scope.bannerUrl = banner.url;
|
||||||
$scope.bannerUrl = banner.url;
|
$scope.bannerIsLoading = false;
|
||||||
$scope.bannerIsLoading = false;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ angular.module('copayApp.services').factory('bannerService', function ($http, $l
|
||||||
var fetchSettings = function (cb) {
|
var fetchSettings = function (cb) {
|
||||||
var req = {
|
var req = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: marketingApiService+'/settings',
|
url: API_URL+'/settings',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
|
|
@ -28,10 +28,10 @@ angular.module('copayApp.services').factory('bannerService', function ($http, $l
|
||||||
};
|
};
|
||||||
$http(req).then(function (response) {
|
$http(req).then(function (response) {
|
||||||
$log.info('Get banner settings: SUCCESS');
|
$log.info('Get banner settings: SUCCESS');
|
||||||
banners = response.data
|
banners = response.data;
|
||||||
return cb(true);
|
return cb(true);
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
$log.error('Get banner settings: ERROR ' + data.statusText);
|
$log.error('Get banner settings: ERROR ' + response.statusText);
|
||||||
return cb(false);
|
return cb(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -44,7 +44,7 @@ angular.module('copayApp.services').factory('bannerService', function ($http, $l
|
||||||
|
|
||||||
// If never fetch, lets fetch
|
// If never fetch, lets fetch
|
||||||
fetchSettings(function (isSuccess) {
|
fetchSettings(function (isSuccess) {
|
||||||
root.getBannerImage(cb);
|
root.getBanner(cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
// If fetch, and got banners, lets have a look
|
// If fetch, and got banners, lets have a look
|
||||||
|
|
@ -55,14 +55,14 @@ angular.module('copayApp.services').factory('bannerService', function ($http, $l
|
||||||
|
|
||||||
// Generate the URL for the banner
|
// Generate the URL for the banner
|
||||||
var fileName = banner.image.substring(0, banner.image.lastIndexOf('.'));
|
var fileName = banner.image.substring(0, banner.image.lastIndexOf('.'));
|
||||||
var extension = banner.image.substring(banner.image.lastIndexOf('.'));
|
var extension = banner.image.substring(banner.image.lastIndexOf('.')+1);
|
||||||
banner.imageURL = API_URL +'/banners/'+fileName+"/"+extension;
|
banner.imageURL = API_URL +'/banners/'+fileName+"/"+extension;
|
||||||
|
|
||||||
// Add the banner
|
// Add the banner
|
||||||
selectedBanners.push(banners[i]);
|
selectedBanners.push(banners[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no banner activated, I return the default one
|
// If no banner activated, return the default one
|
||||||
if (selectedBanners.length == 0) {
|
if (selectedBanners.length == 0) {
|
||||||
return cb(defaultBanner);
|
return cb(defaultBanner);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-banner {
|
&-banner {
|
||||||
|
svg {
|
||||||
|
margin: 40px auto 40px;
|
||||||
|
}
|
||||||
padding: 0;
|
padding: 0;
|
||||||
&__img {
|
&__img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue