Model url method
This commit is contained in:
parent
e2e2868309
commit
be5a643b55
|
@ -72,4 +72,3 @@ class BeatHaven.Models.Player extends Backbone.Model
|
|||
return false if @move_it_mousedown
|
||||
percent = obj.position / obj.duration * 100
|
||||
$(".player .progress-bar .bar").css(width: "#{percent}%")
|
||||
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
<div class="album">
|
||||
<div class="pic">
|
||||
<img src="{{album_pic}}" alt="{{album_title}}"><br>
|
||||
<a href="" class="btn btn-bh-blue album-add"><i class="icon-plus icon-white"></i> Add to playlist</a>
|
||||
<a href="" class="btn btn-bh-green album-play"><i class="icon-play icon-white"></i> Play</a>
|
||||
<div class="bh-underlay-blue">
|
||||
<a href="" class="btn btn-bh-dark album-add"><i class="icon-plus icon-white"></i> Add to playlist</a>
|
||||
</div>
|
||||
<div class="bh-underlay-green">
|
||||
<a href="" class="btn btn-bh-dark album-play"><i class="icon-play icon-white"></i> Play</a>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="tracks">
|
||||
{{#album_tracks}}
|
||||
|
|
|
@ -33,6 +33,10 @@ class Album < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def url
|
||||
"/album/#{id}"
|
||||
end
|
||||
|
||||
def dump_json
|
||||
Jbuilder.encode do |j|
|
||||
j.album_title title
|
||||
|
@ -42,8 +46,13 @@ class Album < ActiveRecord::Base
|
|||
j.track_id track.id
|
||||
j.track_title track.title
|
||||
j.track_duration track.duration
|
||||
j.track_artists track.artists do |j, artist|
|
||||
j.artist_title artist.name
|
||||
j.artist_url artist.url
|
||||
end
|
||||
j.track_disc track.disc_id
|
||||
j.track_position track.position
|
||||
j.track_length track.length
|
||||
j.meta do |j|
|
||||
j.id track.id
|
||||
j.title track.title
|
||||
|
|
|
@ -10,12 +10,17 @@ class Artist < ActiveRecord::Base
|
|||
pic? && bio?
|
||||
end
|
||||
|
||||
def url
|
||||
"/artist/#{name.gsub(/\s/, "+")}"
|
||||
end
|
||||
|
||||
def dump_json
|
||||
Jbuilder.encode do |j|
|
||||
j.artist_title name
|
||||
j.artist_pic pic
|
||||
j.artist_bio bio
|
||||
j.artist_loaded loaded?
|
||||
j.artist_url url
|
||||
j.artist_albums albums.shown.to_a do |j, album|
|
||||
j.album_title album.title
|
||||
j.album_year album.year
|
||||
|
|
Loading…
Reference in New Issue