2011-09-09 22:13:02 +00:00
|
|
|
class window.Page
|
|
|
|
|
2011-11-27 12:37:51 +00:00
|
|
|
data: {}
|
|
|
|
html: ""
|
|
|
|
status: ""
|
2011-11-27 09:56:10 +00:00
|
|
|
|
|
|
|
render: (params) ->
|
|
|
|
@data = params.data
|
|
|
|
@html = params.html
|
|
|
|
@title = params.title
|
|
|
|
@status = params.status
|
|
|
|
|
2011-11-27 12:37:51 +00:00
|
|
|
log "Rendering page titled \"#{@title}\" with #{params.renderer} renderer ..."
|
2011-11-27 09:56:10 +00:00
|
|
|
$('#content').html(@html)
|
|
|
|
|
2011-11-27 12:37:51 +00:00
|
|
|
if params.callback?
|
|
|
|
log "Executing page callback action #{params.callback.object}##{params.callback.action} ..."
|
|
|
|
window["_"+params.callback.object][params.callback.action](@data)
|
|
|
|
|
2011-11-27 09:56:10 +00:00
|
|
|
# yaCounter7596904.hit _ajax.getAnchor(), @title, _ajax.referer
|
|
|
|
_ajax.setTitle @title
|
|
|
|
false
|
|
|
|
|
2011-09-09 22:13:02 +00:00
|
|
|
print: (html) ->
|
|
|
|
$('#content').html(html)
|
|
|
|
false
|
2011-09-09 23:30:03 +00:00
|
|
|
|
|
|
|
renderArtist: (data) ->
|
|
|
|
$('#content').html(data)
|
|
|
|
|
|
|
|
yaCounter7596904.hit _ajax.getAnchor(), data.artist.name, _ajax.referer
|
|
|
|
_ajax.setTitle data.artist.name
|
|
|
|
false
|
|
|
|
|
|
|
|
renderSearch: (data) ->
|
|
|
|
$('.pulldown').html data
|
|
|
|
setTimeout ->
|
|
|
|
$('.search_field').first().bh_autocomplete
|
|
|
|
serviceUrl: '/artist/autocomplete' # Страница для обработки запросов автозаполнения
|
|
|
|
minChars: 2 # Минимальная длина запроса для срабатывания автозаполнения
|
|
|
|
delimiter: /(,|;)\s*/ # Разделитель для нескольких запросов, символ или регулярное выражение
|
|
|
|
maxHeight: 400 # Максимальная высота списка подсказок, в пикселях
|
|
|
|
width: 415 # Ширина списка
|
|
|
|
zIndex: 9999 # z-index списка
|
|
|
|
deferRequestBy: 500 # Задержка запроса (мсек)
|
|
|
|
onSelect: ->
|
|
|
|
_ajax.loadArtistData $('.search_field').first().val()
|
|
|
|
$('.search_field').first().focus()
|
|
|
|
, 1
|
|
|
|
false
|
2011-06-29 04:11:54 +00:00
|
|
|
|
2011-09-09 23:30:03 +00:00
|
|
|
$ ->
|
|
|
|
$('body').live 'click', ->
|
|
|
|
$('.dropdown-toggle, .menu').parent('li').removeClass('open')
|
|
|
|
false
|
|
|
|
$('.dropdown-toggle, .menu').live 'click', ->
|
|
|
|
$(this).parent('li').toggleClass('open')
|
|
|
|
false
|
2011-09-15 04:35:48 +00:00
|
|
|
$('.dropdown-menu li a').live 'click', ->
|
|
|
|
$(this).parent().parent().parent().toggleClass('open')
|
2011-09-26 10:51:52 +00:00
|
|
|
false
|
2011-11-27 12:37:51 +00:00
|
|
|
$('.page-link').live 'click', (e) ->
|
|
|
|
_ajax.go $(this).attr("href")
|
|
|
|
false
|
2011-09-26 11:03:52 +00:00
|
|
|
$('.foreign-link').live 'click', (e) ->
|
2011-09-26 10:51:52 +00:00
|
|
|
# window.open($(this).attr('href'))
|
|
|
|
e.preventDefault();
|
2011-09-09 23:30:03 +00:00
|
|
|
false
|