Form submit ability
This commit is contained in:
@@ -2,13 +2,6 @@ class window.Ajax
|
||||
|
||||
referer: false
|
||||
|
||||
loadSettingsPage: ->
|
||||
_session.query '/settings/', {}, (data) ->
|
||||
_ajax.setArchor '/settings/'
|
||||
_page.renderSettings data
|
||||
false
|
||||
false
|
||||
|
||||
load404Page: ->
|
||||
$.get '/404.html', (data) ->
|
||||
$('.data-container .inner').html data
|
||||
@@ -40,7 +33,7 @@ class window.Ajax
|
||||
else if _ajax.getAnchor() == '' or _ajax.getAnchor().match /\/search\//
|
||||
#_ajax.loadSearchPage();
|
||||
else if _ajax.getAnchor().match /\/settings\//
|
||||
_ajax.loadSettingsPage()
|
||||
_settings.loadSettingsPage()
|
||||
else if _ajax.getAnchor().match /\/about\//
|
||||
_ajax.loadAboutPage()
|
||||
else
|
||||
@@ -48,5 +41,5 @@ class window.Ajax
|
||||
false
|
||||
|
||||
$(window).bind 'hashchange', ->
|
||||
#_ajax.detectPage()
|
||||
_ajax.detectPage()
|
||||
false
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
this.enabled = false;
|
||||
this.selectedIndex = -1;
|
||||
this.container.hide();
|
||||
$('.popover-wrapper').hide();
|
||||
},
|
||||
|
||||
suggest: function() {
|
||||
@@ -292,6 +293,7 @@
|
||||
}
|
||||
this.enabled = true;
|
||||
this.container.show();
|
||||
$('.popover-wrapper').show();
|
||||
},
|
||||
|
||||
processResponse: function(text) {
|
||||
|
||||
@@ -27,21 +27,6 @@ class window.Page
|
||||
$('.search_field').first().focus()
|
||||
, 1
|
||||
false
|
||||
|
||||
renderSettings: (data) ->
|
||||
unless _session.getUser().id?
|
||||
#_ajax.go('/')
|
||||
false
|
||||
$('#content').html data
|
||||
#yaCounter7596904.hit _ajax.getAnchor(), 'Settings', _ajax.referer
|
||||
_ajax.setTitle 'Settings'
|
||||
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', ->
|
||||
|
||||
@@ -25,6 +25,11 @@ class window.Session
|
||||
$.post url, q_params, callback
|
||||
false
|
||||
|
||||
secureLoad: (url, callback) ->
|
||||
q_params = $.extend {}, @vk_params
|
||||
$('#content').load url, q_params, callback
|
||||
false
|
||||
|
||||
reloadSession: ->
|
||||
_session.query '/user/auth', {}, (ar) ->
|
||||
_session.setUser ar.user
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
class window.Settings
|
||||
|
||||
loadSettingsPage: ->
|
||||
unless _session.getUser().id?
|
||||
_ajax.go('/')
|
||||
false
|
||||
_session.secureLoad '/settings/', (data) ->
|
||||
false
|
||||
#yaCounter7596904.hit _ajax.getAnchor(), 'Settings', _ajax.referer
|
||||
_ajax.setTitle 'Settings'
|
||||
false
|
||||
|
||||
getAccountInfo: (callback) ->
|
||||
_session.query '/user/update/', {}, callback
|
||||
false
|
||||
@@ -7,16 +17,6 @@ class window.Settings
|
||||
saveAccountInfo: (params, callback) ->
|
||||
_session.query '/user/update', params, callback
|
||||
false
|
||||
|
||||
loadFormData: (form) ->
|
||||
if form == 'account'
|
||||
$('.settings-container .form input[name$="username"]').val _session.getUser().name
|
||||
$('.settings-container .form input[name$="email"]').val _session.getUser().email
|
||||
$('.settings-container .form select').val _session.getUser().lang
|
||||
else if form == 'lastfm'
|
||||
if _session.getUser().lastfm_username
|
||||
$('.form-container input[name$="username"]').first().val _session.getUser().lastfm_username
|
||||
false
|
||||
|
||||
updateLastfmLogin: ->
|
||||
if window.lastfm_popup.closed
|
||||
@@ -28,7 +28,7 @@ class window.Settings
|
||||
false
|
||||
|
||||
|
||||
$('#preferences') .live 'click', ->
|
||||
$('#preferences').live 'click', ->
|
||||
_ajax.go('/settings/');
|
||||
false
|
||||
|
||||
@@ -40,25 +40,19 @@ $('#settings-tabs li').live 'click', ->
|
||||
$('#settings-forms > .'+ $(this).find('a').attr('data-tab')).show()
|
||||
false
|
||||
|
||||
$('.lastfm-connect') .live 'click', ->
|
||||
$('.lastfm-connect').live 'click', ->
|
||||
window.lastfm_popup = window.open _session.getUser().lastfm_login_url
|
||||
setTimeout _settings.updateLastfmLogin, 100
|
||||
false
|
||||
|
||||
$('.settings-container .form input, .settings-container .form select').live 'blur', ->
|
||||
active_tab = $('.settings-container .tabs .tab.active').attr 'data-fieldset'
|
||||
if active_tab == 'account'
|
||||
params =
|
||||
username: $('.settings-container .form input[name$="username"]').first().val()
|
||||
email: $('.settings-container .form input[name$="email"]').first().val()
|
||||
lang: $('.settings-container .form select').first().val()
|
||||
lang_changed = params.lang != _session.getUser().lang
|
||||
if lang_changed
|
||||
if not confirm _beathaven.ls 'WINDOW_LANG_RELOAD', params.lang
|
||||
$('.settings-container .form select').val _session.getUser().lang
|
||||
_settings.saveAccountInfo params, ->
|
||||
if lang_changed
|
||||
window.location.reload()
|
||||
$('.header-container .hello .greating span').text (if params.username.length > 0 then params.username else '%username%')
|
||||
false
|
||||
false
|
||||
|
||||
$('#settings-forms form').live 'submit', ->
|
||||
params = {}
|
||||
$(this).find('input, select').each ->
|
||||
if $(this).attr('name')
|
||||
params[$(this).attr('name')] = $(this).val()
|
||||
console.log(params)
|
||||
false
|
||||
|
||||
$('#settings-forms input[type$="submit"]').live 'mouseup', ->
|
||||
$(this).parent().parent().parent().submit();
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user