1
0
Fork 0

Bonus tracks, user preferred media types

This commit is contained in:
magnolia-fan 2011-09-18 18:59:19 +04:00
parent e69a12ded5
commit c726d1ca44
5 changed files with 17 additions and 35 deletions
app
assets/javascripts
controllers
models
views/artist

View File

@ -230,4 +230,8 @@ $('.add-album').live 'click', ->
item['artist'] = artist
item['album'] = album.name
_player.addTracks album.tracks.album
for item in album.tracks.bonus
item['artist'] = artist
item['album'] = album.name
_player.addTracks album.tracks.bonus
false

View File

@ -51,38 +51,6 @@ class window.Search
$('.suggestions').hide()
false
showArtistPics: (pics) ->
$('.artist_loading.ok, .artist_pics').show()
for pic in pics
if @pics.indexOf(pic) == -1
@pics.push(pic);
$('.artist_pics').append '
<div class="pic">
<img src="' +pic+ '" alt=""/>
</div>'
false
showError: ->
$('.artist_loading.ok, .artist_pics').hide()
$('.artist_loading.failed').show()
@pics = []
$('.search').live 'click', ->
if $('.pulldown').css('display') is 'none'
$('.pulldown').width $('.data-container').width() - 50
$('.pulldown').height 300#38
$('.pulldown').slideDown 'fast', ->
data = '<div class="search-container">'+$('.subpages .search-container').html()+'</div>'
_pages.renderSearch _beathaven.localizeHTML $(data)
_beathaven.adjustSizes()
_beathaven.redrawScrollbar()
else
$('.pulldown').slideUp 'fast', ->
$('.pulldown').height 0
_beathaven.adjustSizes()
_beathaven.redrawScrollbar()
false
$('#search-form').live 'submit', ->
$('#autocomplete-container').remove()
_search.loadArtistData $('#search').val()

View File

@ -2,7 +2,7 @@ require 'open-uri'
require 'musicbrainz'
class ArtistController < ApplicationController
@@default_album_types = ['Album', 'Soundtrack']
@@default_album_types = [:album, :soundtrack]
def data
@data = {
:status => '',
@ -81,9 +81,15 @@ class ArtistController < ApplicationController
pic: artist.pic_url
}
media_types = @@default_album_types
session = Session.find_by_key(session_key)
unless session.nil?
media_types = session.user.music
end
@artist[:albums] = []
artist.albums.each do |album|
if @@default_album_types.include? album.album_type and album.status == 1
if media_types.include? album.album_type.downcase.to_sym and album.status == 1
tmp_album = {id: album.id, name: album.name, year: album.year, pic: album.pic_url}
album_tracks = []
bonus_tracks = []

View File

@ -1,4 +1,4 @@
class User < ActiveRecord::Base
bitmask :music, :as => [:album, :single, :live, :bootleg]
bitmask :music, :as => [:album, :single, :live, :bootleg, :soundtrack]
has_one :session
end

View File

@ -22,3 +22,7 @@
%tr
%td.song-title= track[:name]
%td.song-duration= track[:duration]
- album[:tracks][:bonus].each do |track|
%tr
%td.song-title= track[:name]
%td.song-duration= track[:duration]