Skip to content

Commit dfd336a

Browse files
Portugal, Marcelomportuga
authored andcommitted
docs(customizer): Add more features to customizer.
More of the features should are enabled so that you can see how your changes will affect the entire grid. Closes #3919
1 parent abe6e3e commit dfd336a

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

misc/site/customizer/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
</div>
7373
</div>
7474

75-
<div ng-cloak class="container-fluid" id="customizerApp" ng-controller='Main'>
75+
<div ng-cloak class="container-fluid" id="customizerApp" ng-controller='Main as $ctrl'>
7676
<br>
7777

7878
<h1 class="text-center">Grid Customizer</h2>
@@ -140,7 +140,9 @@ <h1 class="text-center">Grid Customizer</h2>
140140
{{ css }}
141141
</style>
142142

143-
<div class="grid" ui-grid="gridOptions" ui-grid-cellNav ui-grid-selection></div>
143+
<div class="grid" ui-grid="$ctrl.gridOptions" ui-grid-cellNav ui-grid-edit
144+
ui-grid-resize-columns ui-grid-pinning ui-grid-selection ui-grid-move-columns
145+
ui-grid-importer ui-grid-exporter ui-grid-grouping></div>
144146
</div>
145147
</div>
146148
<div class="col-xs-6 col-md-8">
@@ -218,7 +220,7 @@ <h3>Download CSS</h3>
218220

219221
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
220222
<!-- <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> -->
221-
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
223+
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.js"></script>
222224

223225
<script>
224226
var s = document.createElement('script');

misc/site/js/customizer.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
(function() {
22

3-
var app = angular.module('customizer', ['ui.grid', 'ui.grid.cellNav', 'ui.grid.selection']);
3+
var app = angular.module('customizer', ['ui.grid', 'ui.grid.cellNav', 'ui.grid.edit',
4+
'ui.grid.resizeColumns', 'ui.grid.pinning', 'ui.grid.selection', 'ui.grid.moveColumns',
5+
'ui.grid.exporter', 'ui.grid.importer', 'ui.grid.grouping'
6+
]);
47

58
app.run(function($log, $rootScope, $http) {
69
});
@@ -16,8 +19,8 @@ app.constant('DIRECTORIES', {
1619
BOOTSTRAP: './../../bootstrap'
1720
});
1821

19-
app.controller('Main', function($log, $http, $scope, less, Theme, FILES) {
20-
// Create grid
22+
app.controller('Main', function($log, $http, $scope, uiGridConstants, less, Theme, FILES) {
23+
var vm = this;
2124

2225
function updateCSS(compress) {
2326
$scope.compress = compress;
@@ -39,27 +42,31 @@ app.controller('Main', function($log, $http, $scope, less, Theme, FILES) {
3942
);
4043
}
4144

42-
$scope.gridOptions = {
45+
vm.gridOptions = {
46+
showGridFooter: true,
47+
showColumnFooter: true,
4348
enableFiltering: true,
44-
enableGridMenu: true
49+
enableGridMenu: true,
50+
flatEntityAccess: true,
51+
fastWatch: true,
52+
enableHorizontalScrollbar: uiGridConstants.scrollbars.WHEN_NEEDED
4553
};
4654
$http.get(FILES.DATA_100)
47-
.success(function(data) {
48-
$scope.gridOptions.data = data;
55+
.then(function(response) {
56+
vm.gridOptions.data = response.data;
4957
});
5058

5159
//Fetch initial less file
5260
$http.get(FILES.LESS_MAIN)
53-
.success(function (data) {
54-
$scope.source = data;
61+
.then(function (response) {
62+
$scope.source = response.data;
5563
});
5664

5765
$http.get(FILES.LESS_VARIABLES)
58-
.success(function (data) {
59-
$scope.variables = less.parseVariables(data);
66+
.then(function (response) {
67+
$scope.variables = less.parseVariables(response.data);
6068
$scope.trueDefaultVariables = angular.copy($scope.variables);
6169
$scope.defaultVariables = angular.copy($scope.trueDefaultVariables);
62-
console.log($scope.variables);
6370
});
6471

6572
// function() { return { a: $scope.source, b: $scope.compress }; }
@@ -128,21 +135,21 @@ app.service('Theme', function($q, $http, FILES) {
128135
var p = $q.defer();
129136

130137
$http.get(FILES.JSON_THEMES)
131-
.success(function (themeList) {
138+
.then(function (themeList) {
132139
var promises = [];
133140
var themes = {};
134-
angular.forEach(themeList, function(theme) {
141+
angular.forEach(themeList.data, function(theme) {
135142
var tp = $http.get('/customizer/themes/' + theme + '.json');
136-
tp.success(function (data) {
137-
themes[theme] = data;
143+
tp.then(function (response) {
144+
themes[theme] = response.data;
138145
});
139146
promises.push(tp);
140147
});
141148

142149
$q.all(promises)
143150
.then(function() {
144151
p.resolve({
145-
themeList: themeList,
152+
themeList: themeList.data,
146153
themeHash: themes
147154
});
148155
});
@@ -208,11 +215,10 @@ app.service('less', function($log, $q, FILES, DIRECTORIES) {
208215
modifyVars: modifyVars
209216
})
210217
.then(function( output) {
211-
console.log(output);
212218
return output.css;
213219
})
214220
.catch(function(error){
215-
console.error(error);
221+
$log.error(error);
216222
});
217223
}
218224
};

0 commit comments

Comments
 (0)