added chromebooks and moment.js
This commit is contained in:
parent
44fab29bae
commit
cfc8e6b7c2
@ -7,3 +7,5 @@
|
|||||||
meteor-platform
|
meteor-platform
|
||||||
autopublish
|
autopublish
|
||||||
insecure
|
insecure
|
||||||
|
iron:router
|
||||||
|
momentjs:moment
|
||||||
|
|||||||
@ -19,6 +19,14 @@ htmljs@1.0.3
|
|||||||
http@1.0.9
|
http@1.0.9
|
||||||
id-map@1.0.2
|
id-map@1.0.2
|
||||||
insecure@1.0.2
|
insecure@1.0.2
|
||||||
|
iron:controller@1.0.6
|
||||||
|
iron:core@1.0.6
|
||||||
|
iron:dynamic-template@1.0.6
|
||||||
|
iron:layout@1.0.6
|
||||||
|
iron:location@1.0.6
|
||||||
|
iron:middleware-stack@1.0.6
|
||||||
|
iron:router@1.0.6
|
||||||
|
iron:url@1.0.6
|
||||||
jquery@1.0.2
|
jquery@1.0.2
|
||||||
json@1.0.2
|
json@1.0.2
|
||||||
launch-screen@1.0.1
|
launch-screen@1.0.1
|
||||||
@ -29,6 +37,7 @@ meteor-platform@1.2.1
|
|||||||
minifiers@1.1.3
|
minifiers@1.1.3
|
||||||
minimongo@1.0.6
|
minimongo@1.0.6
|
||||||
mobile-status-bar@1.0.2
|
mobile-status-bar@1.0.2
|
||||||
|
momentjs:moment@2.8.4
|
||||||
mongo@1.0.10
|
mongo@1.0.10
|
||||||
observe-sequence@1.0.4
|
observe-sequence@1.0.4
|
||||||
ordered-dict@1.0.2
|
ordered-dict@1.0.2
|
||||||
|
|||||||
4
chromebook-checkout-meteor/client/checkout.css
Normal file
4
chromebook-checkout-meteor/client/checkout.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.chromebook:hover {
|
||||||
|
box-shadow: 5px 0 12px #919191, -5px 0 12px #919191;
|
||||||
|
outline: #25abd9 solid 3px;
|
||||||
|
}
|
||||||
11
chromebook-checkout-meteor/client/checkout.html
Normal file
11
chromebook-checkout-meteor/client/checkout.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<template name="checkout">
|
||||||
|
<div id="center">
|
||||||
|
<div id="sign-in">
|
||||||
|
<h5>Chromebook Checkout</h5>
|
||||||
|
{{#each chromebooks}}
|
||||||
|
{{> chromebook}}
|
||||||
|
{{/each}}
|
||||||
|
<button id="submit">Checkout!</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
5
chromebook-checkout-meteor/client/checkout.js
Normal file
5
chromebook-checkout-meteor/client/checkout.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Template.checkout.helpers({
|
||||||
|
chromebooks: function() {
|
||||||
|
return Chromebooks.find();
|
||||||
|
}
|
||||||
|
});
|
||||||
22
chromebook-checkout-meteor/client/chromebook.css
Normal file
22
chromebook-checkout-meteor/client/chromebook.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
.chromebook {
|
||||||
|
font-family: Lato;
|
||||||
|
padding-left:2%;
|
||||||
|
margin-left:3%;
|
||||||
|
margin-right:0.5%;
|
||||||
|
margin-top:.7%;
|
||||||
|
margin-bottom:.7%;
|
||||||
|
box-shadow: 3px 3px 10px #c2c2c2;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.available {
|
||||||
|
background-color:#72D376;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkedout {
|
||||||
|
background-color:#F9DB45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unavailable {
|
||||||
|
background-color:#E14C2B;
|
||||||
|
}
|
||||||
5
chromebook-checkout-meteor/client/chromebook.html
Normal file
5
chromebook-checkout-meteor/client/chromebook.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template name="chromebook">
|
||||||
|
<div class="chromebook {{status_class}}">
|
||||||
|
<p>Chromebook #{{number}} <span class="time">{{time_ago}}</span></p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
29
chromebook-checkout-meteor/client/chromebook.js
Normal file
29
chromebook-checkout-meteor/client/chromebook.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
var statusmap = {
|
||||||
|
0: "available",
|
||||||
|
1: "checkedout",
|
||||||
|
2: "unavailable"
|
||||||
|
}
|
||||||
|
|
||||||
|
Template.chromebook.helpers({
|
||||||
|
status_class: function() {
|
||||||
|
return statusmap[this.status];
|
||||||
|
},
|
||||||
|
time_ago: function() {
|
||||||
|
if (this.last_checkout === null) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return moment(this.last_checkout).fromNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.chromebook.events({
|
||||||
|
'click .available': function() {
|
||||||
|
Chromebooks.update(this._id, {$set: {status: 1}});
|
||||||
|
Chromebooks.update(this._id, {$set: {last_checkout: new Date()}});
|
||||||
|
},
|
||||||
|
'click .checkedout': function() {
|
||||||
|
Chromebooks.update(this._id, {$set: {status: 0}});
|
||||||
|
Chromebooks.update(this._id, {$set: {last_checkout: null}});
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -1,8 +1,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>IA Chromebook Checkout</title>
|
<title>IA Chromebook Checkout</title>
|
||||||
<link rel="icon" href="../resources/ico/favicon.png">
|
<link rel="icon" href="ico/favicon.png">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{> initial}}
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
5
chromebook-checkout-meteor/client/router.js
Normal file
5
chromebook-checkout-meteor/client/router.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Router.route('/', function() {
|
||||||
|
this.render("initial");
|
||||||
|
})
|
||||||
|
|
||||||
|
Router.route('/checkout');
|
||||||
1
chromebook-checkout-meteor/collections/chromebooks.js
Normal file
1
chromebook-checkout-meteor/collections/chromebooks.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
Chromebooks = new Mongo.Collection("chromebook");
|
||||||
Loading…
x
Reference in New Issue
Block a user