Fixes grid editor always rending 12 columns
When a user change grid cols, the editor keeps rendering 12 column layouts - this fixes the 12 cols issue and falls back to 12 in case of invalid/missing information
This commit is contained in:
@@ -389,7 +389,7 @@ angular.module("umbraco")
|
||||
};
|
||||
|
||||
$scope.percentage = function(spans){
|
||||
return ((spans/12)*100).toFixed(1);
|
||||
return (( spans/ $scope.model.config.items.columns ) *100).toFixed(1);
|
||||
};
|
||||
|
||||
|
||||
@@ -399,6 +399,7 @@ angular.module("umbraco")
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************
|
||||
// INITIALISATION
|
||||
// these methods are called from ng-init on the template
|
||||
@@ -419,6 +420,13 @@ angular.module("umbraco")
|
||||
$scope.hasSettings = true;
|
||||
}
|
||||
|
||||
//ensure the grid has a column value set, if nothing is found, set it to 12
|
||||
if($scope.model.config.items.columns && angular.isString($scope.model.config.items.columns)){
|
||||
$scope.model.config.items.columns = parseInt($scope.model.config.items.columns);
|
||||
}else{
|
||||
$scope.model.config.items.columns = 12;
|
||||
}
|
||||
|
||||
if ($scope.model.value && $scope.model.value.sections && $scope.model.value.sections.length > 0) {
|
||||
_.forEach($scope.model.value.sections, function(section, index){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user