This is an awesome app for keeping tack of all the links that you like. You can keep track of which ones you have and have not read. There is also a companion app that you can use in conjunction with this app to see the top 10 hottest links by view. When you mark a url as read it will add to the view count on the Hot Reads app.
$ git clone https://github.com/blackknight75/m4-final-starter
$ bundle intall
$ rake db:create db:migrate
Make sure that you change the URLs in the links.js to your localhost:port#
$.ajax({
method: "PATCH",
url: "http://localhost:3000/api/v1/links/" + data.attributes.link_id.value,
data: {read: false},
success: function(link) {
var linkElement = $(`#${link.id}`)[0]
linkElement.childNodes[5].textContent = "Read: false"
$(`#${link.id}`)[0].childNodes[11].value = "Mark as Read"
$(`#${link.id}`)[0].childNodes[11].classList.value = "mark-as-read"
$(`#${link.id}`).css("background", "white");
$(`#button${link.id}`).off()
$(`#button${link.id}`).click(function() {
markAsRead(this)
});
},
error: function(link) {
// alert error
},
})
}
After you have setup your URLs you can launch your rails server locally to view the app and continue to develop.
$ rails s
$ rails c
$ rspec
- Make sure to switch your URLs in the links.js to your Heroku url.
$.ajax({
method: "PATCH",
url: "https://herokup-app-name.herokuapp.com/api/v1/links/" + data.attributes.link_id.value,
data: {read: false},
success: function(link) {
var linkElement = $(`#${link.id}`)[0]
linkElement.childNodes[5].textContent = "Read: false"
$(`#${link.id}`)[0].childNodes[11].value = "Mark as Read"
$(`#${link.id}`)[0].childNodes[11].classList.value = "mark-as-read"
$(`#${link.id}`).css("background", "white");
$(`#button${link.id}`).off()
$(`#button${link.id}`).click(function() {
markAsRead(this)
});
},
error: function(link) {
// alert error
},
})
}
- Make sure you precompile your JavaScript before you push to your repository and to Heroku
$ rake assets:clobber
$ rake assets:precopile
$ git add .
$ git commit -m "Your commit message"
$ git push origin branch-name
$ git push heroku master
$ git push heroku branch-name:master