#1216 uvc now deletes the styles when you change the state
gitea/salix/master This commit looks good Details

This commit is contained in:
Gerard 2019-03-06 11:05:29 +01:00
parent 8e45858cd0
commit 665f34b67e
1 changed files with 19 additions and 6 deletions

View File

@ -49,15 +49,28 @@ export function directive($http, $compile, vnApp, $translate) {
} }
}); });
let rule = selectors.join(', ') + '{display: none;}';
if ($scope.css)
document.head.removeChild($scope.css);
if ($scope.css || document.querySelector('style[id="uvc"]')) {
let child = document.querySelector('style[id="uvc"]');
child.parentNode.removeChild(child);
}
if (selectors.length) {
let rule = selectors.join(', ') + '{display: none;}';
$scope.css = document.createElement('style'); $scope.css = document.createElement('style');
$scope.css.setAttribute('id', 'uvc');
document.head.appendChild($scope.css); document.head.appendChild($scope.css);
$scope.css.appendChild(document.createTextNode(rule)); $scope.css.appendChild(document.createTextNode(rule));
} }
$scope.$on('$destroy', () => {
if ($scope.css && document.querySelector('style[id="uvc"]')) {
let child = document.querySelector('style[id="uvc"]');
child.parentNode.removeChild(child);
}
});
}
function saveConfiguration(tableConfiguration) { function saveConfiguration(tableConfiguration) {
tableConfiguration.configuration = JSON.parse(JSON.stringify(tableConfiguration.configuration)); tableConfiguration.configuration = JSON.parse(JSON.stringify(tableConfiguration.configuration));
return $http.post(`/api/UserConfigViews/save`, tableConfiguration); return $http.post(`/api/UserConfigViews/save`, tableConfiguration);