Created admin functionality of adding chromeboks

This commit is contained in:
Yaman 2015-01-01 14:55:05 -05:00
parent 7673ad3b30
commit 41b5f913f3
5 changed files with 64 additions and 9 deletions

View File

@ -1,3 +1,21 @@
.admintitle {
text-align: center;
}
.content {
background-color: #F7F7FF;
border-radius:15px;
margin-left:auto;
margin-right:auto;
margin-top:13%;
margin-bottom:0;
height:auto;
max-width:600px;
box-shadow: 0px 5px 10px #222222;
padding-bottom:0;
padding-top:0;
}
.remove {
margin-bottom: 4%;
}

View File

@ -1,12 +1,24 @@
<template name="admin">
<div id="center">
<div id="sign-in">
<div class="content">
<h5 class="admintitle">Admin Panel</h5>
<div class="Adding">
<h6>Add a Chromebook</h6>
<form class="new-task">
<input type="text" name="anumber" placeholder="Chromebook Number (eg. B1)" />
<input type="text" name="aserial" placeholder="Serial Number (eg. ABCD1234)" />
<input type="submit" value="Submit" class="add" />
</form>
</div>
<div>
<h6>Remove a Chromebook</h6>
<h6>Edit Chromebooks</h6>
{{#each chromebooks}}
<div class="row">
{{> chromebook}}
<!-- fa-times -->
<i class="icons cross fa fa-exclamation-triangle fa-lg"></i>
</div>
{{/each}}
</div>
</div>
</div>

View File

@ -0,0 +1,29 @@
Template.admin.helpers({
chromebooks: function() {
return Chromebooks.find();
}
});
Template.admin.events({
"submit .add, click .add": function (event) {
event.preventDefault();
var chromebook_number = $("input[name='anumber']")[0].value;
var chromebook_serial = $("input[name='anumber']")[0].nextElementSibling.value;
Chromebooks.insert({
"status": 0,
"userid": null,
"last_checkout": null,
"serial": chromebook_serial,
"number": chromebook_number
});
// Clear form
chromebook_number.value = "";
chromebook_serial.value = "";
// Prevent default form
return false;
}
});

View File

@ -3,13 +3,14 @@ background-color: #F7F7FF;
border-radius:15px;
margin-left:auto;
margin-right:auto;
margin-top:18%;
margin-bottom:0;
margin-top:15%;
height:auto;
max-width:60%;
box-shadow: 0px 5px 10px #222222;
padding-bottom:0;
padding-top:0;
overflow-y: auto;
margin-bottom: 25%;
}
.title {

View File

@ -151,8 +151,3 @@ h6{
0 0 20px #f9f9f9;
}
}
.chromeicon {
width: 25px;
height: 25px;
}