101 lines
3.7 KiB
CoffeeScript
101 lines
3.7 KiB
CoffeeScript
class Pages
|
|
|
|
renderArtist: (data) ->
|
|
artist_info = $ '
|
|
<div class="artist-info">
|
|
<div class="pic">
|
|
<img src="' +data.artist.pic+ '" alt="' +data.artist.name+ '" width="250" />
|
|
</div>
|
|
<h1 class="name" data-id="'+data.artist.id+'">' +data.artist.name+ '</h1>
|
|
<div class="info">
|
|
' +data.artist.desc+ '
|
|
</div>
|
|
</div>'
|
|
|
|
albums_info = $ '<div class="albums"></div>'
|
|
$.each data.albums, (i, album) ->
|
|
if album.year?
|
|
album_info = $ '
|
|
<div class="album">
|
|
<h2 class="name" data-id="'+album.id+'">' +album.name+ ' (' +album.year+ ')</h2>
|
|
<div class="pic">
|
|
<img src="' +(if album.pic then album.pic else '/images/kitteh.png')+ '" alt="' +album.name+ ' by ' +data.artist.name+ '" width="250" height="250"/>
|
|
<div class="add-album-button-container">
|
|
<div class="add-album button gray">Add to Now Playing</div>
|
|
</div>
|
|
</div>
|
|
<div class="tracklist"><ul></ul></div>
|
|
</div>
|
|
<div class="kaboom"></div>'
|
|
|
|
$.each album.tracks.album, (i, track) ->
|
|
track_info = $ '
|
|
<li data-id="'+track.id+'">
|
|
<div class="add-track button gray">+</div>
|
|
<div class="track-container">
|
|
<div class="fade"></div>
|
|
<span class="index">' +(i+1)+ '</span>
|
|
<div class="trackname" title="' +track.name.htmlsafe()+ '">' +track.name+ '</div>
|
|
<div class="length">' +track.duration+ '</div>
|
|
</div>
|
|
</li>'
|
|
|
|
$(album_info).find('.tracklist ul').append(track_info)
|
|
|
|
$(albums_info).append(album_info)
|
|
|
|
$('.data-container').css backgroundImage: 'none'
|
|
$('.data-container .inner').html('').append(artist_info).append(albums_info)
|
|
|
|
yaCounter7596904.hit _ajax.getAnchor(), data.artist.name, _ajax.referer
|
|
_ajax.setTitle data.artist.name
|
|
_beathaven.redrawScrollbar()
|
|
false
|
|
|
|
renderSearch: (data) ->
|
|
$('.data-container').css background: 'url(/images/concrete_wall_2.png) 0 -30px repeat'
|
|
$('.data-container .inner').html data
|
|
|
|
$('.search-container')
|
|
.css('marginLeft', ($('.data-container').width() - 425) / 2 + 'px')
|
|
.css('marginTop', ($('.data-container').height() / 2 - 230)+ 'px')
|
|
.height(($('.data-container').height() - $('#search_form').height()) / 2)
|
|
|
|
setTimeout ->
|
|
$('#search_field').bh_autocomplete
|
|
serviceUrl: '/artist/autocomplete' # Страница для обработки запросов автозаполнения
|
|
minChars: 2 # Минимальная длина запроса для срабатывания автозаполнения
|
|
delimiter: /(,|;)\s*/ # Разделитель для нескольких запросов, символ или регулярное выражение
|
|
maxHeight: 400 # Максимальная высота списка подсказок, в пикселях
|
|
width: 415 # Ширина списка
|
|
zIndex: 9999 # z-index списка
|
|
deferRequestBy: 500 # Задержка запроса (мсек)
|
|
onSelect: ->
|
|
_ajax.loadArtistData $('#search_field').val()
|
|
$('#search_field').focus()
|
|
, 501
|
|
|
|
yaCounter7596904.hit _ajax.getAnchor(), 'Artist Search', _ajax.referer
|
|
_ajax.setTitle 'Artist Search'
|
|
false
|
|
|
|
renderSettings: (data) ->
|
|
unless _session.getUser().id?
|
|
_ajax.go('/search/')
|
|
return false
|
|
$('.data-container').css background: 'none'
|
|
$('.data-container .inner').html data
|
|
yaCounter7596904.hit _ajax.getAnchor(), 'Settings', _ajax.referer
|
|
_ajax.setTitle 'Settings'
|
|
$('.settings-container .tabs .tab').first().trigger 'click'
|
|
false
|
|
|
|
renderTextpage: (data) ->
|
|
$('.data-container').css background: 'url(/images/concrete_wall_2.png) 0 -30px repeat'
|
|
$('.data-container .inner').html data
|
|
_beathaven.redrawScrollbar()
|
|
false
|
|
|
|
$('.about').live 'click', ->
|
|
_ajax.go '/about/'
|
|
false |