@@ -500,21 +500,14 @@ public function getRoleUsers()
500500 $ usersArray = $ this ->arrayToSelect ($ users , 'id ' , 'username ' , 'Select a user ' );
501501 $ rolesArray = $ this ->arrayToSelect ($ roles , 'id ' , 'name ' , 'None ' );
502502
503- // Set up the one page crud
504503 Crud::setTitle ('Role Users ' )
505- ->setSortProperty ('username ' )
506- ->setPaginationFlag (true )
507- ->setMulti ($ users , 'roles ' )
508- ->setMultiColumns (array ('Users ' , 'Roles ' ))
509- ->setMultiDetails (array ('name ' => 'username ' , 'field ' => 'user_id ' ))
510- ->setMultiPropertyDetails (array ('name ' => 'name ' , 'field ' => 'role_id ' ));
511-
512- // Add the form fields
513- Crud::addFormField ('user_id ' , 'select ' , $ usersArray )
514- ->addFormField ('role_id ' , 'multiselect ' , $ rolesArray );
515-
516- // Handle the view data
517- Crud::make ();
504+ ->setSortProperty ('username ' )
505+ ->setPaginationFlag (true )
506+ ->setUpMultiColumn ()
507+ ->addRootColumn ('Users ' , $ users , 'username ' , 'user_id ' , $ usersArray )
508+ ->addMultiColumn ('Roles ' , 'roles ' , 'name ' , 'role_id ' , $ rolesArray )
509+ ->finish ()
510+ ->make ();
518511 }
519512
520513 public function postRoleUsers ()
@@ -568,23 +561,20 @@ public function postRoleUsers()
568561
569562 public function getActionRoles ()
570563 {
571- $ actions = User_Permission_Action::orderByNameAsc ()->get ();
572564 $ roles = User_Permission_Role::orderByNameAsc ()->get ();
565+ $ actions = User_Permission_Action::orderByNameAsc ()->get ();
566+
567+ $ rolesArray = $ roles ->toSelectArray ('Select a role ' );
568+ $ actionsArray = $ actions ->toSelectArray ('None ' );
573569
574570 // Set up the one page crud
575571 Crud::setTitle ('Action Roles ' )
576- ->setSortProperty ('name ' )
577- ->setMulti ($ roles , 'actions ' )
578- ->setMultiColumns (array ('Roles ' , 'Actions ' ))
579- ->setMultiDetails (array ('name ' => 'name ' , 'field ' => 'role_id ' ))
580- ->setMultiPropertyDetails (array ('name ' => 'name ' , 'field ' => 'action_id ' ));
581-
582- // Add the form fields
583- Crud::addFormField ('role_id ' , 'select ' , $ this ->arrayToSelect ($ roles , 'id ' , 'name ' , 'Select a role ' ))
584- ->addFormField ('action_id ' , 'multiselect ' , $ this ->arrayToSelect ($ actions , 'id ' , 'name ' , 'None ' ));
585-
586- // Handle the view data
587- Crud::make ();
572+ ->setSortProperty ('name ' )
573+ ->setUpMultiColumn ()
574+ ->addRootColumn ('Roles ' , $ roles , 'name ' , 'role_id ' , $ rolesArray )
575+ ->addMultiColumn ('Actions ' , 'actions ' , 'name ' , 'action_id ' , $ actionsArray )
576+ ->finish ()
577+ ->make ();
588578 }
589579
590580 public function postActionRoles ()
@@ -712,19 +702,21 @@ public function getPreferencedelete($preferenceId)
712702
713703 public function getTheme ()
714704 {
715- $ masterLess = base_path () .'/vendor/syntax/core/public/less/master .less ' ;
705+ $ masterLess = public_path () .'/css/colors .less ' ;
716706
717707 $ lines = file ($ masterLess );
718708
709+ // ppd($lines);
710+
719711 $ colors = array ();
720712
721- $ colors ['grey ' ] = array ('title ' => 'Background Color ' , 'hex ' => substr (explode ('@grey: ' , $ lines [4 ])[1 ], 0 , -2 ));
722- $ colors ['primary ' ] = array ('title ' => 'Primary Color ' , 'hex ' => substr (explode ('@primaryColor: ' , $ lines [6 ])[1 ], 0 , -2 ));
723- $ colors ['info ' ] = array ('title ' => 'Information Color ' , 'hex ' => substr (explode ('@infoColor: ' , $ lines [10 ])[1 ], 0 , -2 ));
724- $ colors ['success ' ] = array ('title ' => 'Success Color ' , 'hex ' => substr (explode ('@successColor: ' , $ lines [13 ])[1 ], 0 , -2 ));
725- $ colors ['warning ' ] = array ('title ' => 'Warning Color ' , 'hex ' => substr (explode ('@warningColor: ' , $ lines [16 ])[1 ], 0 , -2 ));
726- $ colors ['error ' ] = array ('title ' => 'Error Color ' , 'hex ' => substr (explode ('@errorColor: ' , $ lines [19 ])[1 ], 0 , -2 ));
727- $ colors ['menu ' ] = array ('title ' => 'Active Menu Link Color ' , 'hex ' => substr (explode ('@menuColor: ' , $ lines [22 ])[1 ], 0 , -2 ));
713+ $ colors ['grey ' ] = array ('title ' => 'Background Color ' , 'hex ' => substr (explode ('@grey: ' , $ lines [0 ])[1 ], 0 , -2 ));
714+ $ colors ['primary ' ] = array ('title ' => 'Primary Color ' , 'hex ' => substr (explode ('@primaryColor: ' , $ lines [2 ])[1 ], 0 , -2 ));
715+ $ colors ['info ' ] = array ('title ' => 'Information Color ' , 'hex ' => substr (explode ('@infoColor: ' , $ lines [6 ])[1 ], 0 , -2 ));
716+ $ colors ['success ' ] = array ('title ' => 'Success Color ' , 'hex ' => substr (explode ('@successColor: ' , $ lines [9 ])[1 ], 0 , -2 ));
717+ $ colors ['warning ' ] = array ('title ' => 'Warning Color ' , 'hex ' => substr (explode ('@warningColor: ' , $ lines [12 ])[1 ], 0 , -2 ));
718+ $ colors ['error ' ] = array ('title ' => 'Error Color ' , 'hex ' => substr (explode ('@errorColor: ' , $ lines [15 ])[1 ], 0 , -2 ));
719+ $ colors ['menu ' ] = array ('title ' => 'Active Menu Link Color ' , 'hex ' => substr (explode ('@menuColor: ' , $ lines [18 ])[1 ], 0 , -2 ));
728720
729721 $ this ->setViewData ('colors ' , $ colors );
730722 }
@@ -734,28 +726,26 @@ public function postTheme()
734726 $ input = e_array (Input::all ());
735727
736728 if ($ input != null ) {
737- $ masterLess = base_path () .'/vendor/syntax/core/public/less/master.less ' ;
738- $ masterCss = public_path () .'/css/master.css ' ;#5097b5
729+ $ masterLess = public_path () .'/css/colors.less ' ;
739730
740731 $ lines = file ($ masterLess );
741732
742733 // Set the new colors
743- $ lines [4 ] = '@grey: ' . $ input ['grey ' ] ."; \n" ;
744- $ lines [6 ] = '@primaryColor: ' . $ input ['primary ' ] ."; \n" ;
745- $ lines [10 ] = '@infoColor: ' . $ input ['info ' ] ."; \n" ;
746- $ lines [13 ] = '@successColor: ' . $ input ['success ' ] ."; \n" ;
747- $ lines [16 ] = '@warningColor: ' . $ input ['warning ' ] ."; \n" ;
748- $ lines [19 ] = '@errorColor: ' . $ input ['error ' ] ."; \n" ;
749- $ lines [22 ] = '@menuColor: ' . $ input ['menu ' ] ."; \n" ;
734+ $ lines [0 ] = '@grey: ' . $ input ['grey ' ] ."; \n" ;
735+ $ lines [2 ] = '@primaryColor: ' . $ input ['primary ' ] ."; \n" ;
736+ $ lines [6 ] = '@infoColor: ' . $ input ['info ' ] ."; \n" ;
737+ $ lines [9 ] = '@successColor: ' . $ input ['success ' ] ."; \n" ;
738+ $ lines [12 ] = '@warningColor: ' . $ input ['warning ' ] ."; \n" ;
739+ $ lines [15 ] = '@errorColor: ' . $ input ['error ' ] ."; \n" ;
740+ $ lines [18 ] = '@menuColor: ' . $ input ['menu ' ] ."; \n" ;
750741
751742 File::delete ($ masterLess );
752- File::delete ($ masterCss );
753743
754744 File::put ($ masterLess , implode ($ lines ));
755745
756746 SSH ::run (array (
757747 'cd ' . base_path (),
758- 'lessc ' . $ masterLess . ' ' . $ masterCss
748+ 'gulp css '
759749 ));
760750
761751 Ajax::setStatus ('success ' );
0 commit comments