Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
166 changes: 166 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
@font-face {
font-family: 'avenir';
src: url('../fonts/AvenirNextLTPro-Regular.otf');
}

body, p {
margin: 0;
font-family: avenir, sans-serif, serif;
font-size: 20px;
}

button {
font-family: avenir, sans-serif, serif;
}

.container-custom {
height: 100vh;
width: 100vw;
}

header {
width: 100%;
background-color: #9B9B8C;
}

.header-splash {
height: 10%;
border-bottom: 2px solid black;
}

.header-page {
position: relative;
color: white;
height: 20%;
width: 100%;
}

.header-title {
position: absolute;
left: 100px;
bottom: 10px;
font-size: 25px;
}

.main-splash {
height: 80%;
width: 100%;
background-color: #EEEEEE;
}

.main-splash span {
color: purple;
font-size: 48px;
}

.left-section {
width: 50%;
height: 100%;
float: left;
margin: 0 auto;
}

.left-box {
width: 200px;
height: 200px;
margin: 25% auto;
text-align: center;
}

.right-section {
height: 100%;
width: 50%;
float: right;
position: relative;
}

.right-section::before {
content: ' ';
display: block;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0.19;
z-index: 1;
background-image: url('../resources/track.jpg');
background-repeat: no-repeat;
background-position: 50% 0;
-ms-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
}

#tracks-container {
height: 100%;
width: 175px;
margin: 0 auto;
}

#albums-container {
margin-left: 100px;
overflow: auto;
}

.img-track-album {
width: 175px;
height: 175px;
margin: 5px 0;
}

.img-thumbnail-album {
/*margin: 20px 30px 50px;*/
margin: 20px;
width: 100px;
height: 100px;
}

.img-thumbnail-album:first-child {
margin-left: 0;
}

.album-description {
border: 2px solid black;
margin: 0 30px 20px 100px;
background-color: #EEEEEE;
width: 75%;
height: 150px;
overflow: auto;
}

.btn-custom {
color: white;
font-size: 20px;
background-color: #353526;
padding: 10px 35px;
}

.btn-custom:hover {
color: white;
}

.btn-spacer {
margin: 5px;
}

.btn-container {
margin-left: 95px;
}

/*.spacer {
padding: 45px;
}*/

footer {
color: white;
height: 10%;
width: 100%;
/*text-align: center;*/
position: fixed;
padding: 20px 100px;
bottom: 0;
background-color: #686859;
}
File renamed without changes
53 changes: 41 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<select name="my_select" style="height: 40px; line-height: 100px;">
<option name="reggae"> Select your genre </option>
<option name="reggae"> Reggae </option>
<option name="blues"> Blues </option>
</select>

</body>

<head>
<meta charset="utf-8">
<title>Home</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/script.js" deferred></script>
<link rel="stylesheet" href="css/style.css">
</head>

<body>

<div class="container-custom">

<header class="header-splash"></header>

<main class="main-splash">

<section class="right-section">
<div id="tracks-container"></div>
</section>

<section class="left-section">
<div class="left-box">
<span>track bin</span>
<a class="btn btn-custom" href="playlist.html" role="button">choose tracks</a>
</div>
</section>

</main>

<footer>&copy; 2017 Shu Sia Lukito</footer>

</div>


</body>

</html>
67 changes: 67 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Retrieve all albums
var albums = {};
$.get('https://lit-fortress-6467.herokuapp.com/object').then(function(data) {
albums = data.results;
addTracks();
addThumbnails();
addEvents();
}, function(e) {
console.log('Error occurred when retrieving album data. Please contact your system administrator! ', e);
});

function addTracks() {
// Add 3 random albums to the track on splash page
albums.sort(function() {
return 0.5 - Math.random();
});
let tracks = albums.slice(0, 3);
tracks.forEach(function(curr) {
let elem = createImgElement(curr, 'img-track-album');
$('#tracks-container').append(elem);
});
}

function addThumbnails() {
// Add album thumbnails to the playlist page
albums.forEach(function(curr) {
let elem = createImgElement(curr, 'img-thumbnail-album');
$('#albums-container').append(elem);
});
}

function createImgElement(item, cl) {
let elem = document.createElement('img');
elem.setAttribute('id', item.id);
elem.setAttribute('src', 'images/' + item.cover_art);
elem.setAttribute('alt', item.artist);
if (cl !== null) {
elem.setAttribute('class', cl);
}
return elem;
}

function addEvents() {

// Add selected album to description
$('.img-thumbnail-album').click(function() {
let selected = albums.find(function(curr) {
return curr.id === parseInt(this.id);
}, this);
let description = '<p>' + selected.artist + ': ' + selected.title + '</p>';
$('.album-description').append(description);
});

// Add clear button handler
$('#btn_clear').click(function() {
$('.album-description').text('');
});

// Add submit bin button handler
$('#btn_submit').click(function() {
$.post('https://lit-fortress-6467.herokuapp.com/post', function(data) {
console.log(data);
alert(data)
});
});

}
42 changes: 42 additions & 0 deletions playlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Playlist</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/script.js" deferred></script>
</head>

<body>

<div class="container-custom">

<header class="header-page">
<div class="header-title">click an album to add its tracks to the bin</div>
</header>

<main>

<div id="albums-container"></div>

<div class="album-description"></div>

<div class="btn-container">
<button type="button" id="btn_clear" name="btn_clear" class="btn btn-custom btn-spacer">clear tracks</button>
<button type="button" id="btn_submit" name="btn_submit" class="btn btn-custom btn-spacer">submit bin</button>
</div>

</main>

<footer>&copy; 2017 Shu Sia Lukito</footer>

</div>

</body>

</html>