Skip to content

Commit d86a194

Browse files
author
per ploug
committed
Filter grid cell and row settings
Settings and styles can now be specifically applied to a cell or a row, by default on both
1 parent 18bf4a8 commit d86a194

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/dialogs/config.controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ angular.module("umbraco")
2929
}
3030

3131

32-
$scope.styles = angular.copy($scope.dialogOptions.config.items.styles);
33-
$scope.config = angular.copy($scope.dialogOptions.config.items.config);
32+
$scope.styles = _.filter( angular.copy($scope.dialogOptions.config.items.styles), function(item){return (item.applyTo === undefined || item.applyTo === $scope.dialogOptions.itemType); });
33+
$scope.config = _.filter( angular.copy($scope.dialogOptions.config.items.config), function(item){return (item.applyTo === undefined || item.applyTo === $scope.dialogOptions.itemType); });
34+
3435

3536
var element = $scope.dialogOptions.gridItem;
3637
if(angular.isObject(element.config)){

src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ angular.module("umbraco")
4040
tinyMCE.execCommand('mceAddEditor', false, $(this).attr('id'));
4141
});
4242
}
43-
4443
};
4544

4645
var notIncludedRte = [];
@@ -235,13 +234,14 @@ angular.module("umbraco")
235234
}
236235
};
237236

238-
$scope.editGridItemSettings = function (gridItem) {
237+
$scope.editGridItemSettings = function (gridItem, itemType) {
239238

240239
dialogService.open(
241240
{
242241
template: "views/propertyeditors/grid/dialogs/config.html",
243242
gridItem: gridItem,
244243
config: $scope.model.config,
244+
itemType: itemType,
245245
callback: function(data){
246246

247247
gridItem.styles = data.styles;
@@ -338,7 +338,8 @@ angular.module("umbraco")
338338

339339
var newControl = {
340340
value: null,
341-
editor: editor
341+
editor: editor,
342+
$initializing: true
342343
};
343344

344345
if (index === undefined) {
@@ -410,6 +411,8 @@ angular.module("umbraco")
410411
$scope.model.value.sections.splice(index, 1);
411412
}
412413
});
414+
}else if($scope.model.config.items.templates && $scope.model.config.items.templates.length === 1){
415+
$scope.addTemplate($scope.model.config.items.templates[0]);
413416
}
414417

415418
if(clear){

src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<a class="iconBox"
8989
ng-mouseover="setInfohighlightRow(row)"
9090
ng-mouseleave="disableInfohighlightRow(row)"
91-
ng-click="editGridItemSettings(row)"
91+
ng-click="editGridItemSettings(row, 'row')"
9292
href>
9393
<i class="icon icon-settings"></i>
9494
</a>
@@ -154,7 +154,7 @@
154154
<a class="iconBox"
155155
ng-mouseover="setInfohighlightArea(area)"
156156
ng-mouseleave="disableInfohighlightArea(area)"
157-
ng-click="editGridItemSettings(area)"
157+
ng-click="editGridItemSettings(area, 'cell')"
158158
href>
159159
<i class="icon icon-settings"></i>
160160
</a>

0 commit comments

Comments
 (0)