dashboard: first use profile background if not exist try branding background
This commit is contained in:
@@ -268,7 +268,9 @@ angular.module('Application').controller('BrandingController', ['$scope', '$loca
|
||||
$scope.about.avatar = null;
|
||||
$scope.about.refresh();
|
||||
|
||||
$scope.about.busy = false;
|
||||
Client.refreshBranding(function () {
|
||||
$scope.about.busy = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -247,13 +247,13 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
|
||||
Client.setBackgroundImage(imageFile, function (error) {
|
||||
if (error) return console.error('Unable to change backgroundImage.', error);
|
||||
|
||||
document.getElementById('mainContentContainer').style.backgroundImage = 'url("' + Client.getBackgroundImageUrl() + '")';
|
||||
document.getElementById('mainContentContainer').classList.add('has-background');
|
||||
Client.refreshBranding(function () {
|
||||
$scope.user.hasBackgroundImage = true;
|
||||
|
||||
$scope.user.hasBackgroundImage = true;
|
||||
$('#backgroundImageChangeModal').modal('hide');
|
||||
|
||||
$('#backgroundImageChangeModal').modal('hide');
|
||||
$scope.backgroundImageChange.reset();
|
||||
$scope.backgroundImageChange.reset();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -261,13 +261,12 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
|
||||
Client.setBackgroundImage(null, function (error) {
|
||||
if (error) return console.error('Unable to change backgroundImage.', error);
|
||||
|
||||
document.getElementById('mainContentContainer').style.backgroundImage = '';
|
||||
document.getElementById('mainContentContainer').classList.remove('has-background');
|
||||
Client.refreshBranding(function () {
|
||||
$scope.user.hasBackgroundImage = false;
|
||||
|
||||
$scope.user.hasBackgroundImage = false;
|
||||
|
||||
$('#backgroundImageChangeModal').modal('hide');
|
||||
$scope.backgroundImageChange.reset();
|
||||
$('#backgroundImageChangeModal').modal('hide');
|
||||
$scope.backgroundImageChange.reset();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -279,7 +278,7 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
|
||||
reset: function () {
|
||||
$scope.backgroundImageChange.error.avatar = null;
|
||||
|
||||
if ($scope.user.hasBackgroundImage) document.getElementById('previewBackgroundImage').src = Client.getBackgroundImageUrl();
|
||||
if ($scope.user.hasBackgroundImage) document.getElementById('previewBackgroundImage').src = Client.apiOrigin + '/api/v1/profile/background_image?access_token=' + Client.getToken() + '&bustcache=' + Date.now();
|
||||
else document.getElementById('previewBackgroundImage').src = '/img/background-image-placeholder.svg';
|
||||
|
||||
$scope.backgroundImageChange.pictureChanged = false;
|
||||
|
||||
Reference in New Issue
Block a user