About page, lots of fixin
This commit is contained in:
parent
08295f01aa
commit
bfd1cd3ff8
@ -20,10 +20,10 @@ class Ajax
|
|||||||
else if data.status == 'loading_failed'
|
else if data.status == 'loading_failed'
|
||||||
_search.hideSpinner()
|
_search.hideSpinner()
|
||||||
_search.showError()
|
_search.showError()
|
||||||
|
_beathaven.redrawScrollbar()
|
||||||
else
|
else
|
||||||
_ajax.setArchor '/artist/' +name+ '/'
|
_ajax.setArchor '/artist/' +name+ '/'
|
||||||
_pages.renderArtist data
|
_pages.renderArtist data
|
||||||
_beathaven.redrawScrollbar()
|
|
||||||
false
|
false
|
||||||
|
|
||||||
loadSearchPage: ->
|
loadSearchPage: ->
|
||||||
@ -44,6 +44,12 @@ class Ajax
|
|||||||
_beathaven.redrawScrollbar()
|
_beathaven.redrawScrollbar()
|
||||||
false
|
false
|
||||||
|
|
||||||
|
loadAboutPage: ->
|
||||||
|
$.get '/templates/about.html', (data) ->
|
||||||
|
_pages.renderTextpage data
|
||||||
|
_ajax.setTitle 'About'
|
||||||
|
false
|
||||||
|
|
||||||
setArchor: (anchor) ->
|
setArchor: (anchor) ->
|
||||||
@referer = this.getAnchor()
|
@referer = this.getAnchor()
|
||||||
window.location.hash = '#' +anchor
|
window.location.hash = '#' +anchor
|
||||||
@ -65,6 +71,8 @@ class Ajax
|
|||||||
_ajax.loadSearchPage();
|
_ajax.loadSearchPage();
|
||||||
else if _ajax.getAnchor().match /\/settings\//
|
else if _ajax.getAnchor().match /\/settings\//
|
||||||
_ajax.loadSettingsPage()
|
_ajax.loadSettingsPage()
|
||||||
|
else if _ajax.getAnchor().match /\/about\//
|
||||||
|
_ajax.loadAboutPage()
|
||||||
else
|
else
|
||||||
_ajax.loadSearchPage()
|
_ajax.loadSearchPage()
|
||||||
false
|
false
|
||||||
|
@ -10,7 +10,7 @@ _settings = null
|
|||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
l = document.location
|
l = document.location
|
||||||
if l.host not in ['beathaven.org', 'localhost']
|
if l.host not in ['beathaven.org', 'local.beathaven.org']
|
||||||
l.href = 'http://beathaven.org/'+ l.hash
|
l.href = 'http://beathaven.org/'+ l.hash
|
||||||
|
|
||||||
_beathaven = new BeatHaven()
|
_beathaven = new BeatHaven()
|
||||||
@ -30,7 +30,8 @@ class BeatHaven
|
|||||||
this.adjustSizes()
|
this.adjustSizes()
|
||||||
this.checkRedrawScrollbar()
|
this.checkRedrawScrollbar()
|
||||||
|
|
||||||
_vkontakte = new Vkontakte(if document.location.host == 'beathaven.org' then 2335068 else 2383163)
|
# if document.location.host == 'beathaven.org' then 2335068 else 2383163
|
||||||
|
_vkontakte = new Vkontakte(2335068)
|
||||||
_vkontakte.init()
|
_vkontakte.init()
|
||||||
|
|
||||||
_ajax = new Ajax()
|
_ajax = new Ajax()
|
||||||
|
@ -49,6 +49,7 @@ class Pages
|
|||||||
|
|
||||||
yaCounter7596904.hit _ajax.getAnchor(), data.artist.name, _ajax.referer
|
yaCounter7596904.hit _ajax.getAnchor(), data.artist.name, _ajax.referer
|
||||||
_ajax.setTitle data.artist.name
|
_ajax.setTitle data.artist.name
|
||||||
|
_beathaven.redrawScrollbar()
|
||||||
false
|
false
|
||||||
|
|
||||||
renderSearch: (data) ->
|
renderSearch: (data) ->
|
||||||
@ -79,9 +80,22 @@ class Pages
|
|||||||
false
|
false
|
||||||
|
|
||||||
renderSettings: (data) ->
|
renderSettings: (data) ->
|
||||||
|
unless _session.getUser().name?
|
||||||
|
_ajax.go('/search/')
|
||||||
|
return false
|
||||||
$('.data-container').css background: 'none'
|
$('.data-container').css background: 'none'
|
||||||
$('.data-container .inner').html data
|
$('.data-container .inner').html data
|
||||||
yaCounter7596904.hit _ajax.getAnchor(), 'Settings', _ajax.referer
|
yaCounter7596904.hit _ajax.getAnchor(), 'Settings', _ajax.referer
|
||||||
_ajax.setTitle 'Settings'
|
_ajax.setTitle 'Settings'
|
||||||
$('.settings-container .tabs .tab').first().trigger 'click'
|
$('.settings-container .tabs .tab').first().trigger 'click'
|
||||||
false
|
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
|
@ -24,3 +24,7 @@ class Session
|
|||||||
q_params[key] = val
|
q_params[key] = val
|
||||||
$.post url, q_params, callback
|
$.post url, q_params, callback
|
||||||
false
|
false
|
||||||
|
|
||||||
|
reloadSession: ->
|
||||||
|
_session.query '/user/auth', {}, (ar) ->
|
||||||
|
_session.setUser ar.user
|
@ -2,9 +2,11 @@ class Settings
|
|||||||
|
|
||||||
getAccountInfo: (callback) ->
|
getAccountInfo: (callback) ->
|
||||||
_session.query '/user/update/', {}, callback
|
_session.query '/user/update/', {}, callback
|
||||||
|
false
|
||||||
|
|
||||||
saveAccountInfo: (params, callback) ->
|
saveAccountInfo: (params, callback) ->
|
||||||
_session.query '/user/update', params, callback
|
_session.query '/user/update', params, callback
|
||||||
|
false
|
||||||
|
|
||||||
loadFormData: (form) ->
|
loadFormData: (form) ->
|
||||||
if form == 'account'
|
if form == 'account'
|
||||||
@ -13,10 +15,21 @@ class Settings
|
|||||||
else if form == 'lastfm'
|
else if form == 'lastfm'
|
||||||
if _session.getUser().lastfm_username
|
if _session.getUser().lastfm_username
|
||||||
$('.form-container input[name$="username"]').first().val _session.getUser().lastfm_username
|
$('.form-container input[name$="username"]').first().val _session.getUser().lastfm_username
|
||||||
|
false
|
||||||
|
|
||||||
|
updateLastfmLogin: ->
|
||||||
|
if window.lastfm_popup.closed
|
||||||
|
_session.query '/user/auth', {}, (ar) ->
|
||||||
|
_session.setUser ar.user
|
||||||
|
_settings.loadFormData 'lastfm'
|
||||||
|
else
|
||||||
|
setTimeout _settings.updateLastfmLogin, 100
|
||||||
|
false
|
||||||
|
|
||||||
|
|
||||||
$('.settings') .live 'click', ->
|
$('.settings') .live 'click', ->
|
||||||
_ajax.go('/settings/');
|
_ajax.go('/settings/');
|
||||||
|
false
|
||||||
|
|
||||||
$('.settings-container .tabs .tab').live 'click', ->
|
$('.settings-container .tabs .tab').live 'click', ->
|
||||||
if not $(this).hasClass 'active'
|
if not $(this).hasClass 'active'
|
||||||
@ -24,9 +37,12 @@ $('.settings-container .tabs .tab').live 'click', ->
|
|||||||
$(this).addClass 'active'
|
$(this).addClass 'active'
|
||||||
$('.form-container').html $('.forms .'+ $(this).attr 'data-fieldset').html()
|
$('.form-container').html $('.forms .'+ $(this).attr 'data-fieldset').html()
|
||||||
_settings.loadFormData $(this).attr 'data-fieldset'
|
_settings.loadFormData $(this).attr 'data-fieldset'
|
||||||
|
false
|
||||||
|
|
||||||
$('.lastfm-connect') .live 'click', ->
|
$('.lastfm-connect') .live 'click', ->
|
||||||
window.open _session.getUser().lastfm_login_url
|
window.lastfm_popup = window.open _session.getUser().lastfm_login_url
|
||||||
|
setTimeout _settings.updateLastfmLogin, 100
|
||||||
|
false
|
||||||
|
|
||||||
$('.settings-container .form input').live 'blur', ->
|
$('.settings-container .form input').live 'blur', ->
|
||||||
active_tab = $('.settings-container .tabs .tab.active').attr 'data-fieldset'
|
active_tab = $('.settings-container .tabs .tab.active').attr 'data-fieldset'
|
||||||
@ -35,4 +51,6 @@ $('.settings-container .form input').live 'blur', ->
|
|||||||
username: $('.settings-container .form input[name$="username"]').first().val()
|
username: $('.settings-container .form input[name$="username"]').first().val()
|
||||||
email: $('.settings-container .form input[name$="email"]').first().val()
|
email: $('.settings-container .form input[name$="email"]').first().val()
|
||||||
_settings.saveAccountInfo params, ->
|
_settings.saveAccountInfo params, ->
|
||||||
$('#header-container .hello .greating').text 'Hi there, ' +(if params.username.length > 0 then params.username else '%username%')+ '!'
|
$('.header-container .hello .greating span').text (if params.username.length > 0 then params.username else '%username%')
|
||||||
|
false
|
||||||
|
false
|
@ -1,15 +1,24 @@
|
|||||||
class Vkontakte
|
class Vkontakte
|
||||||
|
|
||||||
qr: null
|
qr: null
|
||||||
|
api_id: null
|
||||||
|
|
||||||
constructor: (@api_id) ->
|
constructor: (@api_id) ->
|
||||||
|
|
||||||
|
getApiId: ->
|
||||||
|
@api_id
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@qr = []
|
@qr = []
|
||||||
VK.init
|
|
||||||
apiId: @api_id
|
|
||||||
|
|
||||||
VK.Auth.getLoginStatus this.authInfo
|
window.vkAsyncInit = ->
|
||||||
|
VK.init apiId: _vkontakte.getApiId()
|
||||||
|
VK.Auth.getLoginStatus _vkontakte.authInfo
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout ->
|
||||||
|
$('#vk_api_transport').append('<script async="async" src="http://vkontakte.ru/js/api/openapi.js"></script>')
|
||||||
|
, 0
|
||||||
|
|
||||||
authInfo: (response) ->
|
authInfo: (response) ->
|
||||||
if typeof response isnt 'undefined' and response.session
|
if typeof response isnt 'undefined' and response.session
|
||||||
@ -26,16 +35,18 @@ class Vkontakte
|
|||||||
_session.query '/user/update', name: r.response, (ar2) ->
|
_session.query '/user/update', name: r.response, (ar2) ->
|
||||||
_session.setUser ar2.user
|
_session.setUser ar2.user
|
||||||
$('.header-container .hello .greating')
|
$('.header-container .hello .greating')
|
||||||
.text 'Hi there, ' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '!'
|
.html 'Tēnā koe, <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!'
|
||||||
else
|
else
|
||||||
_session.setUser ar.user
|
_session.setUser ar.user
|
||||||
|
|
||||||
|
$('.header-container .hello').show()
|
||||||
$('.header-container .hello .greating')
|
$('.header-container .hello .greating')
|
||||||
.text 'Hi there, ' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '!'
|
.html 'Tēnā koe, <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!'
|
||||||
else
|
else
|
||||||
_session = new Session({})
|
_session = new Session({})
|
||||||
|
_session.setUser {}
|
||||||
$('#vk_login, .auth_notice').css display: 'block'
|
$('#vk_login, .auth_notice').css display: 'block'
|
||||||
$('#vk_logout').hide()
|
$('.header-container .hello').hide()
|
||||||
window._session = _session
|
window._session = _session
|
||||||
|
|
||||||
loadTracksData: (artist, track, duration, callback) ->
|
loadTracksData: (artist, track, duration, callback) ->
|
||||||
@ -96,8 +107,13 @@ class Vkontakte
|
|||||||
@qr[query]
|
@qr[query]
|
||||||
false
|
false
|
||||||
|
|
||||||
$ ->
|
$('#vk_login').live 'click', ->
|
||||||
$('#vk_login').click ->
|
VK.Auth.login (response) ->
|
||||||
VK.Auth.login _vkontakte.authInfo(), 8
|
_vkontakte.authInfo(response)
|
||||||
$('#vk_logout').click ->
|
false
|
||||||
VK.Auth.logout _vkontakte.authInfo()
|
, 8
|
||||||
|
false
|
||||||
|
$('#vk_logout').live 'click', ->
|
||||||
|
_ajax.go '/search/';
|
||||||
|
VK.Auth.logout _vkontakte.authInfo
|
||||||
|
false
|
||||||
|
@ -4,7 +4,8 @@ class ApplicationController < ActionController::Base
|
|||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
|
|
||||||
def authorized?
|
def authorized?
|
||||||
secret_key = request.host == 'beathaven.org' ? 'sdgwSbl3nNE4ZxafuPrp' : 's5zyjb693z6uV4rbhEyc'
|
# secret_key = request.host == 'beathaven.org' ? 'sdgwSbl3nNE4ZxafuPrp' : 's5zyjb693z6uV4rbhEyc'
|
||||||
|
secret_key = 'sdgwSbl3nNE4ZxafuPrp'
|
||||||
unless params[:expire].nil? or params[:mid].nil? or params[:secret].nil? or params[:sid].nil? or params[:sig].nil?
|
unless params[:expire].nil? or params[:mid].nil? or params[:secret].nil? or params[:sid].nil? or params[:sig].nil?
|
||||||
# Calculating hash
|
# Calculating hash
|
||||||
hash = 'expire='+ params[:expire] +'mid='+ params[:mid] +'secret='+ params[:secret] +'sid='+ params[:sid] + secret_key
|
hash = 'expire='+ params[:expire] +'mid='+ params[:mid] +'secret='+ params[:secret] +'sid='+ params[:sid] + secret_key
|
||||||
|
@ -4,6 +4,10 @@ class ArtistController < ApplicationController
|
|||||||
@@default_album_types = ['Album', 'Soundtrack']
|
@@default_album_types = ['Album', 'Soundtrack']
|
||||||
def data
|
def data
|
||||||
data = {}
|
data = {}
|
||||||
|
if params[:name].nil? or params[:name].length == 0
|
||||||
|
render :json => {status: 'loading_failed', pics: []}
|
||||||
|
return
|
||||||
|
end
|
||||||
name = params[:name].gsub('%20', ' ').gsub('+', ' ')
|
name = params[:name].gsub('%20', ' ').gsub('+', ' ')
|
||||||
artist = Artist.find_by_name(name)
|
artist = Artist.find_by_name(name)
|
||||||
if artist and artist.status == 0
|
if artist and artist.status == 0
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
class Artist < ActiveRecord::Base
|
class Artist < ActiveRecord::Base
|
||||||
has_many :albums, :order => 'year ASC, id ASC', :dependent => :destroy
|
has_many :albums, :order => 'pic_url DESC, year ASC, id ASC', :dependent => :destroy
|
||||||
end
|
end
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/beathaven.css" />
|
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/beathaven.css" />
|
||||||
<script type="text/javascript" charset="windows-1251" src="http://vkontakte.ru/js/api/openapi.js"></script>
|
|
||||||
<%= javascript_include_tag "jquery/jquery.min.js" %>
|
<%= javascript_include_tag "jquery/jquery.min.js" %>
|
||||||
<%= javascript_include_tag "jquery/jquery-ui/js/jquery-ui-1.8.13.custom.min.js" %>
|
<%= javascript_include_tag "jquery/jquery-ui/js/jquery-ui-1.8.13.custom.min.js" %>
|
||||||
<%= javascript_include_tag "jquery/jquery.autocomplete.js" %>
|
<%= javascript_include_tag "jquery/jquery.autocomplete.js" %>
|
||||||
@ -59,12 +58,13 @@
|
|||||||
<div class="header-container">
|
<div class="header-container">
|
||||||
<div class="hello">
|
<div class="hello">
|
||||||
<span class="greating"></span>
|
<span class="greating"></span>
|
||||||
<div class="settings"></div>
|
<div class="settings settings-button"></div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="navigation">
|
<ul class="navigation">
|
||||||
<li class="logo search">BeatHaven<div class="version">0.4</div></li>
|
<li class="logo search">BeatHaven<div class="version">0.4</div></li>
|
||||||
<li class="search">Search</li>
|
<li class="search">Search</li>
|
||||||
<li><a href="https://twitter.com/#!/beat_haven" target="_blank">News</a></li>
|
<li><a href="https://twitter.com/#!/beat_haven" target="_blank">News</a></li>
|
||||||
|
<li class="about">About</li>
|
||||||
<li class="vk_auth" id="vk_login">Login</li>
|
<li class="vk_auth" id="vk_login">Login</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,22 +9,22 @@ Ajax = (function() {
|
|||||||
if (data.status != null) {
|
if (data.status != null) {
|
||||||
if (data.status === 'loading') {
|
if (data.status === 'loading') {
|
||||||
_search.showArtistPics(data.pics);
|
_search.showArtistPics(data.pics);
|
||||||
return setTimeout(function() {
|
setTimeout(function() {
|
||||||
return _ajax.loadArtistData(name);
|
return _ajax.loadArtistData(name);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} else if (data.status === 'corrected') {
|
} else if (data.status === 'corrected') {
|
||||||
return _ajax.loadArtistData(data.page);
|
_ajax.loadArtistData(data.page);
|
||||||
} else if (data.status === 'suggestions') {
|
} else if (data.status === 'suggestions') {
|
||||||
_search.hideSpinner();
|
_search.hideSpinner();
|
||||||
return _search.showSuggestions(data.values);
|
_search.showSuggestions(data.values);
|
||||||
} else if (data.status === 'loading_failed') {
|
} else if (data.status === 'loading_failed') {
|
||||||
_search.hideSpinner();
|
_search.hideSpinner();
|
||||||
return _search.showError();
|
_search.showError();
|
||||||
}
|
}
|
||||||
|
return _beathaven.redrawScrollbar();
|
||||||
} else {
|
} else {
|
||||||
_ajax.setArchor('/artist/' + name + '/');
|
_ajax.setArchor('/artist/' + name + '/');
|
||||||
_pages.renderArtist(data);
|
return _pages.renderArtist(data);
|
||||||
return _beathaven.redrawScrollbar();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
@ -50,6 +50,13 @@ Ajax = (function() {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
Ajax.prototype.loadAboutPage = function() {
|
||||||
|
$.get('/templates/about.html', function(data) {
|
||||||
|
_pages.renderTextpage(data);
|
||||||
|
return _ajax.setTitle('About');
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
};
|
||||||
Ajax.prototype.setArchor = function(anchor) {
|
Ajax.prototype.setArchor = function(anchor) {
|
||||||
this.referer = this.getAnchor();
|
this.referer = this.getAnchor();
|
||||||
return window.location.hash = '#' + anchor;
|
return window.location.hash = '#' + anchor;
|
||||||
@ -72,6 +79,8 @@ Ajax = (function() {
|
|||||||
_ajax.loadSearchPage();
|
_ajax.loadSearchPage();
|
||||||
} else if (_ajax.getAnchor().match(/\/settings\//)) {
|
} else if (_ajax.getAnchor().match(/\/settings\//)) {
|
||||||
_ajax.loadSettingsPage();
|
_ajax.loadSettingsPage();
|
||||||
|
} else if (_ajax.getAnchor().match(/\/about\//)) {
|
||||||
|
_ajax.loadAboutPage();
|
||||||
} else {
|
} else {
|
||||||
_ajax.loadSearchPage();
|
_ajax.loadSearchPage();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ _settings = null;
|
|||||||
$(function() {
|
$(function() {
|
||||||
var l, _ref;
|
var l, _ref;
|
||||||
l = document.location;
|
l = document.location;
|
||||||
if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'localhost') {
|
if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'local.beathaven.org') {
|
||||||
l.href = 'http://beathaven.org/' + l.hash;
|
l.href = 'http://beathaven.org/' + l.hash;
|
||||||
}
|
}
|
||||||
_beathaven = new BeatHaven();
|
_beathaven = new BeatHaven();
|
||||||
@ -28,7 +28,7 @@ BeatHaven = (function() {
|
|||||||
BeatHaven.prototype.init = function() {
|
BeatHaven.prototype.init = function() {
|
||||||
this.adjustSizes();
|
this.adjustSizes();
|
||||||
this.checkRedrawScrollbar();
|
this.checkRedrawScrollbar();
|
||||||
_vkontakte = new Vkontakte(document.location.host === 'beathaven.org' ? 2335068 : 2383163);
|
_vkontakte = new Vkontakte(2335068);
|
||||||
_vkontakte.init();
|
_vkontakte.init();
|
||||||
_ajax = new Ajax();
|
_ajax = new Ajax();
|
||||||
_player = new Player();
|
_player = new Player();
|
||||||
|
@ -52,6 +52,7 @@ Pages = (function() {
|
|||||||
$('.data-container .inner').html('').append(artist_info).append(albums_info);
|
$('.data-container .inner').html('').append(artist_info).append(albums_info);
|
||||||
yaCounter7596904.hit(_ajax.getAnchor(), data.artist.name, _ajax.referer);
|
yaCounter7596904.hit(_ajax.getAnchor(), data.artist.name, _ajax.referer);
|
||||||
_ajax.setTitle(data.artist.name);
|
_ajax.setTitle(data.artist.name);
|
||||||
|
_beathaven.redrawScrollbar();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
Pages.prototype.renderSearch = function(data) {
|
Pages.prototype.renderSearch = function(data) {
|
||||||
@ -80,6 +81,10 @@ Pages = (function() {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
Pages.prototype.renderSettings = function(data) {
|
Pages.prototype.renderSettings = function(data) {
|
||||||
|
if (_session.getUser().name == null) {
|
||||||
|
_ajax.go('/search/');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$('.data-container').css({
|
$('.data-container').css({
|
||||||
background: 'none'
|
background: 'none'
|
||||||
});
|
});
|
||||||
@ -89,5 +94,17 @@ Pages = (function() {
|
|||||||
$('.settings-container .tabs .tab').first().trigger('click');
|
$('.settings-container .tabs .tab').first().trigger('click');
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
Pages.prototype.renderTextpage = function(data) {
|
||||||
|
$('.data-container').css({
|
||||||
|
background: 'url(/images/concrete_wall_2.png) 0 -30px repeat'
|
||||||
|
});
|
||||||
|
$('.data-container .inner').html(data);
|
||||||
|
_beathaven.redrawScrollbar();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
return Pages;
|
return Pages;
|
||||||
})();
|
})();
|
||||||
|
$('.about').live('click', function() {
|
||||||
|
_ajax.go('/about/');
|
||||||
|
return false;
|
||||||
|
});
|
@ -30,5 +30,10 @@ Session = (function() {
|
|||||||
$.post(url, q_params, callback);
|
$.post(url, q_params, callback);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
Session.prototype.reloadSession = function() {
|
||||||
|
return _session.query('/user/auth', {}, function(ar) {
|
||||||
|
return _session.setUser(ar.user);
|
||||||
|
});
|
||||||
|
};
|
||||||
return Session;
|
return Session;
|
||||||
})();
|
})();
|
@ -2,36 +2,54 @@ var Settings;
|
|||||||
Settings = (function() {
|
Settings = (function() {
|
||||||
function Settings() {}
|
function Settings() {}
|
||||||
Settings.prototype.getAccountInfo = function(callback) {
|
Settings.prototype.getAccountInfo = function(callback) {
|
||||||
return _session.query('/user/update/', {}, callback);
|
_session.query('/user/update/', {}, callback);
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
Settings.prototype.saveAccountInfo = function(params, callback) {
|
Settings.prototype.saveAccountInfo = function(params, callback) {
|
||||||
return _session.query('/user/update', params, callback);
|
_session.query('/user/update', params, callback);
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
Settings.prototype.loadFormData = function(form) {
|
Settings.prototype.loadFormData = function(form) {
|
||||||
if (form === 'account') {
|
if (form === 'account') {
|
||||||
$('.settings-container .form input[name$="username"]').val(_session.getUser().name);
|
$('.settings-container .form input[name$="username"]').val(_session.getUser().name);
|
||||||
return $('.settings-container .form input[name$="email"]').val(_session.getUser().email);
|
$('.settings-container .form input[name$="email"]').val(_session.getUser().email);
|
||||||
} else if (form === 'lastfm') {
|
} else if (form === 'lastfm') {
|
||||||
if (_session.getUser().lastfm_username) {
|
if (_session.getUser().lastfm_username) {
|
||||||
return $('.form-container input[name$="username"]').first().val(_session.getUser().lastfm_username);
|
$('.form-container input[name$="username"]').first().val(_session.getUser().lastfm_username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
Settings.prototype.updateLastfmLogin = function() {
|
||||||
|
if (window.lastfm_popup.closed) {
|
||||||
|
_session.query('/user/auth', {}, function(ar) {
|
||||||
|
_session.setUser(ar.user);
|
||||||
|
return _settings.loadFormData('lastfm');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setTimeout(_settings.updateLastfmLogin, 100);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
return Settings;
|
return Settings;
|
||||||
})();
|
})();
|
||||||
$('.settings').live('click', function() {
|
$('.settings').live('click', function() {
|
||||||
return _ajax.go('/settings/');
|
_ajax.go('/settings/');
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
$('.settings-container .tabs .tab').live('click', function() {
|
$('.settings-container .tabs .tab').live('click', function() {
|
||||||
if (!$(this).hasClass('active')) {
|
if (!$(this).hasClass('active')) {
|
||||||
$('.settings-container .tabs .tab').removeClass('active');
|
$('.settings-container .tabs .tab').removeClass('active');
|
||||||
$(this).addClass('active');
|
$(this).addClass('active');
|
||||||
$('.form-container').html($('.forms .' + $(this).attr('data-fieldset')).html());
|
$('.form-container').html($('.forms .' + $(this).attr('data-fieldset')).html());
|
||||||
return _settings.loadFormData($(this).attr('data-fieldset'));
|
_settings.loadFormData($(this).attr('data-fieldset'));
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
$('.lastfm-connect').live('click', function() {
|
$('.lastfm-connect').live('click', function() {
|
||||||
return window.open(_session.getUser().lastfm_login_url);
|
window.lastfm_popup = window.open(_session.getUser().lastfm_login_url);
|
||||||
|
setTimeout(_settings.updateLastfmLogin, 100);
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
$('.settings-container .form input').live('blur', function() {
|
$('.settings-container .form input').live('blur', function() {
|
||||||
var active_tab, params;
|
var active_tab, params;
|
||||||
@ -41,8 +59,10 @@ $('.settings-container .form input').live('blur', function() {
|
|||||||
username: $('.settings-container .form input[name$="username"]').first().val(),
|
username: $('.settings-container .form input[name$="username"]').first().val(),
|
||||||
email: $('.settings-container .form input[name$="email"]').first().val()
|
email: $('.settings-container .form input[name$="email"]').first().val()
|
||||||
};
|
};
|
||||||
return _settings.saveAccountInfo(params, function() {
|
_settings.saveAccountInfo(params, function() {
|
||||||
return $('#header-container .hello .greating').text('Hi there, ' + (params.username.length > 0 ? params.username : '%username%') + '!');
|
$('.header-container .hello .greating span').text((params.username.length > 0 ? params.username : '%username%'));
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
@ -1,15 +1,24 @@
|
|||||||
var Vkontakte;
|
var Vkontakte;
|
||||||
Vkontakte = (function() {
|
Vkontakte = (function() {
|
||||||
Vkontakte.prototype.qr = null;
|
Vkontakte.prototype.qr = null;
|
||||||
|
Vkontakte.prototype.api_id = null;
|
||||||
function Vkontakte(api_id) {
|
function Vkontakte(api_id) {
|
||||||
this.api_id = api_id;
|
this.api_id = api_id;
|
||||||
}
|
}
|
||||||
|
Vkontakte.prototype.getApiId = function() {
|
||||||
|
return this.api_id;
|
||||||
|
};
|
||||||
Vkontakte.prototype.init = function() {
|
Vkontakte.prototype.init = function() {
|
||||||
this.qr = [];
|
this.qr = [];
|
||||||
VK.init({
|
window.vkAsyncInit = function() {
|
||||||
apiId: this.api_id
|
VK.init({
|
||||||
});
|
apiId: _vkontakte.getApiId()
|
||||||
return VK.Auth.getLoginStatus(this.authInfo);
|
});
|
||||||
|
return VK.Auth.getLoginStatus(_vkontakte.authInfo);
|
||||||
|
};
|
||||||
|
return setTimeout(function() {
|
||||||
|
return $('#vk_api_transport').append('<script async="async" src="http://vkontakte.ru/js/api/openapi.js"></script>');
|
||||||
|
}, 0);
|
||||||
};
|
};
|
||||||
Vkontakte.prototype.authInfo = function(response) {
|
Vkontakte.prototype.authInfo = function(response) {
|
||||||
var _session;
|
var _session;
|
||||||
@ -31,20 +40,22 @@ Vkontakte = (function() {
|
|||||||
name: r.response
|
name: r.response
|
||||||
}, function(ar2) {
|
}, function(ar2) {
|
||||||
_session.setUser(ar2.user);
|
_session.setUser(ar2.user);
|
||||||
return $('.header-container .hello .greating').text('Hi there, ' + (_session.getUser().name ? _session.getUser().name : '%username%') + '!');
|
return $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_session.setUser(ar.user);
|
_session.setUser(ar.user);
|
||||||
}
|
}
|
||||||
return $('.header-container .hello .greating').text('Hi there, ' + (_session.getUser().name ? _session.getUser().name : '%username%') + '!');
|
$('.header-container .hello').show();
|
||||||
|
return $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_session = new Session({});
|
_session = new Session({});
|
||||||
|
_session.setUser({});
|
||||||
$('#vk_login, .auth_notice').css({
|
$('#vk_login, .auth_notice').css({
|
||||||
display: 'block'
|
display: 'block'
|
||||||
});
|
});
|
||||||
$('#vk_logout').hide();
|
$('.header-container .hello').hide();
|
||||||
}
|
}
|
||||||
return window._session = _session;
|
return window._session = _session;
|
||||||
};
|
};
|
||||||
@ -117,11 +128,15 @@ Vkontakte = (function() {
|
|||||||
};
|
};
|
||||||
return Vkontakte;
|
return Vkontakte;
|
||||||
})();
|
})();
|
||||||
$(function() {
|
$('#vk_login').live('click', function() {
|
||||||
$('#vk_login').click(function() {
|
VK.Auth.login(function(response) {
|
||||||
return VK.Auth.login(_vkontakte.authInfo(), 8);
|
_vkontakte.authInfo(response);
|
||||||
});
|
return false;
|
||||||
return $('#vk_logout').click(function() {
|
}, 8);
|
||||||
return VK.Auth.logout(_vkontakte.authInfo());
|
return false;
|
||||||
});
|
});
|
||||||
|
$('#vk_logout').live('click', function() {
|
||||||
|
_ajax.go('/search/');
|
||||||
|
VK.Auth.logout(_vkontakte.authInfo);
|
||||||
|
return false;
|
||||||
});
|
});
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
.add-album-button-container {
|
.add-album-button-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 10px -25px 0 0;
|
margin: 10px -50px 0 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.header-container {
|
.header-container {
|
||||||
.hello {
|
.hello {
|
||||||
|
display: none;
|
||||||
float: right;
|
float: right;
|
||||||
margin: 6px 10px 0 0;
|
margin: 6px 10px 0 0;
|
||||||
color: #222;
|
color: #222;
|
||||||
@ -8,16 +9,21 @@
|
|||||||
display: block;
|
display: block;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
border-bottom: #202020 1px dotted;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings {
|
.settings-button {
|
||||||
float: right;
|
float: right;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
margin: 1px 0;
|
margin: 1px 0;
|
||||||
background-image: url(/images/icns/settings.png);
|
background-image: url(/images/icns/settings.png);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation {
|
.navigation {
|
||||||
@ -54,7 +60,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.vk_auth {
|
&.vk_auth {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,19 @@
|
|||||||
@include rounded(3);
|
@include rounded(3);
|
||||||
|
|
||||||
&.gray {
|
&.gray {
|
||||||
background-color: #EEE;
|
background-color: #e0e0e0;
|
||||||
color: #444;
|
color: #404040;
|
||||||
border-color: #DDD;
|
text-shadow: #d0d0d0 0px 1px 1px;
|
||||||
|
border-color: #d0d0d0;
|
||||||
|
box-shadow: #c0c0c0 1px 1px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.red {
|
||||||
|
background-color: #fab0b0;
|
||||||
|
color: #e05050;
|
||||||
|
text-shadow: #c08080 0px 1px 1px;
|
||||||
|
border-color: #eaa0a0;
|
||||||
|
box-shadow: #da9090 1px 1px 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ $icons_dir: "/images/icns/";
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
width: 80px;
|
width: 50px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
@include alpha_gradient(32, 32, 32, '202020');
|
@include alpha_gradient(32, 32, 32, '202020');
|
||||||
|
@ -53,7 +53,10 @@
|
|||||||
border-top: #CCC 1px solid;
|
border-top: #CCC 1px solid;
|
||||||
|
|
||||||
.form {
|
.form {
|
||||||
margin: 25px;
|
position: absolute;
|
||||||
|
top: 25px;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
.field {
|
.field {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
@ -94,8 +97,18 @@
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.saved {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logout {
|
||||||
|
position: absolute;
|
||||||
|
top: 25px;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.forms {
|
.forms {
|
||||||
|
3
public/stylesheets/_sass/textpage.scss
Normal file
3
public/stylesheets/_sass/textpage.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.textpage {
|
||||||
|
margin: 25px;
|
||||||
|
}
|
@ -31,7 +31,7 @@
|
|||||||
border: #d0d0d0 1px solid; }
|
border: #d0d0d0 1px solid; }
|
||||||
.albums .album .pic .add-album-button-container {
|
.albums .album .pic .add-album-button-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 10px -25px 0 0;
|
margin: 10px -50px 0 0;
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
.albums .album .name {
|
.albums .album .name {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -5,3 +5,4 @@
|
|||||||
@import "search.css" all;
|
@import "search.css" all;
|
||||||
@import "albums.css" all;
|
@import "albums.css" all;
|
||||||
@import "settings.css" all;
|
@import "settings.css" all;
|
||||||
|
@import "textpage.css" all;
|
@ -1,4 +1,5 @@
|
|||||||
.header-container .hello {
|
.header-container .hello {
|
||||||
|
display: none;
|
||||||
float: right;
|
float: right;
|
||||||
margin: 6px 10px 0 0;
|
margin: 6px 10px 0 0;
|
||||||
color: #222; }
|
color: #222; }
|
||||||
@ -6,7 +7,10 @@
|
|||||||
display: block;
|
display: block;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 8px; }
|
margin-right: 8px; }
|
||||||
.header-container .hello .settings {
|
.header-container .hello .greating span {
|
||||||
|
border-bottom: #202020 1px dotted;
|
||||||
|
cursor: pointer; }
|
||||||
|
.header-container .hello .settings-button {
|
||||||
float: right;
|
float: right;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
@ -39,7 +43,7 @@
|
|||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin: 10px 0 0 4px; }
|
margin: 10px 0 0 4px; }
|
||||||
.header-container .navigation li .vk_auth {
|
.header-container .navigation li.vk_auth {
|
||||||
display: none; }
|
display: none; }
|
||||||
.header-container .navigation li a {
|
.header-container .navigation li a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
@ -13,9 +13,17 @@
|
|||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
-webkit-border-radius: 3px; }
|
-webkit-border-radius: 3px; }
|
||||||
.button.gray {
|
.button.gray {
|
||||||
background-color: #EEE;
|
background-color: #e0e0e0;
|
||||||
color: #444;
|
color: #404040;
|
||||||
border-color: #DDD; }
|
text-shadow: #d0d0d0 0px 1px 1px;
|
||||||
|
border-color: #d0d0d0;
|
||||||
|
box-shadow: #c0c0c0 1px 1px 0px; }
|
||||||
|
.button.red {
|
||||||
|
background-color: #fab0b0;
|
||||||
|
color: #e05050;
|
||||||
|
text-shadow: #c08080 0px 1px 1px;
|
||||||
|
border-color: #eaa0a0;
|
||||||
|
box-shadow: #da9090 1px 1px 0px; }
|
||||||
|
|
||||||
/* Scrollbars */
|
/* Scrollbars */
|
||||||
.data-container .scrollbar-pane {
|
.data-container .scrollbar-pane {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
width: 80px;
|
width: 50px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background: -moz-linear-gradient(left, rgba(32, 32, 32, 0) 0%, #202020 50%, #202020 100%);
|
background: -moz-linear-gradient(left, rgba(32, 32, 32, 0) 0%, #202020 50%, #202020 100%);
|
||||||
|
@ -39,7 +39,10 @@
|
|||||||
height: 500px;
|
height: 500px;
|
||||||
border-top: #CCC 1px solid; }
|
border-top: #CCC 1px solid; }
|
||||||
.settings-container .form-container .form {
|
.settings-container .form-container .form {
|
||||||
margin: 25px; }
|
position: absolute;
|
||||||
|
top: 25px;
|
||||||
|
left: 0;
|
||||||
|
width: 100%; }
|
||||||
.settings-container .form-container .form .field {
|
.settings-container .form-container .form .field {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@ -75,5 +78,11 @@
|
|||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
margin-left: 5px; }
|
margin-left: 5px; }
|
||||||
|
.settings-container .form-container .form .field .saved {
|
||||||
|
float: left; }
|
||||||
|
.settings-container .form-container .logout {
|
||||||
|
position: absolute;
|
||||||
|
top: 25px;
|
||||||
|
right: 0; }
|
||||||
.settings-container .forms {
|
.settings-container .forms {
|
||||||
display: none; }
|
display: none; }
|
||||||
|
2
public/stylesheets/textpage.css
Normal file
2
public/stylesheets/textpage.css
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.textpage {
|
||||||
|
margin: 25px; }
|
3
public/templates/about.html
Normal file
3
public/templates/about.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<div class="textpage">
|
||||||
|
Now back to the good part!
|
||||||
|
</div>
|
@ -17,6 +17,13 @@
|
|||||||
<div class="label">Email:</div>
|
<div class="label">Email:</div>
|
||||||
<div class="value"><input name="email" type="text"/></div>
|
<div class="value"><input name="email" type="text"/></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="save">
|
||||||
|
<div class="button gray">Hello, my name is Useless Button</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="logout">
|
||||||
|
<div class="button red" id="vk_logout">Log out</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="lastfm">
|
<div class="lastfm">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user