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

View File

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

View File

@ -30,13 +30,11 @@ class window.Page
renderSettings: (data) -> renderSettings: (data) ->
unless _session.getUser().id? unless _session.getUser().id?
_ajax.go('/search/') #_ajax.go('/')
return false false
$('.data-container').css background: 'none' $('#content').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'
false false
renderTextpage: (data) -> renderTextpage: (data) ->
@ -45,6 +43,16 @@ class window.Page
_beathaven.redrawScrollbar() _beathaven.redrawScrollbar()
false false
$ ->
$('.about').live 'click', -> $('.about').live 'click', ->
_ajax.go '/about/' _ajax.go '/about/'
false 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 false
$('.settings') .live 'click', -> $('#preferences') .live 'click', ->
_ajax.go('/settings/'); _ajax.go('/settings/');
false false

View File

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

View File

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

View File

@ -27,13 +27,13 @@
= image_tag "artist_loader.gif" = image_tag "artist_loader.gif"
%ul.nav.secondary-nav %ul.nav.secondary-nav
%li.dropdown %li.dropdown
%a.dropdown-toggle{ :href => "#" } chez %a.dropdown-toggle#username{ :href => "#" } %username%
%ul.dropdown-menu %ul.dropdown-menu
%li %li
%a{ :href => "#" } Preferences %a#preferences{ :href => "#" } Preferences
%li.divider %li.divider
%li %li
%a{ :href => "#" } Logout %a#logout{ :href => "#" } Logout
.popover-wrapper .popover-wrapper
.popover.below#autocomplete-container .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/listening' => 'last_fm#listening'
match 'lastfm/scrobble' => 'last_fm#scrobble' match 'lastfm/scrobble' => 'last_fm#scrobble'
match 'settings' => 'user#settings'
match 'artist/autocomplete' => 'artist#autocomplete' match 'artist/autocomplete' => 'artist#autocomplete'
match 'artist/(:name)/' => 'artist#data', :constraints => { :name => /[^\/]*/ } match 'artist/(:name)/' => 'artist#data', :constraints => { :name => /[^\/]*/ }
end end