Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed placeholder text in view #13

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
b0a1318
end of step 1 sprint 1
nscalf561 Mar 3, 2016
7ccf0ce
add space
nreddy216 Mar 3, 2016
d0c9ed6
fixed merge conflict
nreddy216 Mar 3, 2016
d3a4312
Finishes Step 1 Sprint 1
nscalf561 Mar 3, 2016
711e664
did nothing
nreddy216 Mar 3, 2016
eb20edd
fixed merge conflict 2
nreddy216 Mar 3, 2016
69ad5dc
merging
93lucasp Mar 3, 2016
4358e2f
merging
93lucasp Mar 3, 2016
55014da
adds /api/albums
nscalf561 Mar 3, 2016
706009d
merging1
93lucasp Mar 3, 2016
628cd01
merging1
93lucasp Mar 3, 2016
093dbf6
Adds Seed and Database
nscalf561 Mar 3, 2016
59655a1
Finishes Sprint 1, links db to api/albums
nscalf561 Mar 3, 2016
d4ade36
update
nreddy216 Mar 3, 2016
63674ec
merging2
93lucasp Mar 3, 2016
6c59feb
fixed renderFile, adds ejs formatting
nscalf561 Mar 3, 2016
02f76ce
working on merge
nscalf561 Mar 3, 2016
5e03c08
Merge branch 'master' of https://github.com/nscalf561/tunely
93lucasp Mar 3, 2016
9071887
form done
93lucasp Mar 3, 2016
2cab258
add create route to api albums
nreddy216 Mar 3, 2016
3444294
Merge pull request #1 from nscalf561/form
93lucasp Mar 3, 2016
ee0cfb8
fix duplicate line
nreddy216 Mar 3, 2016
dba4306
adds functional form in index
nscalf561 Mar 4, 2016
0c11a07
functional version
nscalf561 Mar 4, 2016
2f9899f
Request Ajax completed and fixed bug lat box
93lucasp Mar 4, 2016
9622bba
merged ajax branch with master
93lucasp Mar 4, 2016
e8db737
half way through sprint 3
nscalf561 Mar 4, 2016
8580c63
fixes a typo error
nscalf561 Mar 4, 2016
4183fe8
Request Ajax completed and bug fixed
93lucasp Mar 4, 2016
c9bbfa4
Merge pull request #3 from nscalf561/ajax
nscalf561 Mar 4, 2016
589a30a
changed placeholder text
nreddy216 Mar 4, 2016
5f01acc
Merge pull request #4 from nscalf561/fixView
nscalf561 Mar 4, 2016
3e13c93
adds model updates
nscalf561 Mar 4, 2016
eb13105
Merge branch 'master' of https://github.com/nscalf561/tunely into spr…
nscalf561 Mar 4, 2016
fd38fd1
non-functional sprint3 branch
nscalf561 Mar 4, 2016
6368572
adds songs onto albums
nscalf561 Mar 4, 2016
eae30f2
adds album id's to divs'
nscalf561 Mar 4, 2016
c0d395c
add modal
93lucasp Mar 4, 2016
46adde3
about to pull
nscalf561 Mar 4, 2016
d725304
retrieves album.id. Need to build post to interact with the database
nscalf561 Mar 5, 2016
c7d41e1
removes previous functionality, adds ajax work
nscalf561 Mar 6, 2016
6f658eb
added route and semi functional delete button
nreddy216 Mar 6, 2016
8146b0d
adds create album functionality
nscalf561 Mar 6, 2016
699458d
delete route and method working
nreddy216 Mar 6, 2016
0571710
Merge pull request #6 from nscalf561/refactoringAjax
nscalf561 Mar 6, 2016
26bf83d
solves merge conflicts
nscalf561 Mar 6, 2016
477089a
Merge pull request #5 from nscalf561/deleteMethod
nscalf561 Mar 6, 2016
493262d
update missing last part
93lucasp Mar 6, 2016
32d2c5a
update done
93lucasp Mar 6, 2016
f20565c
about to merge
nscalf561 Mar 7, 2016
c99e06d
solves merge conflicts
nscalf561 Mar 7, 2016
a227663
Merge pull request #7 from nscalf561/update
nscalf561 Mar 7, 2016
fba1003
modal now pops up
nreddy216 Mar 7, 2016
0e09197
adds some styling, makes buttons sexy
nscalf561 Mar 7, 2016
66a160e
Merge pull request #8 from nscalf561/branchToMerge
nscalf561 Mar 7, 2016
a83da8c
solves merge conflicts
nscalf561 Mar 7, 2016
f5d5b69
Merge pull request #9 from nscalf561/addSongs
nscalf561 Mar 7, 2016
b8f8d53
add image urls
nreddy216 Mar 7, 2016
1abc8d9
added logo and some css stylin
nreddy216 Mar 7, 2016
8c9a52a
added album images and songs to seed file
nreddy216 Mar 7, 2016
cd8d396
fixed bug on save
nreddy216 Mar 7, 2016
9d84dee
styling
nreddy216 Mar 7, 2016
7cc05a0
Merge pull request #10 from nscalf561/addImages
nscalf561 Mar 7, 2016
96af377
login functionality on one page app without using separate login page
nreddy216 Mar 9, 2016
d7eb1b0
Merge pull request #11 from nscalf561/oauth
nreddy216 Mar 9, 2016
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
77 changes: 37 additions & 40 deletions public/js/app.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

//MAIN FUNCTION
$(document).ready(function() {

var $albums = $('#albums');


@@ -27,6 +26,25 @@ $(document).ready(function() {
}
});

// DELETE method
$('#albums').delegate('.deleteBtn','click', function(){
// var $album = $(this).closest('.album');

var $albumId = $(this).attr('delete-album-id');

$.ajax({
type: 'DELETE',
url: '/api/albums/' + $albumId,
success: function(){
$('[data-album-id='+ $albumId + ']').remove();
console.log("YAY DELETE");
},
error: function(){
console.log("SOMETHING AINT WORKING");
}
});
});

// #singlebutton is the name of the submit button to make a new album
$('#singlebutton').on('click', function(event) {
event.preventDefault();
@@ -115,12 +133,20 @@ function renderAlbum(album) {
" </div>" + // end of panel-body

" <div class='panel-footer'>" +
" <div class='col-md-4'>" +
" <input id='delete-button' delete-album-id=" + album._id + " class='deleteBtn btn btn-primary' value='Delete' type='submit'></input>" +
" </div>" +
" </div>" +

" </div>" +
" </div>" +
" <!-- end one album -->";


// getting album div in order to append the HTML
// var $albumDiv = $("#albums");

// $albumDiv.append(albumHtml);
// getting album div in order to append the HTML
// var $albumDiv = $("#albums");
// Here we are appending the above template with album info filled in
@@ -143,32 +169,32 @@ function renderAlbum(album) {

// $albumName.last().html(album.name);
// $artistName.last().html(album.artistName);
// $albumReleaseDate.last().html(album.releaseDate);
// $albumReleaseDate.last().html(album.releaseDate);
}


//this will build out our songs in each album and append it to the list

// function buildSongsHtml (songs) {
// var songStr = "";

// // console.log(songs);
// songs.forEach(function(song) {
// songStr = songStr + "(" + song.trackNumber + ") " + song.name + "&ndash; ";
// });
// // var songHtml =
// // "<li class='list-group-item'>" +
// // "<h4 class='inline-header'> Songs:</h4>" +
// // "<span>" + songStr + "</span>" +
// // "</li>";
// // console.log(songHtml);
// return songStr;
// var songHtml =
// "<li class='list-group-item'>" +
// "<h4 class='inline-header'> Songs:</h4>" +
// "<span>" + songStr + "</span>" +
// "</li>";
// return songHtml;
// }



// function handleNewSongButtonClick(albums) {
// $('#albums').on('click', '.add-song', function(e) {

// var id= $(this).parents('.album').data('album-id'); // "5665ff1678209c64e51b4e7b"

// $('#songModal').attr('album-id', id);
@@ -192,7 +218,7 @@ function renderAlbum(album) {
// }
// });


// console.log(album[0].songs);


@@ -209,32 +235,3 @@ function renderAlbum(album) {
// // });
// });
// }





























32 changes: 32 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -88,6 +88,38 @@ app.post('/api/albums', function create (req, res) {
});
});

//SHOW INDIVIDUAL ALBUM
app.get('/api/albums/:id', function show_api_album (req, res){
var id = req.params.id;
var album = Album.find({_id: id}, function(err, album){
if (err){
console.log("ERROR WITH API ID", err);
}
else{
res.json({album: album});
}
});

});

//DELETE INDIVIDUAL ALBUM
app.delete('/api/albums/:id', function delete_album (req, res){
var id = req.params.id;
console.log("DELETE ALBUM: ", id);

Album.remove({_id: id}, function(err){
if(err){
console.log("ERROR WITH DELETE", err);
}
else{
console.log("REMOVING ALBUM: " + id + " THIS WORKED");
res.status(200).send();
}
});
});