quick demo commit

This commit is contained in:
arzynik 2012-06-27 19:31:18 -07:00
parent 082a33f8c3
commit ac2472aa90
10 changed files with 84 additions and 34 deletions

View File

@ -3,7 +3,6 @@
class Controller_api_v1_login extends Crunchbutton_Controller_Rest {
public function init() {
switch ($this->method()) {
case 'get':
$user = Crunchbutton_User::o(c::getPagePiece(2));
if (!$file->id_file) {

View File

@ -1,22 +0,0 @@
<?php
class Controller_api_v1_note extends Crunchbutton_Controller_Rest {
public function init() {
switch ($this->method()) {
case 'get':
$note = Note::o(c::getPagePiece(3));
if (!$note->id_note) {
echo json_encode(['error' => 'invalid resource']);
exit;
}
echo $note->json();
break;
case 'post':
$note = new Note;
$note->serialize($this->request());
$note->save();
break;
}
}
}

View File

@ -0,0 +1,23 @@
<?php
class Controller_api_order extends Crunchbutton_Controller_Rest {
public function init() {
switch ($this->method()) {
case 'get':
$order = Order::o(c::getPagePiece(2));
if ($order->id_order) {
echo $order->json();
} else {
echo json_encode(['error' => 'invalid object']);
}
break;
case 'post':
$order = new Order;
$order->serialize($this->request());
$order->save();
$order->notify();
break;
}
}
}

View File

@ -2,8 +2,6 @@
class Controller_home extends Cana_Controller {
public function init() {
$r = Restaurant::q('select * from restaurant where active=1');
Cana::view()->restaurants = $r;
Cana::view()->display('home/index');
}
}

View File

@ -43,12 +43,41 @@
<div class="divider"></div>
<br /><br />
<div class="personal-info">
<div class="personal-info field-container">
<label>Name</label>
<div class="input-item"><input type="text" name="name"></div>
<label>Phone #</label>
<div class="input-item"><input type="text" name="phone"></div>
<label>Deliver</label>
<div class="input-item"><textarea name="deliver"></textarea></div>
</div>
<div class="payment-info">
<div class="payment-info field-container">
<label>Credit card #</label>
<div class="input-item"><input type="text" name="card"></div>
<label>Expiration</label>
<div class="input-item">
<select><option>Month</option></select>
<select><option>Year</option></select>
</div>
<label>Tip</label>
<div class="input-item">
<select>
<option>0%</option>
<option>5%</option>
<option>10%</option>
<option>15%</option>
<option>20%</option>
</select>
</div>
</div>
<br /><br />
<button class="button-submitorder"><div>Submit Order</div></button>

View File

@ -332,6 +332,28 @@ b {
padding-top: 2px;
}
input, textarea {
width: 200px;
}
input, textarea, select {
overflow: auto;
padding: 2px 4px 2px 4px;
font-size: 15px;
border: 1px solid #aaa;
border-radius: 4px;
font-weight: normal;
font-family: Helvetica;
background: #fff;
}
textarea {
height: 3em;
}
select {
height: 2.2em;
}
@media only screen
and (min-device-width : 320px)

View File

@ -74,7 +74,7 @@ App.loadRestaurant = function(id) {
};
App.page.community = function(id) {
App.community = App.cache('Community', id, function() {
//App.community = App.cache('Community', id, function() {
document.title = 'Crunchbutton - ' + App.community.name;
@ -105,7 +105,7 @@ App.page.community = function(id) {
$('.meal-items').append(restaurant);
}
});
//});
};
App.page.restaurant = function(id) {
@ -123,7 +123,7 @@ App.loadPage = function() {
break;
default:
App.page.community('yale');
App.page.community(1);
break;
}
};
@ -178,10 +178,11 @@ App.cart = {
$('.cart-total').html();
},
customize: function(item) {
alert('nope.');
},
submit: function() {
console.log(JSON.stringify(App.cart.items));
alert(JSON.stringify(App.cart.items));
}
};
@ -234,7 +235,7 @@ $(function() {
$(this).removeClass('button-submitorder-click');
});
App.community = App.cache('Community','yale', function() {
App.community = App.cache('Community',1, function() {
App.loadPage();
});