1
0
Fork 0

Smart authorized content display

This commit is contained in:
magnolia-fan 2011-11-29 21:32:15 +04:00
parent 927206b03c
commit 74b5619748
8 changed files with 53 additions and 33 deletions

View File

@ -63,6 +63,5 @@ $ ->
_ajax.go $(this).attr("href")
false
$('.foreign-link').live 'click', (e) ->
# window.open($(this).attr('href'))
e.preventDefault();
window.open($(this).attr('href'))
false

View File

@ -21,10 +21,6 @@ class window.Search
if data.status in ['ok', 'loading']
_page.render data
_search.hideSpinner()
if _session.getUser().id?
$('.authorized-action').show()
else
$('.authorized-action').hide()
if data.status is 'loading'
setTimeout () ->
_search.loadArtistData name

View File

@ -12,6 +12,10 @@ class window.Session
@vk_params = _params
setUser: (user) ->
if user.id?
$("body").addClass("authorized")
else
$("body").removeClass("authorized")
log "Setting user ..."
@user = user
log "Hello, #{if user.name? then user.name else "%username%"}!"
@ -38,15 +42,3 @@ class window.Session
_session.setUser ar.user
false
false
displayAuthorizedContent: ->
$('.playlist, .player').show()
$('.ad_here, #login').hide()
$('.authorized-action').show()
$('#authorized').css display: 'block'
hideAuthorizedContent: ->
$('.playlist, .player, #authorized').hide()
$('.ad_here').show()
$('.authorized-action').hide()
$('#login').css display: 'block'

View File

@ -30,7 +30,6 @@ class window.Vkontakte
_session.setUser ar2.user
window._session = _session
_ajax.detectPage()
_session.displayAuthorizedContent()
$('#authorized').css display: 'block'
if ar.ok_reload
window.location.reload()
@ -40,7 +39,6 @@ class window.Vkontakte
false
else
_session.setUser ar.user
_session.displayAuthorizedContent()
window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();
@ -58,7 +56,6 @@ class window.Vkontakte
else
_session = new Session({})
_session.setUser {}
_session.hideAuthorizedContent()
window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();

View File

@ -35,7 +35,6 @@
max-width: 220px;
}
.button-container {
display: none;
text-align: center;
margin-top: 10px;
}
@ -71,13 +70,5 @@
cursor: pointer;
}
}
tr:hover {
.s-duration {
display: none;
}
.s-add {
display: block;
}
}
}
}
}

View File

@ -11,6 +11,6 @@
*= require player
*= require search
*= require settings
* require textpage
*= require authorized
*/

View File

@ -0,0 +1,45 @@
#login, .ad_here {
display: block;
}
#authorized, .player, .set-playlist, .dynamic-playlist {
display: none;
}
.album {
.art .button-container {
display: none;
}
.tracks tr:hover {
.s-duration {
display: block;
}
.s-add {
display: none;
}
}
}
body.authorized {
.album {
.art .button-container {
display: block;
}
.tracks tr:hover {
.s-duration {
display: none;
}
.s-add {
display: block;
}
}
}
.set-playlist, .dynamic-playlist {
display: block;
}
#login, .ad_here {
display: none;
}
#authorized, .player {
display: block;
}
}

View File

@ -24,7 +24,7 @@
%a#logo.page-link{ :href => "/" } BeatHaven
%ul.nav
%li
%a{ :href => "http://blog.beathaven.org/", :target => "_blank" }= t('global.news')
%a.foreign-link{ :href => "https://twitter.com/#!/beat_haven", :target => "_blank" }= t('global.news')
%li
%a.page-link.about{ :href => "/about/" }= t('global.about')
%li