Skip to content

Commit

Permalink
More polishing.
Browse files Browse the repository at this point in the history
Done for the night! Success!
  • Loading branch information
clj13001 committed Dec 3, 2016
1 parent e5cb7a4 commit b371e2a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions html/css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ body{
background-color: #94969A;
padding-top: 50px;
height: 100vh;
overflow-x: hidden;
}

a.divlink{
Expand Down
34 changes: 31 additions & 3 deletions html/javascript/listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,40 @@ var dev6 = {
};

var devices = [dev1, dev2, dev3, dev4, dev5, dev6];

for(var a = 0; a < options.length; a++){
var type = options[a].getAttribute('data-type');
options[0].addEventListener('click', showAll);
for(var a = 1; a < options.length; a++){
options[a].addEventListener('click', show);
}

showAll();

function showAll(){
var html = '';

for(var i = 0; i < devices.length; i++){
html += '<div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/' + devices[i].hardware + '.png" class = "device">' + devices[i].name + '</div><div class = "deviceDescp"><p>' + devices[i].description + '</p><div class = "availableAnchor" id = "' + (i+1) + '"></div></div></div><br><br>';
}

document.getElementById('devContainer').innerHTML = html;

var unavailable = getUnavailableItems();
var anchors = document.getElementsByClassName('availableAnchor');
for(var i = 0; i < anchors.length; i++){
var anchor = anchors[i];
var id = anchor.getAttribute('id');
if(isUnavailable(id)){
document.getElementById(id).innerHTML = 'Unavailable';
id = '#' + id;
$(id).css({'background-color':'#ff3535'});
}
else{
document.getElementById(id).innerHTML = 'Available';
id = '#' + id;
$(id).css({'background-color':'#1fe07f'});
}
}
}

function show(){
var type = this.getAttribute('data-type');
var html = '';
Expand Down
4 changes: 3 additions & 1 deletion html/javascript/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ var devices = [dev1, dev2, dev3, dev4, dev5, dev6];

//add event listeners to the options in the left sidebar
for(var a = 0; a < options.length; a++){
var type = options[a].getAttribute('data-type');
options[a].addEventListener('click', show);
}

Expand All @@ -70,6 +69,9 @@ function show(){
}
}

if(html.localeCompare("")==0)
html += "<p>There are no devices with the search criteria: " + this.textContent + "</p>";

//add to HTML page
document.getElementById('devContainer').innerHTML = html;

Expand Down
3 changes: 2 additions & 1 deletion html/webpages/listingPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Device Options</h4>
<li class = "option" data-type = "all"><a href="#">Show All Devices</a></li>
<li class = "option" data-type = "iphone"><a href="#">iPhones</a></li>
<li class = "option" data-type = "ipad"><a href="#">iPad</a></li>
<li class = "option" data-type = "computerStick"><a href="#">Computer Sticks</a></li>
Expand All @@ -67,7 +68,7 @@ <h4>Operating Systems</h4>
</div>

<div class = "displayDevice">
<h2>Available Devices</h2>
<h2>Device Dictionary</h2>
<div id = "devContainer"></div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion html/webpages/requestPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h4>Operating Systems</h4>

<div class = "displayDevice">
<h2>Available Devices</h2>
<div id = "devContainer"></div>
<div id = "devContainer"><p>Choose an option to the left to begin requesting!</p></div>
</div>

<div class = "cartConfirm" id = "added">
Expand Down

0 comments on commit b371e2a

Please sign in to comment.