Added release date to selected album info

This commit is contained in:
gballan1 2016-11-29 11:51:17 -05:00
parent d98362e55a
commit 24b2cf76bc
4 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,10 @@ class Album extends Eloquent {
return $this->hasMany('Fieldprotocol\Music\Song'); return $this->hasMany('Fieldprotocol\Music\Song');
} }
public function releaseDate() {
return date('F jS, Y', strtotime($this->release_date));
}
public function releaseYear() { public function releaseYear() {
return date('Y', strtotime($this->release_date)); return date('Y', strtotime($this->release_date));
} }

View File

@ -23,6 +23,7 @@
<img id="album-artwork" class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}"> <img id="album-artwork" class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}">
<div class="caption"> <div class="caption">
<h3 id="album-title">{{ albums[0].title }}</h3> <h3 id="album-title">{{ albums[0].title }}</h3>
<h4 id="album-release">{{ albums[0].releaseDate }}</h4>
{% if albums[0].description %} {% if albums[0].description %}
<hr /> <hr />
<p id="album-description">{{ albums[0].description }}</p> <p id="album-description">{{ albums[0].description }}</p>

View File

@ -24,6 +24,7 @@
<img id="album-artwork" class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}"> <img id="album-artwork" class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}">
<div class="caption"> <div class="caption">
<h3 id="album-title">{{ albums[0].title }}</h3> <h3 id="album-title">{{ albums[0].title }}</h3>
<h4 id="album-release">{{ albums[0].releaseDate }}</h4>
{% if albums[0].description %} {% if albums[0].description %}
<hr /> <hr />
<p id="album-description">{{ albums[0].description }}</p> <p id="album-description">{{ albums[0].description }}</p>

View File

@ -45,6 +45,8 @@ function getAlbumInfo(albumElem) {
$('#album-artwork').attr('src', json.album_art); $('#album-artwork').attr('src', json.album_art);
// change album title // change album title
$('#album-title').text(json.title); $('#album-title').text(json.title);
// change album release date
$('#album-release').text(new Date(json.release_date, "January 25 2015"))
// change album description // change album description
$('#album-description').text(json.description); $('#album-description').text(json.description);
}); });