This commit is contained in:
Daniel Camargo 2014-04-17 09:29:37 -03:00
commit eaad62fc65
21 changed files with 11076 additions and 13 deletions

View File

@ -0,0 +1,18 @@
<?
class Controller_assets extends Crunchbutton_Controller_AssetBundle {
public function init() {
$pages = c::pages();
array_shift($pages);
$file = array_pop($pages);
$path = implode('/',$pages);
if (preg_match('/\.scss$/i',$_SERVER['REDIRECT_URL'])) {
$path = c::config()->dirs->www.'assets/'.$path.'/';
$file = $file.'.scss';
Scss::serve($path.$file);
}
}
}

View File

@ -2,10 +2,11 @@
class Controller_api_twilio_phone extends Crunchbutton_Controller_Rest {
public function init() {
$_REQUEST['forward'] = preg_replace('/[^0-9]/','',$_REQUEST['forward']);
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"
.'<Response>'
.'<Dial timeout="10" record="false">800-351-4161</Dial>'
.'<Dial timeout="10" record="false">'.($_REQUEST['forward'] ? $_REQUEST['forward'] : '800-351-4161').'</Dial>'
.'</Response>';
exit;

View File

@ -2,19 +2,9 @@
class Controller_assets_scss extends Crunchbutton_Controller_AssetBundle {
public function init() {
$this->cacheServe('crunchr-file-scss');
}
public function getData() {
$path = $file = c::config()->dirs->www.'assets/scss/';
$path = c::config()->dirs->www.'assets/scss/';
$file = c::getPagePiece(2).'.scss';
$data = Scss::compile($path.$file);
$data = preg_replace('/\t|\n/','',$data);
$mtime = time();
return ['mtime' => $mtime, 'data' => $data];
Scss::serve($path.$file);
}
}

View File

@ -17,4 +17,22 @@ class Crunchbutton_Scss extends Cana_Model {
return $data;
}
public static function serve($file) {
$data = self::compile($file);
$mtime = filemtime($file);
header('HTTP/1.1 200 OK');
header('Date: '.date('r'));
header('Last-Modified: '.gmdate('D, d M Y H:i:s',$mtime).' GMT');
header('Accept-Ranges: bytes');
header('Content-Length: '.strlen($data));
header('Content-type: text/css');
header('Vary: Accept-Encoding');
header('Cache-Control: max-age=290304000, public');
echo $data;
exit;
}
}

View File

@ -0,0 +1,8 @@
<link rel="stylesheet" type="text/css" href="/assets/cockpit/scss/cockpit.scss?v=<?=Cana_Util::gitVersion()?>">
<? /*
<link rel="stylesheet" type="text/css" href="/assets/cockpit/css/bootstrap.css?v=<?=Cana_Util::gitVersion()?>">
<link rel="stylesheet" type="text/css" href="/assets/cockpit/css/dashio.css?v=<?=Cana_Util::gitVersion()?>">
<link rel="stylesheet" type="text/css" href="/assets/cockpit/css/dashio.responsive.css?v=<?=Cana_Util::gitVersion()?>">
*/?>

View File

@ -0,0 +1,39 @@
<script src="/assets/js/snap.js"></script>
<script src="/assets/js/date.js"></script>
<script src="/assets/js/jquery.totalstorage.js"></script>
<script src="/assets/js/jquery.cookie.js"></script>
<script src="/assets/js/jquery.browser.mobile.js"></script>
<script src="/assets/js/jquery.magnific-popup.js"></script>
<script src="/assets/js/jquery.easing.js"></script>
<script src="/assets/js/jquery.scrollspy.js"></script>
<script src="/assets/js/fastclick.js"></script>
<script src="/assets/js/spin.js"></script>
<script src="/assets/js/ladda.js"></script>
<script src="/assets/js/jquery.autosize-min.js"></script>
<script src="/assets/js/howler-min.js"></script>
<? /* @sky-loader <script src="/assets/js/sky-loader_edgePreload.js"></script> */ ?>
<?
if (!$scripts) {
$scripts = ['cockpit'];
}
?>
<? foreach ($scripts as $script) : ?>
<script src="/assets/cockpit/js/<?=$script?>.js?v=<?=Cana_Util::gitVersion()?>"></script>
<? endforeach ; ?>
<!-- AngularJS Controllers -->
<script src="/assets/cockpit/js/controllers.js?v=<?=Cana_Util::gitVersion()?>"></script>
<!-- AngularJS Filters -->
<!-- AngularJS Directives -->
<!-- AngularJS Services -->
<script src="/assets/cockpit/js/service.navigation.js?v=<?=Cana_Util::gitVersion()?>"></script>
<script src="/assets/cockpit/js/service.account.js?v=<?=Cana_Util::gitVersion()?>"></script>

View File

@ -0,0 +1,5 @@
<div class="main-content-readable home-greeting">
<div class="home-welcome">
<h1>Finding you the best food...</h1>
</div>
</div>

View File

@ -0,0 +1 @@
<?=$this->display('layout/html')?>

View File

@ -0,0 +1,105 @@
<div class="snap-drawers static-nav-viewport loggedout-hideable" ng-controller="SideMenuCtrl">
<div class="snap-drawer snap-drawer-left side-menu" id="side-menu">
<ul>
<li ng-click="navigation.link('/splash')" ng-class="{'nav-active': (navigation.page == 'splash')}">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-cockpit"></i></td>
<td class="side-menu-label">Dashboard</a></td>
</tr>
</table>
</li>
<li ng-click="navigation.link('/food-delivery')" ng-class="{'nav-active': (navigation.page == 'restaurants')}">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-cutlery"></i></td>
<td class="side-menu-label">Orders</a></td>
</tr>
</table>
</li>
<li ng-click="navigation.link('/orders')" ng-class="{'nav-active': (navigation.page == 'orders')}">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-truck"></i></td>
<td class="side-menu-label">Restaurants</a></td>
</tr>
</table>
</li>
<li ng-click="navigation.link('/location')" ng-class="{'nav-active': (navigation.page == 'location')}">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-map-marker"></i></td>
<td class="side-menu-label">Communities</a></td>
</tr>
</table>
</li>
<li ng-click="navigation.link('/help')" ng-class="{'nav-active': (navigation.page == 'help')}">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-heart"></i></td>
<td class="side-menu-label">Customers</a></td>
</tr>
</table>
</li>
<li ng-click="navigation.signin()">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-sign-in"></i></td>
<td class="side-menu-label">Drivers</a></td>
</tr>
</table>
</li>
<li ng-click="signout.signout()">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-sign-out"></i></td>
<td class="side-menu-label">Reports</a></td>
</tr>
</table>
</li>
<li ng-click="signout.signout()">
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
<tr>
<td class="side-menu-icon"><i class="fa fa-sign-out"></i></td>
<td class="side-menu-label">Tools</a></td>
</tr>
</table>
</li>
</ul>
</div>
<div class="snap-drawer snap-drawer-right side-menu"></div>
</div>
<div class="wrapper static-nav-viewport loggedout-hideable">
<div id="snap-content" class="snap-content">
<div class="navs fixed" data-position="fixed" ng-controller="MainHeaderCtrl">
<div class="nav nav-top">
<div class="content">
<div title="Menu" class="menu side" ng-click="navigation.menu()"></div>
<div title="Back" class="nav-back hide-before-init" ng-click="back()"></div>
<div title="Crunchbutton" class="logo animated-resize" ng-click="navigation.home()"></div>
</div>
</div>
</div>
<div class="snap-content-inner bg" ng-scroll-position>
<div class="content" ng-scroll-spy>
<div ng-view id="ng-view" ng-class="animationClass"><?=$this->content?></div>
</div>
<div class="divider"></div>
</div>
</div>
<div class="divider"></div>
</div>
<div id="fb-root"></div>

View File

@ -0,0 +1,20 @@
<?=$this->display('layout/html.top')?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.5/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.5/angular-route.min.js"></script>
<!-- Payment stuff -->
<script type="text/javascript" src="//js.stripe.com/v2/"></script>
<script src="//js.balancedpayments.com/v1/balanced.js"></script>
<? if (c::config()->bundle) : ?>
<script src="/assets/js/bundle.js?v=<?=Cana_Util::gitVersion()?>&s=app"></script>
<? else : ?>
<?=$this->display('bundle/js', ['set' => ['scripts' => ['cockpit']]])?>
<? endif ; ?>
<?=$this->display('layout/html.bottom')?>
<script src="//maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>

View File

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<title><?=$this->title ? $this->title : 'Crunchbutton'?></title>
<meta name="fragment" content="!" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" href="/assets/images/micro/appicon.png">
<?=$this->display('layout/html.servertime')?>
<? if (c::config()->bundle) : ?>
<link rel="stylesheet" type="text/css" href="/assets/css/bundle.css?v=<?=Cana_Util::gitVersion()?>">
<? else : ?>
<?=$this->display('bundle/css')?>
<? endif ; ?>
<link rel="shortcut icon" href="/assets/images/micro/appicon.png">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.2/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet" type="text/css">
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<?=$this->display('layout/html.templates')?>

View File

@ -0,0 +1,5 @@
<? foreach (Crunchbutton_Util::frontendTemplates(false) as $file) : ?>
<script type="text/ng-template" id="assets/view/<?=$file?>.html">
<?=$this->render('frontend/'.$file, ['filter' => false])?>
</script>
<? endforeach; ?>

5785
www/assets/cockpit/css/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,486 @@
@media (min-width: 980px) {
/*-----*/
.custom-bar-chart {
margin-bottom: 40px;
}
}
@media (min-width: 768px) and (max-width: 979px) {
.mail-box .sm-side {
width: 30%;
}
.mail-box .lg-side {
width: 70%;
}
/*-----*/
.custom-bar-chart {
margin-bottom: 40px;
}
/*chat room*/
.chat-room aside {
display: block;
}
.chat-room .left-side, .chat-room .mid-side, .chat-room .right-side, .chat-room .left-side footer {
width: 100%;
}
.chat-room .left-side footer {
position: relative;
}
ul.chat-user {
margin-bottom: 20px;
}
.chat-room .left-side , .chat-room .mid-side{
margin-bottom: 10px;
}
.chat-room .left-side .user-head , .chat-room-head, .chat-room .right-side .user-head{
border-radius: 4px 4px 0 0;
-webit-border-radius: 4px 4px 0 0;
}
.chat-room .left-side footer {
border-radius: 0 0 4px 4px;
-webkit-border-radius: 0 0 4px 4px;
}
/**/
.chat-room .right-side .user-head {
float: left;
width: 100%;
}
.chat-room .mid-side footer {
position: relative;
float: left;
width: 100%;
border-right: 0;
}
.chat-txt {
width: 65%;
}
.chat-room .right-side footer {
width: 100%;
position: relative;
}
.chat-room .mid-side {
margin-bottom: 0!important;
}
}
@media (max-width: 768px) {
.header {
position: absolute;
}
/*sidebar*/
#sidebar {
height: auto;
overflow: hidden;
position: absolute;
width: 100%;
z-index: 1001;
}
/* body container */
#main-content {
margin: 0px!important;
position: none !important;
}
#sidebar > ul > li > a > span {
line-height: 35px;
}
#sidebar > ul > li {
margin: 0 10px 5px 10px;
}
#sidebar > ul > li > a {
height:35px;
line-height:35px;
padding: 0 10px;
text-align: left;
}
#sidebar > ul > li > a i{
/*display: none !important;*/
}
.mail-info, .mail-info:hover {
display: none !important;
}
#sidebar ul > li > a .arrow, #sidebar > ul > li > a .arrow.open {
margin-right: 10px;
margin-top: 15px;
}
#sidebar ul > li.active > a .arrow, #sidebar ul > li > a:hover .arrow, #sidebar ul > li > a:focus .arrow,
#sidebar > ul > li.active > a .arrow.open, #sidebar > ul > li > a:hover .arrow.open, #sidebar > ul > li > a:focus .arrow.open{
margin-top: 15px;
}
#sidebar > ul > li > a, #sidebar > ul > li > ul.sub > li {
width: 100%;
}
#sidebar > ul > li > ul.sub > li > a {
background: transparent !important ;
}
#sidebar > ul > li > ul.sub > li > a:hover {
}
/* sidebar */
#sidebar {
margin: 0px !important;
}
/* sidebar collabler */
#sidebar .btn-navbar.collapsed .arrow {
display: none;
}
#sidebar .btn-navbar .arrow {
position: absolute;
right: 35px;
width: 0;
height: 0;
top:48px;
border-bottom: 15px solid #282e36;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
}
/*---------*/
.modal-footer .btn {
margin-bottom: 0px !important;
}
.btn {
margin-bottom: 5px;
}
.mail-box aside {
display: block;
}
.mail-box .sm-side , .mail-box .lg-side{
width: 100% ;
}
/* full calendar fix */
.fc-header-right {
left:25px;
position: absolute;
}
.fc-header-left .fc-button {
margin: 0px !important;
top: -10px !important;
}
.fc-header-right .fc-button {
margin: 0px !important;
top: -50px !important;
}
.fc-state-active, .fc-state-active .fc-button-inner, .fc-state-hover, .fc-state-hover .fc-button-inner {
background: none !important;
color: #FFFFFF !important;
}
.fc-state-default, .fc-state-default .fc-button-inner {
background: none !important;
}
.fc-button {
border: none !important;
margin-right: 2px;
}
.fc-view {
top: 0px !important;
}
.fc-button .fc-button-inner {
margin: 0px !important;
padding: 2px !important;
border: none !important;
margin-right: 2px !important;
background-color: #fafafa !important;
background-image: -moz-linear-gradient(top, #fafafa, #efefef) !important;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fafafa), to(#efefef)) !important;
background-image: -webkit-linear-gradient(top, #fafafa, #efefef) !important;
background-image: -o-linear-gradient(top, #fafafa, #efefef) !important;
background-image: linear-gradient(to bottom, #fafafa, #efefef) !important;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fafafa', endColorstr='#efefef', GradientType=0) !important;
-webkit-box-shadow: 0 1px 0px rgba(255, 255, 255, .8) !important;
-moz-box-shadow: 0 1px 0px rgba(255, 255, 255, .8) !important;
box-shadow: 0 1px 0px rgba(255, 255, 255, .8) !important;
-webkit-border-radius: 3px !important;
-moz-border-radius: 3px !important;
border-radius: 3px !important;
color: #646464 !important;
border: 1px solid #ddd !important;
text-shadow: 0 1px 0px rgba(255, 255, 255, .6) !important;
text-align: center;
}
.fc-button.fc-state-disabled .fc-button-inner {
color: #bcbbbb !important;
}
.fc-button.fc-state-active .fc-button-inner {
background-color: #e5e4e4 !important;
background-image: -moz-linear-gradient(top, #e5e4e4, #dddcdc) !important;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#e5e4e4), to(#dddcdc)) !important;
background-image: -webkit-linear-gradient(top, #e5e4e4, #dddcdc) !important;
background-image: -o-linear-gradient(top, #e5e4e4, #dddcdc) !important;
background-image: linear-gradient(to bottom, #e5e4e4, #dddcdc) !important;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#e5e4e4', endColorstr='#dddcdc', GradientType=0) !important;
}
.fc-content {
margin-top: 50px;
}
.fc-header-title h2 {
line-height: 40px !important;
font-size: 12px !important;
}
.fc-header {
margin-bottom:0px !important;
}
/*--*/
/*.chart-position {*/
/*margin-top: 0px;*/
/*}*/
.timeline-desk .album a {
margin-bottom: 5px;
margin-right: 4px;
}
.stepy-titles li {
margin: 10px 3px;
}
.mail-option .btn {
margin-bottom: 0;
}
/*-----*/
.custom-bar-chart {
margin-bottom: 40px;
}
/*menu icon plus minus*/
.dcjq-icon {
top: 10px;
}
ul.sidebar-menu li ul.sub li a {
padding: 0;
}
/*---*/
.img-responsive {
width: 100%;
}
}
@media (max-width: 480px) {
.notify-row, .search, .dont-show , .inbox-head .sr-input, .inbox-head .sr-btn{
display: none;
}
.mail-box aside {
display: block;
}
.mail-box .sm-side , .mail-box .lg-side{
width: 100% ;
}
#top_menu .nav > li, ul.top-menu > li {
float: right;
}
.hidden-phone {
display: none !important;
}
.dataTables_filter {
float: left;
}
.dataTables_info {
margin-bottom: 10px;
}
.mail-option .btn {
margin-bottom: 0;
}
.mail-option .inbox-pagination {
margin-top: 10px;
float: left;
}
.chart-position {
margin-top: 0px;
}
.navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
background-color: #ccc;
border-color:#ccc ;
}
/*chat room*/
.chat-room aside {
display: block;
}
.chat-room .left-side, .chat-room .mid-side, .chat-room .right-side, .chat-room .left-side footer {
width: 100%;
}
.chat-room .left-side footer {
position: relative;
}
ul.chat-user {
margin-bottom: 20px;
}
.chat-room .left-side , .chat-room .mid-side{
margin-bottom: 10px;
}
.chat-room .left-side .user-head , .chat-room-head, .chat-room .right-side .user-head{
border-radius: 4px 4px 0 0;
-webit-border-radius: 4px 4px 0 0;
}
.chat-room .left-side footer {
border-radius: 0 0 4px 4px;
-webkit-border-radius: 0 0 4px 4px;
}
/**/
.chat-room .right-side .user-head {
width: 100%;
float: left;
}
.chat-room .mid-side footer {
position: relative;
float: left;
width: 100%;
border-right: 0;
}
.chat-txt {
width: 65%;
}
.chat-room .right-side footer {
width: 100%;
position: relative;
}
.chat-room .mid-side {
margin-bottom: 0!important;
}
}
@media (max-width:320px) {
.login-social-link a {
padding: 15px 17px !important;
}
.notify-row, .search, .dont-show, .inbox-head .sr-input, .inbox-head .sr-btn {
display: none;
}
.mail-box aside {
display: block ;
}
.mail-box .sm-side , .mail-box .lg-side{
width: 100% ;
}
#top_menu .nav > li, ul.top-menu > li {
float: right;
}
.hidden-phone {
display: none !important;
}
.dataTables_filter {
float: left;
}
.dataTables_info {
margin-bottom: 10px;
}
.mail-option .btn {
margin-bottom: 0;
}
.mail-option .inbox-pagination {
margin-top: 10px;
float: left;
}
.chart-position {
margin-top: 0px;
}
.lock-wrapper {
margin: 10% auto;
max-width: 310px;
}
.lock-input {
width: 82%;
}
.cmt-form {
display: inline-block;
width: 75%;
}
.chat-room .mid-side footer .btn-group {
display: none;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,537 @@
/**
*
* Crunchbutton
*
* @author: Devin Smith (http://devin.la)
* @date: 2012-06-20
*
*/
var App = {
service: '/api/',
logService: 'http://log.crunchbutton.com/api/',
server: '/',
imgServer: '/',
cached: {},
config: null,
_init: false,
localStorage: false,
isPhoneGap: document.location.protocol == 'file:',
useNativeAlert: false,
useNativeConfirm: true,
ajaxTimeout: 5000,
};
// enable localstorage on phonegap
App.localStorage = App.isPhoneGap;
App.NGinit = function() {
$('body').attr('ng-controller', 'AppController');
angular.bootstrap(document,['NGApp']);
if (App.config.env == 'live') {
$('.footer').addClass('footer-hide');
}
};
var NGApp = angular.module('NGApp', [ 'ngRoute'] );
NGApp.config(function($compileProvider){
$compileProvider.aHrefSanitizationWhitelist(/.*/);
});
NGApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider, RestaurantsService) {
$routeProvider
.otherwise({
action: 'home',
controller: 'DefaultCtrl',
templateUrl: 'assets/view/home.html'
})
;
// only use html5 enabled location stuff if its not in a phonegap container
$locationProvider.html5Mode(!App.isPhoneGap);
}]);
// global route change items
NGApp.controller('AppController', function ($scope, $route, $http, $routeParams, $rootScope, $location, $window, MainNavigationService, AccountService) {
// define external pointers
App.rootScope = $rootScope;
App.location = $location;
App.http = $http;
// define global services
$rootScope.navigation = MainNavigationService;
$rootScope.isPhoneGap = App.isPhoneGap;
$rootScope.server = App.server;
$rootScope.debug = function() {
return ( App.config && App.config.user && App.config.user.debug );
};
$rootScope.test = App.test;
$rootScope.cartScroll = function(permalink) {
//$('.snap-content-inner').scrollTop() + $('.cart-items').offset().top
var top = 130 - $('.navs').height() - 10;
var scroll = function() {
$('html, body, .snap-content-inner').animate({scrollTop: top}, 100, $.easing.easeInOutQuart ? 'easeInOutQuart' : null);
};
if ($rootScope.navigation.page != 'restaurant') {
$rootScope.scrollTop = top;
App.go('/food-delivery/' + permalink);
} else {
scroll();
}
};
$rootScope.$on('userAuth', function(e, data) {
$rootScope.$safeApply(function($scope) {
// @todo: remove double data
if (data) {
$rootScope.account.user = data;
App.config.user = data;
}
App.snap.close();
$rootScope.reload();
});
});
$rootScope.focus = function( selector ){
setTimeout(function(){
angular.element( selector ).focus();
}, 100);
}
$rootScope.blur = function( selector ){
setTimeout(function(){
angular.element( selector ).blur();
}, 100);
}
$rootScope.reload = function() {
$route.reload();
};
$rootScope.link = function(link) {
App.go.apply(arguments);
};
$rootScope.back = function() {
history.back();
};
$rootScope.closePopup = function() {
try {
$.magnificPopup.close();
} catch (e) {}
};
$rootScope.$safeApply = function(fn) {
var phase = this.$root.$$phase;
if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof(fn) === 'function')) {
this.$eval(fn);
}
} else {
this.$apply(fn);
}
};
$scope.$on('$routeChangeSuccess', function ($currentRoute, $previousRoute) {
// Store the actual page
MainNavigationService.page = $route.current.action;
App.rootScope.current = MainNavigationService.page;
App.track('page', $route.current.action);
$('body').removeClass(function (index, css) {
return (css.match (/\bpage-\S+/g) || []).join(' ');
}).addClass('page-' + MainNavigationService.page);
$('.nav-top').addClass('at-top');
App.scrollTop($rootScope.scrollTop);
$rootScope.scrollTop = 0;
});
// Make the window's size available to all scope
$rootScope.windowWidth = $window.outerWidth;
$rootScope.windowHeight = $window.outerHeight;
// Window resize event
angular.element( $window ).bind( 'resize',function(){
$rootScope.windowWidth = $window.outerWidth;
$rootScope.windowHeight = $window.outerHeight;
$rootScope.$apply( 'windowWidth' );
$rootScope.$apply( 'windowHeight' );
});
AccountService.checkUser();
});
App.alert = function( txt, title, useNativeAlert ) {
setTimeout(function() {
if (useNativeAlert && App.isPhoneGap) {
navigator.notification.alert(txt, null, title || 'Crunchbutton');
} else if ( useNativeAlert ) {
alert( txt );
} else {
App.rootScope.$broadcast('notificationAlert', title || 'Woops!', txt);
}
});
};
App.confirm = function(txt, title, fn, buttons) {
if (App.useNativeConfirm && App.isPhoneGap) {
return navigator.notification.confirm(txt, fn, title || 'Crunchbutton', buttons || 'Ok,Cancel' );
} else {
return confirm(txt);
}
};
App.connectionError = function() {
App.rootScope.$broadcast( 'connectionError' );
App.rootScope.$broadcast('notificationAlert', 'Connection Error', 'Sorry! We could not reach the server right now. Try again when your internet is back!');
};
App.go = function( url, transition ){
// Remove the animation from rootScope #2827 before start the new one
App.rootScope.animationClass = '';
if( App.isNarrowScreen() || App.transitionForDesktop ){
setTimeout( function(){
App.rootScope.animationClass = transition ? 'animation-' + transition : '';
App.rootScope.$safeApply();
// @todo: do some tests to figure out if we need this or not
// App.location.path(!App.isPhoneGap ? url : 'index.html#' + url);
App.location.path( url || '/' );
App.rootScope.$safeApply();
}, 10 );
} else {
App.location.path( url || '/' );
App.rootScope.$safeApply();
}
};
App.toggleMenu = function() {
if (App.snap.state().state == 'left') {
App.snap.close();
} else {
App.snap.open('left');
}
};
/*
App.setTop = function() {
$('html, body, .snap-content-inner').scrollTop(0);
setTimeout(function() {
$('html, body, .snap-content-inner').scrollTop(0);
},13);
$('#ng-view').css('-webkit-transform','translate3d(0,0,0)');
setTimeout(function() {
$('#ng-view').css('-webkit-transform','');
},1000);
};
*/
/**
* scroll to the top of the page
*/
App.scrollTop = function(top) {
setTimeout(function() {
if (!top) {
setTimeout(function() {
$('html, body, .snap-content-inner').scrollTop(0);
},10);
}
$('html, body, .snap-content-inner').animate({scrollTop: top || 0}, 10, $.easing.easeInOutQuart ? 'easeInOutQuart' : null);
},3);
};
/**
* Sends a tracking item to google, or to google ads if its an order
*/
App.track = function() {
if (App.config.env != 'live') {
return;
}
if (arguments[0] == 'Ordered') {
$('img.conversion').remove();
var i = $('<img class="conversion" src="https://www.googleadservices.com/pagead/conversion/996753959/?value=' + Math.floor(arguments[1].total) + '&amp;label=-oawCPHy2gMQp4Sl2wM&amp;guid=ON&amp;script=0&url=' + location.href + '">').appendTo($('body'));
}
if ( typeof( ga ) == 'function' ) {
ga('send', 'event', 'app', arguments[0], arguments[1]);
}
};
/**
* controls the busy state of the app
* @sky-loader
*/
App.busy = {
_busy: false,
_timer: null,
_maxExec: 25000,
stage: function() {
$('#Stage').height('100%').width('100%');
return AdobeEdge.getComposition('EDGE-977700350').getStage();
},
isBusy: function() {
return $('.app-busy').length ? true : false;
return App.busy._busy;
},
makeBusy: function() {
if (App.busy._timer) {
clearTimeout(App.busy._timer);
}
App.busy._timer = setTimeout(function() {
App.alert('The app timed out processing your order. We can not determine if the order was placed or not. Please check your previous orders. Sorry!');
App.busy.unBusy();
}, App.busy._maxExec);
return $('body').append($('<div class="app-busy"></div>').append($('<div class="app-busy-loader"><div class="app-busy-loader-icon"></div></div>')));
App.busy._busy = true;
$('.order-sky-loader').addClass('play');
App.busy.stage().play(0);
},
unBusy: function() {
clearTimeout(App.busy._timer);
return $('.app-busy').remove();
App.busy._busy = false;
$('.order-sky-loader').removeClass('play');
App.busy.stage().stop();
}
};
/**
* stuff for testing
*/
App.test = {
card: function() {
angular.element( 'html' ).injector().get( 'OrderService' )._test();
},
logout: function() {
$.getJSON(App.service + 'logout',function(){ location.reload()});
},
cart: function() {
App.alert(JSON.stringify(App.cart.items));
},
clearloc: function() {
$.totalStorage('community',null);
$.totalStorage('location_lat',null);
$.totalStorage('location_lon',null);
location.href = '/';
},
reload: function() {
location.reload();
},
location: function(){
var position = angular.element( 'html' ).injector().get( 'PositionsService' );
var locs = position.locs;
for( x in locs ){
var values = [];
$.each( locs[ x ]._properties, function( key, value ) {
values.push( key );
values.push( ': ' );
values.push( ( value || '-' ) );
values.push( ' | ' );
if( key == 'results' ){
$.each( value, function( position, result ) {
console.log('result: ' + position,result);
});
}
});
console.log('Position: ' + x, values.join( '' ) );
}
}
};
App.processConfig = function(json, user) {
if (user && !json) {
App.config.user = user;
} else {
App.config = json;
}
};
/**
* global event binding and init
*/
App.init = function(config) {
// ensure this function cant be called twice. can crash the browser if it does.
if (App._init) {
return;
}
App._init = true;
$(document).on('touchmove', ($('.is-ui2').get(0) ? '.mfp-wrap' : '.snap-drawers, .mfp-wrap, .support-container'), function(e) {
e.preventDefault();
e.stopPropagation();
});
// replace normal click events for mobile browsers
FastClick.attach(document.body);
// add ios7 styles for nav bar and page height
if (App.isPhoneGap && !App.iOS7()) {
$('body').removeClass('ios7');
}
$('body').removeClass('no-init');
// add the side swipe menu for mobile view
if (typeof Snap !== 'undefined') {
App.snap = new Snap({
element: document.getElementById('snap-content'),
menu: document.getElementById('side-menu'),
menuDragDistance: 95,
disable: 'right'
});
var snapperCheck = function() {
if ($(window).width() <= 768) {
App.snap.enable();
} else {
App.snap.close();
App.snap.disable();
}
};
snapperCheck();
$(window).resize(function() {
snapperCheck();
});
}
// init the storage type. cookie, or localstorage if phonegap
$.totalStorage.ls(App.localStorage);
// phonegap
if (typeof CB !== 'undefined' && CB.config) {
App.config = CB.config;
CB.config = null;
}
// process the config, and startup angular
App.processConfig(config || App.config);
App.NGinit();
// Init the processor
var processor = ( App.config.processor && App.config.processor.type ) ? App.config.processor.type : false;
switch( processor ){
case 'stripe':
Stripe.setPublishableKey( App.config.processor.stripe );
break;
case 'balanced':
balanced.init( App.config.processor.balanced );
break;
default:
console.log( 'Processor error::', App.config.processor );
break;
}
window.addEventListener( 'pageshow', function(){
// the first pageshow should be ignored
if( App._firstPageShowHasHappened ){
dateTime.reload();
}
App._firstPageShowHasHappened = true;
}, false );
// window.addEventListener( 'pagehide', function(){}, false );
$(window).trigger('nginit');
/*
if (!App.isPhoneGap) {
$(document).mousemove(function(e) {
if ($('.parallax-bg').length) {
console.log(e.pageX, e.pageY);
}
});
}
*/
};
/**
* dialog functions
*/
App.dialog = {
show: function() {
if (arguments[1]) {
// its a title and message
var src = '<div class="zoom-anim-dialog small-container">' +
'<h1>' + arguments[0] + '</h1>' +
'<div class="small-container-content">' + arguments[1] + '</div>' +
'</div>';
} else if ($(arguments[0]).length) {
// its a dom selector
var src = $(arguments[0]);
// fix to prevent 2 dialogs from ever appearing. only show the second. #2919
if (src.length > 1) {
for (var x = 0; x < src.length - 1; x++) {
src.get(x).remove();
}
var src = $(arguments[0]);
}
} else {
console.log('ERROR WITH DIALOG',arguments);
return;
}
$.magnificPopup.open({
items: {
src: src,
type: 'inline'
},
fixedContentPos: true,
fixedBgPos: true,
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
overflowY: 'auto',
mainClass: 'my-mfp-zoom-in',
callbacks: {
open: function() {
setTimeout(function() {
if( App.iOS() ){
// #1774
var width = angular.element('.mfp-bg').width();
angular.element('.mfp-bg').width( width + 10 );
}
},1);
},
close: function() {
$('.wrapper').removeClass('dialog-open-effect-a dialog-open-effect-b dialog-open-effect-c dialog-open-effect-d');
App.applyIOSPositionFix();
App.rootScope.$broadcast( 'modalClosed' );
}
}
//my-mfp-zoom-in
});
},
isOpen : function(){
return $.magnificPopup && $.magnificPopup.instance && $.magnificPopup.instance.isOpen;
}
};

View File

@ -0,0 +1,11 @@
NGApp.controller('DefaultCtrl', function ($scope, $http, $location) {
});
NGApp.controller( 'MainHeaderCtrl', function ( $scope, $rootScope) {
});
NGApp.controller( 'SideMenuCtrl', function () {
});

View File

@ -0,0 +1,3 @@
NGApp.factory('AccountService', function($http, $rootScope) {
});

View File

@ -0,0 +1,57 @@
// MainHeaderService service
NGApp.factory( 'MainNavigationService', function( $http, $location, $rootScope, $route){
// This variable will store the animation type.
$rootScope.animationClass = '';
var service = {
page : '',
buttons : {
location: false,
menu: true
}
};
service.menu = App.toggleMenu;
service.getFood = function( cartItems ){
if( service.page == 'restaurant' &&
cartItems &&
service.restaurant && service.restaurant && service.restaurant._open &&
!App.rootScope.notificationBarStatus ){
angular.element( '.button-bottom-wrapper' ).addClass( 'button-bottom-show' );
} else {
angular.element( '.button-bottom-wrapper' ).removeClass( 'button-bottom-show' );
}
}
service.home = function() {
if (App.isPhoneGap && cordova) {
$('html, body, .snap-content-inner').animate({scrollTop: 0}, 200, $.easing.easeInOutQuart ? 'easeInOutQuart' : null);
} else if (App.isMobile()) {
service.menu();
} else {
service.link();
}
}
service.goToRestaurants = function(){
return service.link( RestaurantsService.permalink );
}
/* the transitions type could be push, fade, pop or none */
service.link = function( path, transition ){
if( App.isNarrowScreen() || App.transitionForDesktop ){
App.rootScope.animationClass = transition ? 'animation-' + transition : '';
}
$location.path( path || '/' );
App.snap.close();
}
service.signin = function(){
service.modal.signinOpen();
}
return service;
});

View File

@ -0,0 +1,605 @@
$navColor: #202228;
$sideBg: #2f323a;
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
body {
line-height: 1;
font-size: 10px;
color: #312f38;
letter-spacing: .03em;
}
body, input, textarea, button {
font-family: "Open Sans", "Droid Sans", "Helvetica", "Arial", sans-serif;
}
body, .bg {
background: #fffef8;
}
ol, ul {
list-style: none;
}
b {
font-weight: bold;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
a {
color: #d74924;
text-decoration: underline;
cursor: pointer;
}
a:active {
color: #ef8b70;
}
input[type="text"], input[type="tel"], input[type="password"], textarea, select {
-webkit-appearance: none;
}
::selection {
background: rgba(47,154,211,.5);
color: #fff;
text-shadow: none;
}
::-moz-selection {
background: rgba(47,154,211,.5);
color: #fff;
text-shadow: none;
}
input[type="submit"]:focus, input[type="button"]:focus, input[type="text"]:focus, button, :focus {
outline : none;
}
input[type="submit"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, button::-moz-focus-inner {
border : 0;
}
html {
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
-o-text-size-adjust: none;
text-size-adjust: none;
}
* {
-webkit-tap-highlight-color: rgba(205,69,29,.5);
}
@media screen and (min-width: 1025px) {
.content-padding {
padding: 10px 0 10px 0;
}
.restaurants-items,
.nav .content,
.page-restaurant .content,
.page-cafe .content,
.content-padding {
/*max-width: 767px;*/
max-width: 1024px;
margin: 0 auto;
}
}
@media screen and (max-width: 1024px) {
.content-padding {
padding: 10px;
}
*:not(input):not(textarea) {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: -moz-none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
}
.logo {
background: url(../../images/micro/crunchbutton-logo.svg) no-repeat;
width: 254px;
height: 50px;
background-size: 100%;
margin: 0 auto;
cursor: pointer;
}
.menu {
background: url(../../images/micro/menu.svg) center center no-repeat;
background-size: 100%;
width: 44px;
height: 28px;
float: left;
margin: 8px 0 0 10px;
cursor: pointer;
}
.menu:active {
opacity: .4;
}
.nav-back {
position:absolute;
z-index : 0;
cursor: pointer;
margin: 8px 0 0 6px;
background: url(../../images/micro/back.svg) center center no-repeat;
background-size: 100%;
width: 50px;
height: 28px;
float: left;
}
.nav-back:active {
opacity: .4;
}
::-webkit-input-placeholder {
color: #858585;
}
:-moz-placeholder {
color: #858585;
}
::-moz-placeholder {
color: #858585;
}
:-ms-input-placeholder {
color: #858585;
}
h4 {
font-weight: bold;
font-size: 1.3em;
line-height: 1.9em;
}
p {
font-size: 1.2em;
line-height: 1.6em;
}
/* BUTTONS */
.button {
border: 0;
padding: .5em 0 .5em 0;
border-radius: 5px;
cursor: pointer;
color: #fff;
text-transform: uppercase;
font-size: 1.3em;
width: 100%;
-webkit-transition: background linear 0.08s;
-moz-transition: background linear 0.08s;
-ms-transition: background linear 0.08s;
-o-transition: background linear 0.08s;
transition: background linear 0.08s;
}
.button.ani-all {
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
-webkit-transition: all linear 0.08s;
-moz-transition: all linear 0.08s;
-ms-transition: all linear 0.08s;
-o-transition: all linear 0.08s;
transition: all linear 0.08s;
}
/* colors */
.button.orange {
background: #df4a32;
}
.button.lightorange {
background: #fe9872;
font-weight: bold;
}
.button.facebook {
background: #385ca2;
font-weight: bold;
}
.button.green {
background: #00bea0;
font-weight: bold;
}
.button.find-restaurants {
font-size: 1.9em;
max-width: 30em;
padding: .9em 0 .9em 0;
border-radius: 6px;
letter-spacing: 0;
}
.button.get-food {
display: block;
font-size: 18px;
font-weight: 800;
width: 300px;
margin: 0 auto;
padding: .39em 0 .39em 0;
letter-spacing:1px;
margin-top: 7px;
background: #e24538;
box-shadow: 0 3px 0 #980c08;
}
/* active colors */
.button.orange:active {
background: #ce412a;
}
.button.download:active {
background: #d13b39;
}
.button.lightorange:active {
background: #e78d62;
}
.button.green:active {
background: #00b195;
}
.button.facebook:active {
background: #2f4f8d;
}
/* pushable border colors */
.button-pushable .button.orange {
box-shadow: 0 3px 0 #961500;
}
.button-pushable .button.lightorange {
box-shadow: 0 2px 0 #de7e5b;
}
.button-pushable .button.green {
box-shadow: 0 2px 0 #00927b;
}
.button-pushable .button.facebook {
box-shadow: 0 2px 0 #203d74;
}
/* pushable states */
.button-pushable {
margin-top: 0;
/* margin-bottom: 3px; @test*/
height: 3.5em;
}
.button-pushable .button:active {
box-shadow: none;
margin-top: 4px;
}
/* pushable margins */
.button-pushable .button.get-food:active{
margin-top: 10px;
}
.button-pushable .button.find-restaurants:active {
margin-top: 5px;
}
.button-pushable.find-restaurants {
height: 6em;
}
.button-pushable .button.download:active {
margin-top: 4px;
}
/* GLOBAL */
@media(min-width:769px) {
.menu.drop {
display: block;
}
.menu.side {
display: none;
}
.menu{
-webkit-transition: opacity 0.1s;
-moz-transition: opacity 0.1s;
-ms-transition: opacity 0.1s;
-o-transition: opacity 0.1s;
transition: opacity 0.1s;
}
}
@media(max-width: 768px) {
.menu.drop {
display: none;
}
.menu.side {
display: block;
}
}
@media(min-width:500px) {
body {
font-size: 12px;
}
.top-pad {
height: 90px;
}
.restaurant-pad {
}
.restaurant-pic {
height: 10em;
}
}
@media(max-width:499px) {
.logo {
width: 170px;
height: 35px;
}
.menu {
margin: 3px 0 0 10px;
}
.nav-back {
margin: 3px 0 0 6px;
}
.nav-cart {
margin: 3px 10px 0 0;
}
.top-pad {
height: 71px;
}
.restaurant-pad {
}
.restaurant-pic {
height: 12em;
}
}
.divider {
clear: both;
}
.divider.dots {
border-top: 1px solid #eeede7;
}
/* SNAPS */
@media(min-width:769px) {
.snap-drawers {
display:none;
}
}
@media(max-width:768px) {
.dropdown {
display: none !important;
}
body {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
}
.footer {
display: none;
}
.snap-content-inner {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
width:auto;
height:auto;
z-index:3;
overflow:auto;
overflow-x:hidden;
-webkit-overflow-scrolling: touch;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.snap-content {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
width:auto;
height:auto;
z-index:2;
overflow: hidden;
}
.snap-drawer {
position:absolute;
top:0;
right:auto;
bottom:0;
left:auto;
width:265px;
height:auto;
overflow:auto;
overflow-x:hidden;
-webkit-overflow-scrolling: touch;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
-webkit-transition: width 0.3s ease;
-moz-transition: width 0.3s ease;
-ms-transition: width 0.3s ease;
-o-transition: width 0.3s ease;
transition: width 0.3s ease;
}
.snap-drawers {
background: $sideBg;
color:#eee;
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
width:auto;
height:auto;
overflow:hidden;
}
.snap-drawer-left, .snap-drawer-right {
left:0;
z-index:1;
}
.snapjs-left .snap-drawer-right,
.snapjs-right .snap-drawer-left {
display: none;
}
.snapjs-expand-left .snap-drawer-left,
.snapjs-expand-right .snap-drawer-right {
width: 100%;
}
.snap-drawer ul {
padding:0;
margin:0;
list-style-type:none;
}
.snap-drawer li:first-child {
border-top:1px solid rgba(0,0,0,0.1);
}
.snap-drawer li {
display:block;
border-bottom:1px solid rgba(0,0,0,0.1);
padding:8px 0 2px 0;
text-decoration:none;
color:#fff;
text-indent:20px;
}
.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;
}
.side-menu-wrap {
height: 28px;
}
.side-menu-wrap {
margin-left: -20px;
}
.side-menu-label {
margin-top: -10px;
vertical-align: top;
line-height: 1.6em;
margin-bottom: 20px;
font-size: 14px;
}
}
.snap-opened .snap-content-inner {
pointer-events: none;
}
.fixed {
position: fixed;
}
.navs {
width:auto;
top:0;
left:0;
right:0;
z-index:100;
}
.divider.line {
background: #c7c7c7;
height: 1px;
}
.side-menu-icon {
width: 70px;
}
.side-menu a {
color: #fff;
}
.side-menu li {
cursor: pointer;
}
.restaurant-info-address {
margin-top: .2em;
font-size: 1.1em;
line-height: 1.4em;
}
.no-init .hide-before-init {
display: none !important;
}
select {
border: 2px solid #555;
padding: .3em;
border-radius: 5px;
font-size: 1.2em;
}
.nav-top {
background: $navColor;
background: rgba($navColor, .97);
padding-top: 15px;
border-bottom: 1px solid rgba(darken($navColor, 50%), .97);
}