1
1
( function ( ) {
2
2
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
+ ] ) ;
4
7
5
8
app . run ( function ( $log , $rootScope , $http ) {
6
9
} ) ;
@@ -16,8 +19,8 @@ app.constant('DIRECTORIES', {
16
19
BOOTSTRAP : './../../bootstrap'
17
20
} ) ;
18
21
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 ;
21
24
22
25
function updateCSS ( compress ) {
23
26
$scope . compress = compress ;
@@ -39,27 +42,31 @@ app.controller('Main', function($log, $http, $scope, less, Theme, FILES) {
39
42
) ;
40
43
}
41
44
42
- $scope . gridOptions = {
45
+ vm . gridOptions = {
46
+ showGridFooter : true ,
47
+ showColumnFooter : true ,
43
48
enableFiltering : true ,
44
- enableGridMenu : true
49
+ enableGridMenu : true ,
50
+ flatEntityAccess : true ,
51
+ fastWatch : true ,
52
+ enableHorizontalScrollbar : uiGridConstants . scrollbars . WHEN_NEEDED
45
53
} ;
46
54
$http . get ( FILES . DATA_100 )
47
- . success ( function ( data ) {
48
- $scope . gridOptions . data = data ;
55
+ . then ( function ( response ) {
56
+ vm . gridOptions . data = response . data ;
49
57
} ) ;
50
58
51
59
//Fetch initial less file
52
60
$http . get ( FILES . LESS_MAIN )
53
- . success ( function ( data ) {
54
- $scope . source = data ;
61
+ . then ( function ( response ) {
62
+ $scope . source = response . data ;
55
63
} ) ;
56
64
57
65
$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 ) ;
60
68
$scope . trueDefaultVariables = angular . copy ( $scope . variables ) ;
61
69
$scope . defaultVariables = angular . copy ( $scope . trueDefaultVariables ) ;
62
- console . log ( $scope . variables ) ;
63
70
} ) ;
64
71
65
72
// function() { return { a: $scope.source, b: $scope.compress }; }
@@ -128,21 +135,21 @@ app.service('Theme', function($q, $http, FILES) {
128
135
var p = $q . defer ( ) ;
129
136
130
137
$http . get ( FILES . JSON_THEMES )
131
- . success ( function ( themeList ) {
138
+ . then ( function ( themeList ) {
132
139
var promises = [ ] ;
133
140
var themes = { } ;
134
- angular . forEach ( themeList , function ( theme ) {
141
+ angular . forEach ( themeList . data , function ( theme ) {
135
142
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 ;
138
145
} ) ;
139
146
promises . push ( tp ) ;
140
147
} ) ;
141
148
142
149
$q . all ( promises )
143
150
. then ( function ( ) {
144
151
p . resolve ( {
145
- themeList : themeList ,
152
+ themeList : themeList . data ,
146
153
themeHash : themes
147
154
} ) ;
148
155
} ) ;
@@ -208,11 +215,10 @@ app.service('less', function($log, $q, FILES, DIRECTORIES) {
208
215
modifyVars : modifyVars
209
216
} )
210
217
. then ( function ( output ) {
211
- console . log ( output ) ;
212
218
return output . css ;
213
219
} )
214
220
. catch ( function ( error ) {
215
- console . error ( error ) ;
221
+ $log . error ( error ) ;
216
222
} ) ;
217
223
}
218
224
} ;
0 commit comments