From d3cc1a346f49fcdd3adab8140f9873dbfd189245 Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 25 Apr 2014 13:56:56 -0700 Subject: [PATCH 01/27] added basic sidebar and setup for driver cockpit 3.0 --- .../cockpit2/frontend/drivers-orders.phtml | 3 ++ .../cockpit2/frontend/drivers-shifts.phtml | 4 ++ .../default/cockpit2/layout/html.body.phtml | 20 +++++++- www/assets/cockpit/js/cockpit.js | 13 ++++- www/assets/cockpit/js/controllers.js | 25 +++++++--- www/assets/cockpit/js/service.account.js | 13 ++++- www/assets/cockpit/scss/cockpit.scss | 47 ++++++++----------- 7 files changed, 88 insertions(+), 37 deletions(-) create mode 100644 include/views/default/cockpit2/frontend/drivers-orders.phtml create mode 100644 include/views/default/cockpit2/frontend/drivers-shifts.phtml diff --git a/include/views/default/cockpit2/frontend/drivers-orders.phtml b/include/views/default/cockpit2/frontend/drivers-orders.phtml new file mode 100644 index 000000000..05049e2f2 --- /dev/null +++ b/include/views/default/cockpit2/frontend/drivers-orders.phtml @@ -0,0 +1,3 @@ +
+ +orders \ No newline at end of file diff --git a/include/views/default/cockpit2/frontend/drivers-shifts.phtml b/include/views/default/cockpit2/frontend/drivers-shifts.phtml new file mode 100644 index 000000000..0de16e0b1 --- /dev/null +++ b/include/views/default/cockpit2/frontend/drivers-shifts.phtml @@ -0,0 +1,4 @@ +
+ + +shifts \ No newline at end of file diff --git a/include/views/default/cockpit2/layout/html.body.phtml b/include/views/default/cockpit2/layout/html.body.phtml index bffdc3a8d..207e143b4 100644 --- a/include/views/default/cockpit2/layout/html.body.phtml +++ b/include/views/default/cockpit2/layout/html.body.phtml @@ -2,6 +2,23 @@
    +
  • + + + + + +
    Orders
    +
  • +
  • + + + + + +
    Shifts
    +
  • + @@ -66,10 +83,11 @@
    + */ ?>
  • - +
    Sign Out
    diff --git a/www/assets/cockpit/js/cockpit.js b/www/assets/cockpit/js/cockpit.js index 724d92ab8..a3699cfe7 100644 --- a/www/assets/cockpit/js/cockpit.js +++ b/www/assets/cockpit/js/cockpit.js @@ -41,6 +41,16 @@ NGApp.config(function($compileProvider){ NGApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider, RestaurantsService) { $routeProvider + .when('/drivers/orders', { + action: 'drivers-orders', + controller: 'DriversOrdersCtrl', + templateUrl: 'assets/view/drivers-orders.html' + }) + .when('/drivers/shifts', { + action: 'drivers-shifts', + controller: 'DriversShiftsCtrl', + templateUrl: 'assets/view/drivers-shifts.html' + }) .otherwise({ action: 'home', controller: 'DefaultCtrl', @@ -69,7 +79,7 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams, $rootScope.$on('userAuth', function(e, data) { $rootScope.$safeApply(function($scope) { App.snap.close(); - $rootScope.reload(); + $rootScope.reload(); }); }); @@ -117,6 +127,7 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams, $scope.$on('$routeChangeSuccess', function ($currentRoute, $previousRoute) { // Store the actual page MainNavigationService.page = $route.current.action; + console.log($route.current.action); App.rootScope.current = MainNavigationService.page; App.track('page', $route.current.action); diff --git a/www/assets/cockpit/js/controllers.js b/www/assets/cockpit/js/controllers.js index a48878e31..a1eb4d8f9 100644 --- a/www/assets/cockpit/js/controllers.js +++ b/www/assets/cockpit/js/controllers.js @@ -1,13 +1,15 @@ -NGApp.controller('DefaultCtrl', function ($scope, $http, $location) { +NGApp.controller('DefaultCtrl', function ($scope, $http, $location, MainNavigationService) { + MainNavigationService.link('/drivers/orders'); +}); + +NGApp.controller('MainHeaderCtrl', function ( $scope, $rootScope) { }); -NGApp.controller( 'MainHeaderCtrl', function ( $scope, $rootScope) { - -}); - -NGApp.controller( 'SideMenuCtrl', function () { - +NGApp.controller('SideMenuCtrl', function ($scope) { + $scope.setupPermissions = function() { + + } }); NGApp.controller('LoginCtrl', function($scope, AccountService) { @@ -18,4 +20,13 @@ NGApp.controller('LoginCtrl', function($scope, AccountService) { // }) }); } +}); + + +NGApp.controller('DriversOrdersCtrl', function ($scope, $rootScope) { + +}); + +NGApp.controller('DriversShiftsCtrl', function ($scope, $rootScope) { + }); \ No newline at end of file diff --git a/www/assets/cockpit/js/service.account.js b/www/assets/cockpit/js/service.account.js index 4dcadb986..cba242e72 100644 --- a/www/assets/cockpit/js/service.account.js +++ b/www/assets/cockpit/js/service.account.js @@ -1,5 +1,8 @@ NGApp.factory('AccountService', function($http, $rootScope) { - var service = {}; + var service = { + permissions: {}, + user: null + }; service.checkUser = function() { service.user = App.config.user; @@ -29,6 +32,14 @@ NGApp.factory('AccountService', function($http, $rootScope) { $rootScope.$broadcast('userAuth'); }) }; + + $rootScope.$on('userAuth', function(e, data) { + if (service.user.id_admin) { + + } else { + + } + }); return service; }); \ No newline at end of file diff --git a/www/assets/cockpit/scss/cockpit.scss b/www/assets/cockpit/scss/cockpit.scss index d88d1291f..8603aee22 100644 --- a/www/assets/cockpit/scss/cockpit.scss +++ b/www/assets/cockpit/scss/cockpit.scss @@ -370,53 +370,49 @@ p { margin:0; list-style-type:none; } - .snap-drawer li:first-child { - border-top:1px solid rgba(0,0,0,0.1); + .snap-drawer li.nav-active .side-menu-wrap { + background: $green; + color: #fff; } .snap-drawer li { display:block; - border-bottom:1px solid rgba(0,0,0,0.1); padding:8px 0 2px 0; text-decoration:none; color:$navLinkColor; text-indent:20px; cursor: pointer; } - .snap-drawer li.nav-active:before { - display: block; - height: 38px; - float: left; - margin-top: -8px; - width: 4px; - content: " "; - background: #f78155; - position: absolute; - } - .snap-drawer p { - opacity:0.5; - padding:15px; - font-size:12px; - } @-moz-document url-prefix() { .snap-content { transform:none; } } .snap-drawer .fa { - font-size:25px; + font-size: 15px; } .side-menu-wrap { height: 28px; - } - .side-menu-wrap { - margin-left: -20px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 249px; + margin-left: 8px; } .side-menu-label { - margin-top: -10px; vertical-align: top; line-height: 1.6em; - margin-bottom: 20px; font-size: 14px; + font-family: Ruda, Open Sans, Helvetica, Arial, sans-serif; + } + + .side-menu-icon { + line-height: 2.2em; + width: 40px; + margin-left: -20px; + } + + .side-menu-label, .side-menu-icon { + padding: 12px 0 10px 0; } } @@ -443,9 +439,6 @@ p { height: 1px; } -.side-menu-icon { - width: 70px; -} .no-init .hide-before-init { display: none !important; From 66d474c0f40523db21d9e30a64f8fc8a4eb0f689 Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 25 Apr 2014 15:00:18 -0700 Subject: [PATCH 02/27] cockpit 3.0 progress --- .../cockpit2/frontend/drivers-orders.phtml | 7 ++++- .../default/cockpit2/layout/html.body.phtml | 16 ++++++++++ www/assets/cockpit/js/cockpit.js | 9 +++--- www/assets/cockpit/scss/cockpit.scss | 31 +++++++++++++++++-- 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/include/views/default/cockpit2/frontend/drivers-orders.phtml b/include/views/default/cockpit2/frontend/drivers-orders.phtml index 05049e2f2..b7aa666a4 100644 --- a/include/views/default/cockpit2/frontend/drivers-orders.phtml +++ b/include/views/default/cockpit2/frontend/drivers-orders.phtml @@ -1,3 +1,8 @@
    -orders \ No newline at end of file +
    +
    + In order to receive payment for orders that you deliver, you MUST confirm all orders that you've delivered. + Make sure your orders are confirmed and delivered! +
    +
    diff --git a/include/views/default/cockpit2/layout/html.body.phtml b/include/views/default/cockpit2/layout/html.body.phtml index 207e143b4..de8820bb6 100644 --- a/include/views/default/cockpit2/layout/html.body.phtml +++ b/include/views/default/cockpit2/layout/html.body.phtml @@ -107,8 +107,24 @@ + +
    +
    + +
    +
    + +
    + + +
    + */ ?> +
+ +
diff --git a/www/assets/cockpit/js/cockpit.js b/www/assets/cockpit/js/cockpit.js index a3699cfe7..7611cdede 100644 --- a/www/assets/cockpit/js/cockpit.js +++ b/www/assets/cockpit/js/cockpit.js @@ -201,11 +201,12 @@ App.go = function( url, transition ){ } }; -App.toggleMenu = function() { - if (App.snap.state().state == 'left') { +App.toggleMenu = function(side) { + side = side || 'left'; + if (App.snap.state().state == side) { App.snap.close(); } else { - App.snap.open('left'); + App.snap.open(side); } }; @@ -325,7 +326,7 @@ App.init = function(config) { element: document.getElementById('snap-content'), menu: document.getElementById('side-menu'), menuDragDistance: 95, - disable: 'right' + disable: '' }); var snapperCheck = function() { diff --git a/www/assets/cockpit/scss/cockpit.scss b/www/assets/cockpit/scss/cockpit.scss index 8603aee22..e7fc4cb96 100644 --- a/www/assets/cockpit/scss/cockpit.scss +++ b/www/assets/cockpit/scss/cockpit.scss @@ -235,7 +235,7 @@ p { font-size: 12px; } .top-pad { - height: 90px; + height: 67px; } } @media(max-width:499px) { @@ -253,7 +253,7 @@ p { margin: 3px 10px 0 0; } .top-pad { - height: 71px; + height: 58px; } } .divider { @@ -612,7 +612,7 @@ input { margin-bottom: 1em; border-radius: 4px; font-size: 1.2em; - line-height: 1.4em; + line-height: 1.45em; padding: .7em .9em .5em .9em; } @@ -623,3 +623,28 @@ input { .dialog-message-success { background: #77c675; } + + +.notifications { + float: right; + margin: 2px 10px 0 0; +} + +.notifications .notification { + border: 1px solid #666666; + border-radius: 4px; + height: 27px; + width: 27px; + color: #666666; + font-size: 16px; + overflow: hidden; + line-height: 1.7em; + text-align: center; + float: left; + margin-right: 9px; + cursor: pointer; +} + +.notifications .notification:last-child { + margin-right: 1px; +} \ No newline at end of file From 3f7e3399411e31f5282399be3c133cea104d8ac4 Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 25 Apr 2014 15:28:02 -0700 Subject: [PATCH 03/27] added ability to have a right side menu --- .../default/cockpit2/layout/html.body.phtml | 7 +++- www/assets/cockpit/js/cockpit.js | 2 +- www/assets/cockpit/scss/cockpit.scss | 6 +++- www/assets/js/app.js | 2 +- www/assets/js/snap.js | 32 +++++++++++++++---- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/include/views/default/cockpit2/layout/html.body.phtml b/include/views/default/cockpit2/layout/html.body.phtml index de8820bb6..5f62b40dc 100644 --- a/include/views/default/cockpit2/layout/html.body.phtml +++ b/include/views/default/cockpit2/layout/html.body.phtml @@ -95,7 +95,12 @@ -
+
+
+

We will soon have a chat feature that goes to support here

+
+ +
diff --git a/www/assets/cockpit/js/cockpit.js b/www/assets/cockpit/js/cockpit.js index 7611cdede..4d4e1436c 100644 --- a/www/assets/cockpit/js/cockpit.js +++ b/www/assets/cockpit/js/cockpit.js @@ -324,7 +324,7 @@ App.init = function(config) { App.snap = new Snap({ element: document.getElementById('snap-content'), - menu: document.getElementById('side-menu'), + menu: $('#side-menu, #side-menu-right'), menuDragDistance: 95, disable: '' }); diff --git a/www/assets/cockpit/scss/cockpit.scss b/www/assets/cockpit/scss/cockpit.scss index e7fc4cb96..cc1c1575b 100644 --- a/www/assets/cockpit/scss/cockpit.scss +++ b/www/assets/cockpit/scss/cockpit.scss @@ -353,10 +353,14 @@ p { height:auto; overflow:hidden; } - .snap-drawer-left, .snap-drawer-right { + .snap-drawer-left { left:0; z-index:1; } + .snap-drawer-right { + right: 0; + z-index:1; + } .snapjs-left .snap-drawer-right, .snapjs-right .snap-drawer-left { display: none; diff --git a/www/assets/js/app.js b/www/assets/js/app.js index bcbdcd64b..59524e6bc 100644 --- a/www/assets/js/app.js +++ b/www/assets/js/app.js @@ -736,7 +736,7 @@ App.init = function(config) { App.snap = new Snap({ element: document.getElementById('snap-content'), - menu: document.getElementById('side-menu'), + menu: $('#side-menu'), menuDragDistance: 95, disable: 'right' }); diff --git a/www/assets/js/snap.js b/www/assets/js/snap.js index 2958b3c09..265968c66 100644 --- a/www/assets/js/snap.js +++ b/www/assets/js/snap.js @@ -186,7 +186,9 @@ settings.element.style[cache.vendor+'Transition'] = ''; // paralax menu if (settings.menu) { - settings.menu.style[cache.vendor+'Transition'] = ''; + settings.menu.each(function() { + this.style[cache.vendor+'Transition'] = ''; + }); } cache.translation = action.translate.get.matrix(4); @@ -214,7 +216,9 @@ // paralax menu if (settings.menu) { - settings.menu.style[cache.vendor+'Transition'] = 'all ' + settings.transitionSpeed + 's ' + settings.easing; + settings.menu.each(function() { + this.style[cache.vendor+'Transition'] = 'all ' + settings.transitionSpeed + 's ' + settings.easing; + }); } cache.animatingInterval = setInterval(function() { @@ -262,10 +266,22 @@ // paralax menu if (settings.menu) { - var hideDistance = settings.menuDragDistance; - var nn = ((n / settings.maxPosition) * hideDistance) - hideDistance; - var theSideTranslate = 'translate3d(' + nn + 'px, 0,0)'; - settings.menu.style[cache.vendor+'Transform'] = theSideTranslate; + var getTranslate = function(dir) { + var hideDistance = settings.menuDragDistance; + if (dir == 'left') { + var dirDistance = -hideDistance; + } else { + var dirDistance = hideDistance; + } + var nn = ((n / settings.maxPosition) * hideDistance) + dirDistance; + var theSideTranslate = 'translate3d(' + nn + 'px, 0,0)'; + return theSideTranslate; + }; + settings.menu.get(0).style[cache.vendor+'Transform'] = getTranslate('left'); + if (settings.menu.get(1)) { + settings.menu.get(1).style[cache.vendor+'Transform'] = getTranslate('right'); + } + } } else { @@ -321,7 +337,9 @@ utils.dispatchEvent('start'); settings.element.style[cache.vendor+'Transition'] = ''; if (settings.menu) { - settings.menu.style[cache.vendor+'Transition'] = ''; + settings.menu.each(function() { + this.style[cache.vendor+'Transition'] = ''; + }); } cache.isDragging = true; cache.hasIntent = null; From a5117c0b1466663fe83184e222c2f56b2d2dc962 Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 25 Apr 2014 23:42:55 -0700 Subject: [PATCH 04/27] fixed issues with server var --- include/library/Crunchbutton/App.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/library/Crunchbutton/App.php b/include/library/Crunchbutton/App.php index 1ae885d19..d5f7247dd 100755 --- a/include/library/Crunchbutton/App.php +++ b/include/library/Crunchbutton/App.php @@ -110,6 +110,11 @@ class Crunchbutton_App extends Cana_App { $_SERVER['SERVER_NAME'] = '_DOMAIN_'; $host_callback = 'staging.crunchr.co'; break; + case '/Users/arzynik/Sites/crunchbutton/include/library/Crunchbutton': + $params['env'] = 'local'; + $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'] = 'crunchbutton.localhost'; + $host_callback = 'crunchbutton.localhost'; + break; default: if (getenv('TRAVIS')) { $params['env'] = 'travis'; @@ -182,13 +187,11 @@ class Crunchbutton_App extends Cana_App { $config = $this->config(); $config->site = Crunchbutton_Site::byDomain(); - - if ($config->site->name == 'redirect' && $config->site->theme) { header('Location: '.$config->site->theme.$_SERVER['REQUEST_URI']); exit; } - + if ($config->site->name == 'Cockpit' || $config->site->name == 'Cockpit2') { array_unshift($GLOBALS['config']['libraries'], 'Cockpit'); } From e11564310aaec37e5bb8545dae890855f8aaed6a Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 25 Apr 2014 23:43:07 -0700 Subject: [PATCH 05/27] added backup script --- cli/dbbackup.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 cli/dbbackup.php diff --git a/cli/dbbackup.php b/cli/dbbackup.php new file mode 100755 index 000000000..50b7f128c --- /dev/null +++ b/cli/dbbackup.php @@ -0,0 +1,30 @@ +#!/usr/bin/php +db->{c::app()->env()}; + +$cmd[] = 'rm '.$file; +$cmd[] = $dump.' -q -u '.$connect->user.' -p'.$connect->pass.' '.$connect->db.' > '.$file; +$cmd[] = 'sed "s/\`devin\`@\`%\`/\`root\`@\`localhost\`/g" '.$file.' > '.$file.'tmp'; +$cmd[] = 'mv '.$file.'tmp '.$file; + +foreach ($cmd as $c) { + echo $c; + exec($c); +} + From 95458576b69494444f4e4cda111ed762680ef02a Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 25 Apr 2014 23:43:44 -0700 Subject: [PATCH 06/27] updated side menu --- include/views/default/cockpit2/layout/html.body.phtml | 7 ++++--- www/assets/cockpit/js/cockpit.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/views/default/cockpit2/layout/html.body.phtml b/include/views/default/cockpit2/layout/html.body.phtml index 5f62b40dc..44e22ae2e 100644 --- a/include/views/default/cockpit2/layout/html.body.phtml +++ b/include/views/default/cockpit2/layout/html.body.phtml @@ -97,7 +97,8 @@
-

We will soon have a chat feature that goes to support here

+

We will soon have a chat feature that goes to support here. Until then, text us at:

(646) 783-1444 +

@@ -110,8 +111,8 @@