@@ -178,25 +178,25 @@ public function postCropAvatar()
178
178
179
179
public function getChangeTheme ()
180
180
{
181
- $ lessTemplate = base_path () .'/vendor/syntax/core/public/less/template .less ' ;
182
- $ userLess = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'_css .less ' ;
181
+ $ masterLess = public_path () .'/css/colors .less ' ;
182
+ $ userLess = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'.less ' ;
183
183
184
184
// Make a copy of the less file
185
185
if (!File::exists ($ userLess )) {
186
- File::copy ($ lessTemplate , $ userLess );
186
+ File::copy ($ masterLess , $ userLess );
187
187
}
188
188
189
189
$ lines = file ($ userLess );
190
190
191
191
$ colors = array ();
192
192
193
- $ colors ['grey ' ] = array ('title ' => 'Background Color ' , 'hex ' => substr (explode ('@grey: ' , $ lines [4 ])[1 ], 0 , -2 ));
194
- $ colors ['primary ' ] = array ('title ' => 'Primary Color ' , 'hex ' => substr (explode ('@primaryColor: ' , $ lines [6 ])[1 ], 0 , -2 ));
195
- $ colors ['info ' ] = array ('title ' => 'Information Color ' , 'hex ' => substr (explode ('@infoColor: ' , $ lines [10 ])[1 ], 0 , -2 ));
196
- $ colors ['success ' ] = array ('title ' => 'Success Color ' , 'hex ' => substr (explode ('@successColor: ' , $ lines [13 ])[1 ], 0 , -2 ));
197
- $ colors ['warning ' ] = array ('title ' => 'Warning Color ' , 'hex ' => substr (explode ('@warningColor: ' , $ lines [16 ])[1 ], 0 , -2 ));
198
- $ colors ['error ' ] = array ('title ' => 'Error Color ' , 'hex ' => substr (explode ('@errorColor: ' , $ lines [19 ])[1 ], 0 , -2 ));
199
- $ colors ['menu ' ] = array ('title ' => 'Active Menu Link Color ' , 'hex ' => substr (explode ('@menuColor: ' , $ lines [22 ])[1 ], 0 , -2 ));
193
+ $ colors ['grey ' ] = array ('title ' => 'Background Color ' , 'hex ' => substr (explode ('@grey: ' , $ lines [0 ])[1 ], 0 , -2 ));
194
+ $ colors ['primary ' ] = array ('title ' => 'Primary Color ' , 'hex ' => substr (explode ('@primaryColor: ' , $ lines [2 ])[1 ], 0 , -2 ));
195
+ $ colors ['info ' ] = array ('title ' => 'Information Color ' , 'hex ' => substr (explode ('@infoColor: ' , $ lines [6 ])[1 ], 0 , -2 ));
196
+ $ colors ['success ' ] = array ('title ' => 'Success Color ' , 'hex ' => substr (explode ('@successColor: ' , $ lines [9 ])[1 ], 0 , -2 ));
197
+ $ colors ['warning ' ] = array ('title ' => 'Warning Color ' , 'hex ' => substr (explode ('@warningColor: ' , $ lines [12 ])[1 ], 0 , -2 ));
198
+ $ colors ['error ' ] = array ('title ' => 'Error Color ' , 'hex ' => substr (explode ('@errorColor: ' , $ lines [15 ])[1 ], 0 , -2 ));
199
+ $ colors ['menu ' ] = array ('title ' => 'Active Menu Link Color ' , 'hex ' => substr (explode ('@menuColor: ' , $ lines [18 ])[1 ], 0 , -2 ));
200
200
201
201
$ this ->setViewData ('colors ' , $ colors );
202
202
}
@@ -206,19 +206,19 @@ public function postChangeTheme()
206
206
$ input = e_array (Input::all ());
207
207
208
208
if ($ input != null ) {
209
- $ userLess = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'_css .less ' ;
209
+ $ userLess = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'.less ' ;
210
210
$ userCss = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'.css ' ;
211
211
212
212
$ lines = file ($ userLess );
213
213
214
214
// Set the new colors
215
- $ lines [4 ] = '@grey: ' . $ input ['grey ' ] ."; \n" ;
216
- $ lines [6 ] = '@primaryColor: ' . $ input ['primary ' ] ."; \n" ;
217
- $ lines [10 ] = '@infoColor: ' . $ input ['info ' ] ."; \n" ;
218
- $ lines [13 ] = '@successColor: ' . $ input ['success ' ] ."; \n" ;
219
- $ lines [16 ] = '@warningColor: ' . $ input ['warning ' ] ."; \n" ;
220
- $ lines [19 ] = '@errorColor: ' . $ input ['error ' ] ."; \n" ;
221
- $ lines [22 ] = '@menuColor: ' . $ input ['menu ' ] ."; \n" ;
215
+ $ lines [0 ] = '@grey: ' . $ input ['grey ' ] ."; \n" ;
216
+ $ lines [2 ] = '@primaryColor: ' . $ input ['primary ' ] ."; \n" ;
217
+ $ lines [6 ] = '@infoColor: ' . $ input ['info ' ] ."; \n" ;
218
+ $ lines [9 ] = '@successColor: ' . $ input ['success ' ] ."; \n" ;
219
+ $ lines [12 ] = '@warningColor: ' . $ input ['warning ' ] ."; \n" ;
220
+ $ lines [15 ] = '@errorColor: ' . $ input ['error ' ] ."; \n" ;
221
+ $ lines [18 ] = '@menuColor: ' . $ input ['menu ' ] ."; \n" ;
222
222
223
223
File::delete ($ userLess );
224
224
File::delete ($ userCss );
@@ -227,7 +227,7 @@ public function postChangeTheme()
227
227
228
228
SSH ::run (array (
229
229
'cd ' . base_path (),
230
- 'lessc ' . $ userLess . ' ' . $ userCss,
230
+ 'gulp userCss'
231
231
));
232
232
233
233
Ajax::setStatus ('success ' );
@@ -237,9 +237,11 @@ public function postChangeTheme()
237
237
238
238
public function getResetCss ()
239
239
{
240
- $ userLess = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'.css ' ;
240
+ $ userLess = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'.less ' ;
241
+ $ userCss = public_path () .'/css/users/ ' . Str::studly ($ this ->activeUser ->username ) .'.css ' ;
241
242
242
243
File::delete ($ userLess );
244
+ File::delete ($ userCss );
243
245
244
246
$ this ->redirect ('/user/account#change-theme ' , 'Your theme has been reset to the site default. ' );
245
247
}
0 commit comments