updated some stuff for phonegap

This commit is contained in:
arzynik 2013-08-06 21:14:36 -07:00
parent ea294c2d3a
commit a4ff5ee834
8 changed files with 118 additions and 83 deletions

View File

@ -0,0 +1,51 @@
<?php
class Controller_api_build extends Crunchbutton_Controller_Rest {
public function init() {
// generate a list of assets to be used for the app
$files = [];
// views
foreach (new DirectoryIterator(c::config()->dirs->view.'default/crunchbutton/frontend') as $fileInfo) {
if (!$fileInfo->isDot()) {
$files[] = 'view/'.$fileInfo->getBasename('.phtml').'.html';
}
}
// images
$exclude = [
'/admin',
'/social',
'/mprinter',
'/micro',
'/giftcard',
'/food',
'/datepicker',
'/compat',
'/admin'
];
$path = c::config()->dirs->www.'assets/images';
$dir = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
$fs = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::SELF_FIRST);
foreach ($fs as $fileInfo) {
$p = str_replace($path,'',$fileInfo->getPath());
if ($fileInfo->isFile() && ((!$p && substr($fileInfo->getBasename(),0,1) != '.') || ($p && !in_array($p, $exclude)))) {
$files[] = str_replace('//','/','images/'.$p.'/'.$fileInfo->getBasename());
}
}
// audio
$files[] = 'audio/crunch.mp3';
$files[] = 'audio/crunch.ogg';
// javascript
$files[] = 'js/bundle.js';
// css
$files[] = 'css/bundle.css';
echo json_encode($files);
}
}

View File

@ -1,14 +0,0 @@
<?php
class Controller_api_views extends Crunchbutton_Controller_Rest {
public function init() {
foreach (new DirectoryIterator(c::config()->dirs->view.'default/crunchbutton/frontend') as $fileInfo) {
if (!$fileInfo->isDot()) {
$files[] = $fileInfo->getBasename('.phtml');
}
}
echo json_encode($files);
}
}

View File

@ -96,8 +96,3 @@
<div ng-include="'view/support.html'"></div>
<div id="fb-root"></div>
<audio id="get-food-audio">
<source src="/assets/audio/crunch.mp3"></source>
<source src="/assets/audio/crunch.ogg"></source>
</audio>

View File

@ -18,7 +18,7 @@ if ($this->community) {
?>
<script type="text/javascript">
var c = <?=json_encode(c::appConfig())?>;
var c = <?=json_encode(c::appConfig())?>;
if (App) {
App.config = c;
c = null;
@ -36,6 +36,11 @@ if (App) {
<?=$this->display('layout/html.body')?>
</body>
<audio id="get-food-audio">
<source src="/assets/audio/crunch.mp3"></source>
<source src="/assets/audio/crunch.ogg"></source>
</audio>
<script type="text/javascript">
$(function() {
<? foreach (c::appConfig(['extended']) as $key => $value) : ?>

View File

@ -12,12 +12,12 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" href="/assets/images/appicon.png">
<script type="text/javascript">
<?php
// Get server's date time converted to GMD
$utc_str = gmdate( 'Y/n/d/H/i/s', time() );
$utc = strtotime( $utc_str );
<?
// Get server's date time converted to GMD
$utc_str = gmdate( 'Y/n/d/H/i/s', time() );
$utc = strtotime( $utc_str );
?>
var _gmtServer = '<?php echo $utc_str;?>';
var _gmtServer = '<?=$utc_str?>';
</script>
<? if (c::config()->bundle) : ?>
<link rel="stylesheet" type="text/css" href="/assets/css/bundle.css?v=<?=Cana_Util::gitVersion()?>">
@ -45,7 +45,7 @@ var _gmtServer = '<?php echo $utc_str;?>';
<? foreach (new DirectoryIterator(c::config()->dirs->view.'default/crunchbutton/frontend') as $fileInfo) : ?>
<? if (!$fileInfo->isDot()) : ?>
<script type="text/ng-template" id="view/<?=$fileInfo->getBasename('.phtml')?>.html">
<script type="text/ng-template" id="assets/view/<?=$fileInfo->getBasename('.phtml')?>.html">
<?=file_get_contents($fileInfo->getPathname())?>
</script>
<? endif ; ?>

View File

@ -17,7 +17,7 @@ body {
font-size: 14px;
}
.bg {
background: #f5f5f5 url(/assets/images/groovepaper.png);
background: #f5f5f5 url(../images/groovepaper.png);
}
.pacman-loading{
display: none;
@ -30,7 +30,7 @@ body {
}
.nav {
background: url(/assets/images/nav-web.png);
background: url(../images/nav-web.png);
height: 68px;
background-size: 68px;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.15);
@ -116,7 +116,7 @@ body {
.logo-img {
width: 299px;
height: 37px;
background: url(/assets/images/logo-web.png) no-repeat;
background: url(../images/logo-web.png) no-repeat;
background-size: 100%;
}
@ -268,10 +268,10 @@ b {
}
.cart-button-add {
background: url(/assets/images/plus.png) no-repeat;
background: url(../images/plus.png) no-repeat;
}
.cart-button-remove {
background: url(/assets/images/xsign.png) no-repeat;
background: url(../images/xsign.png) no-repeat;
margin-right: 4px;
}
@ -298,7 +298,7 @@ b {
.divider.dots {
height: 1px;
background: url(/assets/images/bg_divider.gif);
background: url(../images/bg_divider.gif);
opacity: .3;
-moz-opacity: .30;
filter: alpha(opacity=30);
@ -612,7 +612,7 @@ html[xmlns] .clearfix {
content: " ";
height: 24px;
width: 24px;
background: url(/assets/images/submit-loader.gif) no-repeat;
background: url(../images/submit-loader.gif) no-repeat;
display: block;
position: absolute;
margin-left: 268px;
@ -643,7 +643,7 @@ html[xmlns] .clearfix {
.app-busy-loader-icon {
margin: 0 auto;
background: url(/assets/images/loader.gif) no-repeat;
background: url(../images/loader.gif) no-repeat;
width: 48px;
height: 48px;
margin-top: 25px;
@ -746,14 +746,14 @@ html[xmlns] .clearfix {
}
.location-detect-icon {
background: url(/assets/images/locate.png);
background: url(../images/locate.png);
background-size: contain;
height: 50px;
width: 50px;
}
.location-detect-loader {
background: url(/assets/images/loader-location.gif);
background: url(../images/loader-location.gif);
background-size: contain;
height: 24px;
width: 24px;
@ -766,7 +766,7 @@ html[xmlns] .clearfix {
width: 45px;
height: 30px;
margin: 12px 0 0 10px;
background: url(/assets/images/location.png) no-repeat;
background: url(../images/location.png) no-repeat;
background-size: contain;
cursor: pointer;
}
@ -776,7 +776,7 @@ html[xmlns] .clearfix {
width: 45px;
height: 30px;
margin: 12px 0 0 10px;
background: url(/assets/images/menu.png) no-repeat;
background: url(../images/menu.png) no-repeat;
background-size: contain;
cursor: pointer;
}
@ -979,7 +979,7 @@ html[xmlns] .clearfix {
}
.icon-pencil{
background: url(/assets/images/pencil.png);
background: url(../images/pencil.png);
display: inline-block;
margin: 0 0 0 5px;
height: 16px;
@ -1312,22 +1312,22 @@ html[xmlns] .clearfix {
}
.nav {
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.35);
background: url(/assets/images/nav.png);
background: url(../images/nav.png);
height: 44px;
background-size: 44px;
}
.ios7 .nav {
background: url(/assets/images/nav-ios7.png);
background: url(../images/nav-ios7.png);
background-size: 54px;
padding-top: 10px;
}
.bg {
background: #f5f5f5 url(/assets/images/crisp_paper_ruffles-mobile.png);
background: #f5f5f5 url(../images/crisp_paper_ruffles-mobile.png);
}
.logo-img {
width: 168px;
height: 23px;
background: url(/assets/images/logo.png) no-repeat;
background: url(../images/logo.png) no-repeat;
background-size: 100%;
margin-left: -84px;
position: absolute;
@ -1524,7 +1524,7 @@ html[xmlns] .clearfix {
position: absolute;
top: 8px;
left: 8px;
background: url(/assets/images/back.png) no-repeat;
background: url(../images/back.png) no-repeat;
width: 51px;
height: 31px;
background-size: contain;
@ -1535,7 +1535,7 @@ html[xmlns] .clearfix {
white-space: nowrap;
}
.cart-summary-icon {
background: url(/assets/images/cart.png) no-repeat;
background: url(../images/cart.png) no-repeat;
height: 25px;
width: 30px;
margin: 5px 18px 0 10px;
@ -1600,7 +1600,7 @@ html[xmlns] .clearfix {
.cart-button-add span {
display: block;
background: url(/assets/images/plus2.png) no-repeat;
background: url(../images/plus2.png) no-repeat;
height: 17px;
width: 18px;
background-size: contain;
@ -1610,7 +1610,7 @@ html[xmlns] .clearfix {
}
.cart-button-remove span {
display: block;
background: url(/assets/images/xsign2.png) no-repeat;
background: url(../images/xsign2.png) no-repeat;
width: 23px;
height: 23px;
background-size: contain;
@ -1677,7 +1677,7 @@ html[xmlns] .clearfix {
}
.pacman-loading{
background: url(/assets/images/pacman.gif) no-repeat;
background: url(../images/pacman.gif) no-repeat;
height: 24px;
position: absolute;
width: 24px;
@ -1698,7 +1698,7 @@ html[xmlns] .clearfix {
position: absolute;
top: 9px;
left: -2px;
background: url(/assets/images/back.png) no-repeat;
background: url(../images/back.png) no-repeat;
width: 51px;
height: 31px;
float: left;
@ -1708,7 +1708,7 @@ html[xmlns] .clearfix {
}
.signin-icon {
background: url(/assets/images/sign-in-icon.png) no-repeat !important;
background: url(../images/sign-in-icon.png) no-repeat !important;
background-size: contain !important;
cursor: pointer !important;
float: right !important;
@ -1788,7 +1788,7 @@ html[xmlns] .clearfix {
display: block;
}
.giftcard-badge{
background: url(/assets/images/giftcard-badge.png) no-repeat;
background: url(../images/giftcard-badge.png) no-repeat;
background-size: contain;
width: 50px;
height: 50px;
@ -1809,7 +1809,7 @@ html[xmlns] .clearfix {
text-align: center;
}
.giftcard-badge-tooltip{
background: #f5f5f5 url(/assets/images/groovepaper.png);
background: #f5f5f5 url(../images/groovepaper.png);
border: 1px solid #999;
border-radius: 3px;
color:#666;
@ -1854,7 +1854,7 @@ html[xmlns] .clearfix {
width: 45px;
height: 30px;
margin: 12px 0 0 10px;
background: url(/assets/images/location.png) no-repeat;
background: url(../images/location.png) no-repeat;
background-size: contain;
cursor: pointer;
}
@ -1862,7 +1862,7 @@ html[xmlns] .clearfix {
width: 45px;
height: 30px;
margin: 12px 0 0 10px;
background: url(/assets/images/menu.png) no-repeat;
background: url(../images/menu.png) no-repeat;
background-size: contain;
cursor: pointer;
}
@ -2218,7 +2218,7 @@ html[xmlns] .clearfix {
width: 60px;
}
.signin-icon {
background: url(/assets/images/sign-in.png) no-repeat;
background: url(../images/sign-in.png) no-repeat;
background-size: contain;
cursor: pointer;
float: right;
@ -2226,7 +2226,7 @@ html[xmlns] .clearfix {
width: 98px;
}
.signout-icon {
background: url(/assets/images/sign-out.png) no-repeat;
background: url(../images/sign-out.png) no-repeat;
background-size: contain;
cursor: pointer;
float: right;
@ -2234,7 +2234,7 @@ html[xmlns] .clearfix {
width: 110px;
}
.signin-user{
background: url(/assets/images/sign-in-icon.png) no-repeat;
background: url(../images/sign-in-icon.png) no-repeat;
background-size: contain;
cursor: pointer;
float: right;
@ -2378,7 +2378,7 @@ html[xmlns] .clearfix {
}
.tooltip-help-content{
background: #f5f5f5 url(/assets/images/groovepaper.png);
background: #f5f5f5 url(../images/groovepaper.png);
border: 1px solid #999;
border-radius: 3px;
color:#666;

View File

@ -391,6 +391,9 @@ html {
.hidden-phone {
display: none;
}
.snap-content {
box-shadow: 0 0 10px 3px rgba(0,0,0,.2);
}
}
@media (min-width: 769px) {
.visible-desktop {
@ -405,13 +408,6 @@ html {
.snap-content {
box-shadow: 0 0 10px 3px rgba(0,0,0,.2);
}
.snap-drawers {
background: #3d3731;
color: #eee;
@ -527,7 +523,7 @@ html {
transform: translate3d(0, 0, 0);
}
.menu-icon {
background: url(/assets/images/menu.png) no-repeat;
background: url(../images/menu.png) no-repeat;
background-size: contain;
cursor: pointer;
float: left;

View File

@ -149,75 +149,77 @@ NGApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $l
.when('/location', {
action: 'location',
controller: 'location',
templateUrl: 'view/location.html'
templateUrl: 'assets/view/location.html'
})
.when('/' + App.restaurants.permalink, {
action: 'restaurants',
controller: 'restaurants',
templateUrl: 'view/restaurants.html'
templateUrl: 'assets/view/restaurants.html'
})
.when('/' + App.restaurants.permalink + '/:id', {
action: 'restaurant',
controller: 'restaurant',
templateUrl: 'view/restaurant.html'
templateUrl: 'assets/view/restaurant.html'
})
.when('/legal', {
action: 'legal',
controller: 'legal',
templateUrl: 'view/legal.html'
templateUrl: 'assets/view/legal.html'
})
.when('/help', {
action: 'help',
controller: 'help',
templateUrl: 'view/help.html'
templateUrl: 'assets/view/help.html'
})
.when('/orders', {
action: 'orders',
controller: 'orders',
templateUrl: 'view/orders.html'
templateUrl: 'assets/view/orders.html'
})
.when('/order/:id', {
action: 'order',
controller: 'order',
templateUrl: 'view/order.html'
templateUrl: 'assets/view/order.html'
})
.when('/cities', {
action: 'cities',
controller: 'cities',
templateUrl: 'view/cities.html'
templateUrl: 'assets/view/cities.html'
})
.when('/giftcard', {
action: 'giftcard',
controller: 'giftcard',
templateUrl: 'view/home.html'
templateUrl: 'assets/view/home.html'
})
.when('/giftcard/:id', {
action: 'giftcard',
controller: 'giftcard',
templateUrl: 'view/home.html'
templateUrl: 'assets/view/home.html'
})
.when('/reset', {
action: 'reset',
controller: 'reset',
templateUrl: 'view/home.html'
templateUrl: 'assets/view/home.html'
})
.when('/reset/:id', {
action: 'reset',
controller: 'reset',
templateUrl: 'view/home.html'
templateUrl: 'assets/view/home.html'
})
.when('/', {
action: 'home',
controller: 'home',
templateUrl: 'view/home.html'
templateUrl: 'assets/view/home.html'
})
.otherwise({
action: 'home.default',
controller: 'default',
templateUrl: 'view/home.html'
templateUrl: 'assets/view/home.html'
})
;
$locationProvider.html5Mode(true);
// only use html5 enabled location stuff if its not in a phonegap container
$locationProvider.html5Mode(!App.isPhoneGap);
}]);
@ -341,7 +343,7 @@ App.track = function() {
*/
App.trackProperty = function(prop, value) {
// || App.config.env != 'live'
if (!App.config) {
if (App.config.env != 'live') {
return;
}
@ -357,7 +359,7 @@ App.trackProperty = function(prop, value) {
*/
App.identify = function() {
if (App.config.env != 'live') {
//return;
return;
}
if (App.config.user.uuid) {
mixpanel.identify(App.config.user.uuid);