1
0
Fork 0

Settings mockup

This commit is contained in:
magnolia-fan 2011-09-10 03:30:03 +04:00
parent fe7737574d
commit 60cde9084f
10 changed files with 221 additions and 143 deletions

View File

@ -3,9 +3,10 @@ class window.Ajax
referer: false
loadSettingsPage: ->
$.get '/templates/settings.html', (data) ->
$.get '/settings/', (data) ->
_ajax.setArchor '/settings/'
_page.renderSettings _beathaven.localizeHTML $(data)
_page.renderSettings data
false
false
load404Page: ->
@ -37,7 +38,7 @@ class window.Ajax
if m = _ajax.getAnchor().match /\/artist\/(.+)\//
_search.loadArtistData m[1]
else if _ajax.getAnchor() == '' or _ajax.getAnchor().match /\/search\//
_ajax.loadSearchPage();
#_ajax.loadSearchPage();
else if _ajax.getAnchor().match /\/settings\//
_ajax.loadSettingsPage()
else if _ajax.getAnchor().match /\/about\//

View File

@ -37,7 +37,6 @@ class window.BeatHaven
window._settings = new Settings()
this.setupAutocomplete()
window._ajax.detectPage()
false

View File

@ -30,13 +30,11 @@ class window.Page
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.go('/')
false
$('#content').html data
#yaCounter7596904.hit _ajax.getAnchor(), 'Settings', _ajax.referer
_ajax.setTitle 'Settings'
$('.settings-container .tabs .tab').first().trigger 'click'
false
renderTextpage: (data) ->
@ -45,6 +43,16 @@ class window.Page
_beathaven.redrawScrollbar()
false
$('.about').live 'click', ->
$ ->
$('.about').live 'click', ->
_ajax.go '/about/'
false
$('body').live 'click', ->
$('.dropdown-toggle, .menu').parent('li').removeClass('open')
false
$('.dropdown-toggle, .menu').live 'click', ->
$(this).parent('li').toggleClass('open')
false
$('.dropdown-toggle li, .menu li').live 'click', ->
$(this).parent('li').toggleClass('open')
false

View File

@ -28,7 +28,7 @@ class window.Settings
false
$('.settings') .live 'click', ->
$('#preferences') .live 'click', ->
_ajax.go('/settings/');
false

View File

@ -32,17 +32,16 @@ class window.Vkontakte
VK.Api.call 'getVariable', key: 1281, (r) ->
_session.query '/user/update', name: r.response, (ar2) ->
_session.setUser ar2.user
$('.header-container .hello .greating')
.html _beathaven.ls('HELLO')+', <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!'
$('#username')
.html (if _session.getUser().name then _session.getUser().name else '%username%')
window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();
else
_session.setUser ar.user
$('.header-container .hello').show()
$('.header-container .hello .greating')
.html _beathaven.ls('HELLO')+', <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!'
$('#username')
.html (if _session.getUser().name then _session.getUser().name else '%username%')
window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();

View File

@ -32,6 +32,10 @@ class UserController < ApplicationController
render :json => @res
end
def settings
render :partial => 'settings'
end
def update
return unless authorized?
@res = {}

View File

@ -27,13 +27,13 @@
= image_tag "artist_loader.gif"
%ul.nav.secondary-nav
%li.dropdown
%a.dropdown-toggle{ :href => "#" } chez
%a.dropdown-toggle#username{ :href => "#" } %username%
%ul.dropdown-menu
%li
%a{ :href => "#" } Preferences
%a#preferences{ :href => "#" } Preferences
%li.divider
%li
%a{ :href => "#" } Logout
%a#logout{ :href => "#" } Logout
.popover-wrapper
.popover.below#autocomplete-container

View File

@ -0,0 +1,65 @@
%h1 Settings
%ul.tabs
%li.active
%a{ :href => "#" } Account
%li
%a{ :href => "#" } Site
%li
%a{ :href => "#" } Music
%li
%a{ :href => "#" } Last.fm
.forms
.form.account
%form
%fieldset
.clearfix
%label{ :for => "input-username" } Username
.input
%input.xlarge#input-username{ :name => "input-username", :size => 30, :type => "text" }
.clearfix
%label{ :for => "input-email" } Email
.input
%input.xlarge#input-email{ :name => "input-email", :size => 30, :type => "text" }
.form.site
%form
%fieldset
.clearfix
%label{ :for => "select-lang" } Language
.input
%select.medium#select-lang{ :name => "select-lang" }
%option English
%option Русский
.form.music
%form
%fieldset
.clearfix
%label{ :for => "select-lang" } Show
.input
%ul.inputs-list
%li
%label.disabled
%input{ :name => "show-album", :type => "checkbox", :checked => "checked", :disabled => "disabled" }
%span Albums
%li
%label
%input{ :name => "show-single", :type => "checkbox" }
%span Singles
%li
%label
%input{ :name => "show-live", :type => "checkbox" }
%span Live shows
%li
%label
%input{ :name => "show-bootleg", :type => "checkbox" }
%span Bootlegs
.form.lastfm
%form
%fieldset
.clearfix
%label{ :for => "input-username" } Username
.input
.input-append
%input#input-username{ :name => "input-username", :type => "text", :size => 30 }
%label.add-on
%input{ :type => "checkbox" }

View File

@ -66,6 +66,8 @@ Beathaven::Application.routes.draw do
match 'lastfm/listening' => 'last_fm#listening'
match 'lastfm/scrobble' => 'last_fm#scrobble'
match 'settings' => 'user#settings'
match 'artist/autocomplete' => 'artist#autocomplete'
match 'artist/(:name)/' => 'artist#data', :constraints => { :name => /[^\/]*/ }
end