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
58app . 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