1
0
Fork 0

Work on settings

This commit is contained in:
magnolia-fan 2011-09-12 20:16:13 +04:00
parent 60cde9084f
commit 79f57959a8
6 changed files with 41 additions and 149 deletions

View File

@ -3,7 +3,7 @@ class window.Ajax
referer: false referer: false
loadSettingsPage: -> loadSettingsPage: ->
$.get '/settings/', (data) -> _session.query '/settings/', {}, (data) ->
_ajax.setArchor '/settings/' _ajax.setArchor '/settings/'
_page.renderSettings data _page.renderSettings data
false false

View File

@ -32,12 +32,12 @@ $('#preferences') .live 'click', ->
_ajax.go('/settings/'); _ajax.go('/settings/');
false false
$('.settings-container .tabs .tab').live 'click', -> $('#settings-tabs li').live 'click', ->
if not $(this).hasClass 'active' if not $(this).hasClass 'active'
$('.settings-container .tabs .tab').removeClass 'active' $('#settings-tabs li').removeClass 'active'
$(this).addClass 'active' $(this).addClass 'active'
$('.form-container').html $('.forms .'+ $(this).attr 'data-fieldset').html() $('#settings-forms > div').hide()
_settings.loadFormData $(this).attr 'data-fieldset' $('#settings-forms > .'+ $(this).find('a').attr('data-tab')).show()
false false
$('.lastfm-connect') .live 'click', -> $('.lastfm-connect') .live 'click', ->

View File

@ -11,7 +11,7 @@
* require pulldown * require pulldown
* require pulldown * require pulldown
*= require search *= require search
* require settings *= require settings
* require textpage * require textpage

View File

@ -1,121 +1,11 @@
@import "rounded"; #settings-forms {
.site {
.settings-container { display: none;
margin: 25px; }
.music {
.tabs { display: none;
height: 26px; }
.lastfm {
> div { display: none;
float: left; }
height: 25px;
}
.left-space {
width: 15px;
}
.middle-space {
width: 8px;
}
.tab {
position: relative;
border-left: #DDD 1px solid;
border-top: #DDD 1px solid;
border-right: #DDD 1px solid;
padding: 0 8px;
line-height: 24px;
margin-top: 2px;
@include rounded(5);
background-color: #FAFAFA;
cursor: pointer;
&.active {
z-index: 200;
background-color: #FFF;
border-left: #CCC 1px solid;
border-top: #CCC 1px solid;
border-right: #CCC 1px solid;
border-bottom: #FFF 6px solid;
margin-top: -2px;
line-height: 29px;
font-weight: bold;
cursor: default;
}
}
}
.form-container {
position: relative;
z-index: 100;
height: 500px;
border-top: #CCC 1px solid;
.form {
position: absolute;
top: 25px;
left: 0;
width: 100%;
.field {
height: 40px;
margin-bottom: 10px;
clear: both;
.label{
float: left;
font-size: 24px;
line-height: 32px;
width: 140px;
padding: 3px 6px;
@include rounded(3);
background-color: #EAEAEA;
margin-right: -10px;
}
.value {
float: left;
input[type="text"]{
font-size: 24px;
padding: 4px;
background-color: #ffffff;
color: #202020;
border: #CCC 1px solid;
@include rounded(3);
width: 300px;
}
select {
font-size: 24px;
background-color: #ffffff;
color: #202020;
border: #CCC 1px solid;
width: 310px;
height: 38px;
}
}
.action-button {
float: left;
margin: 6px 0 0 5px;
}
.saved {
float: left;
}
}
}
.logout {
position: absolute;
top: 25px;
right: 0;
}
}
.forms {
display: none;
}
} }

View File

@ -33,6 +33,8 @@ class UserController < ApplicationController
end end
def settings def settings
return unless authorized?
@user = User.find_by_vkid(params[:mid])
render :partial => 'settings' render :partial => 'settings'
end end

View File

@ -1,65 +1,65 @@
%h1 Settings %h1 Settings
%ul.tabs %ul.tabs#settings-tabs
%li.active %li.active
%a{ :href => "#" } Account %a{ :href => "#", :'data-tab' => 'account' } Account
%li %li
%a{ :href => "#" } Site %a{ :href => "#", :'data-tab' => 'site' } Site
%li %li
%a{ :href => "#" } Music %a{ :href => "#", :'data-tab' => 'music' } Music
%li %li
%a{ :href => "#" } Last.fm %a{ :href => "#", :'data-tab' => 'lastfm' } Last.fm
.forms .forms#settings-forms
.form.account .form.account
%form %form
%fieldset %fieldset
.clearfix .clearfix
%label{ :for => "input-username" } Username %label{ :for => "name" } Username
.input .input
%input.xlarge#input-username{ :name => "input-username", :size => 30, :type => "text" } %input.xlarge#name{ :name => "name", :size => 30, :type => "text", :value => @user.name }
.clearfix .clearfix
%label{ :for => "input-email" } Email %label{ :for => "email" } Email
.input .input
%input.xlarge#input-email{ :name => "input-email", :size => 30, :type => "text" } %input.xlarge#email{ :name => "email", :size => 30, :type => "text", :value => @user.email }
.form.site .form.site
%form %form
%fieldset %fieldset
.clearfix .clearfix
%label{ :for => "select-lang" } Language %label{ :for => "lang" } Language
.input .input
%select.medium#select-lang{ :name => "select-lang" } %select.medium#lang{ :name => "lang" }
%option English %option{ :value => "en", :selected => (@user.lang == 'en') } English
%option Русский %option{ :value => "ru", :selected => (@user.lang == 'ru') } Русский
.form.music .form.music
%form %form
%fieldset %fieldset
.clearfix .clearfix
%label{ :for => "select-lang" } Show %label{ :for => "album_types" } Show
.input .input
%ul.inputs-list %ul.inputs-list
%li %li
%label.disabled %label.disabled
%input{ :name => "show-album", :type => "checkbox", :checked => "checked", :disabled => "disabled" } %input{ :name => "show_album", :type => "checkbox", :checked => "checked", :disabled => "disabled" }
%span Albums %span Albums
%li %li
%label %label
%input{ :name => "show-single", :type => "checkbox" } %input{ :name => "show_single", :type => "checkbox", :disabled => "disabled" }
%span Singles %span Singles
%li %li
%label %label
%input{ :name => "show-live", :type => "checkbox" } %input{ :name => "show_live", :type => "checkbox", :disabled => "disabled" }
%span Live shows %span Live shows
%li %li
%label %label
%input{ :name => "show-bootleg", :type => "checkbox" } %input{ :name => "show_bootleg", :type => "checkbox", :disabled => "disabled" }
%span Bootlegs %span Bootlegs
.form.lastfm .form.lastfm
%form %form
%fieldset %fieldset
.clearfix .clearfix
%label{ :for => "input-username" } Username %label{ :for => "lastfm_username" } Username
.input .input
.input-append .input-append
%input#input-username{ :name => "input-username", :type => "text", :size => 30 } %input#lastfm_username{ :name => "lastfm_username", :type => "text", :disabled => "disabled", :value => @user.lastfm_username }
%label.add-on %label.add-on.disabled{ :class => ('active' unless @user.lastfm_key.nil?) }
%input{ :type => "checkbox" } %input{ :type => "checkbox", :disabled => "disabled", :checked => (!@user.lastfm_key.nil?) }