working on the screen for editing my account

This commit is contained in:
did 2011-12-01 15:04:45 -08:00
parent 35012ca2b2
commit 837b974fec
4 changed files with 47 additions and 26 deletions

1
.gitignore vendored
View File

@ -30,7 +30,6 @@ Capfile
config/deploy.rb
perf/*.rb
gem_graph.png
./sites/
permanent
doc/bushido
*.swp

View File

@ -17,7 +17,7 @@ module Locomotive
def update
@account = current_locomotive_account
@account.update_attributes(params[:account])
respond_with @account, edit_my_account_url
respond_with @account, :location => edit_my_account_url
end
end

View File

@ -0,0 +1,28 @@
module Locomotive
class LocaleInput < Formtastic::Inputs::TextInput
def to_html
input_wrapping do
label_html <<
self.available_locales_to_html
end
end
def available_locales_to_html
template.content_tag(:div,
Locomotive.config.locales.map do |locale|
template.content_tag(:div, locale_to_html(locale).html_safe, :class => 'entry')
end.join.html_safe, :class => 'list')
end
def locale_to_html(locale)
text = I18n.t("locomotive.my_account.edit.#{locale}")
builder.radio_button(:locale, locale) +
template.content_tag(:label,
template.image_tag("locomotive/icons/flags/#{locale}.png", :alt => text) +
text)
end
end
end

View File

@ -1,7 +1,8 @@
- title link_to(@account.name.blank? ? @account.name_was : @account.name, '#', :rel => 'my_account_name', :title => t('.ask_for_name'), :class => 'editable')
- content_for :head do
/ = include_javascripts :account
- content_for :backbone_view_data do
:plain
{ account: #{@account.to_json} }
- content_for :submenu do
= render_cell 'locomotive/settings_menu', :show
@ -12,35 +13,28 @@
%p= t('.help')
= semantic_form_for @account, :as => :my_account, :url => my_account_url, :html => { :class => 'save-with-shortcut' } do |f|
= semantic_form_for @account, :url => my_account_url do |f|
= f.inputs :name => :information do
= f.input :name
= f.input :locale, :as => '::Locomotive::Locale'
= f.inputs :name => :credentials do
= f.inputs :name => :credentials, :class => "inputs foldable folded" do
= f.input :email
= f.input :password, :input_html => { :autocomplete => "off" }
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
= f.input :password, :input_html => { :autocomplete => 'off' }
= f.input :password_confirmation, :input_html => { :autocomplete => 'off' }
- if multi_sites?
= f.inputs :name => :sites, :class => 'sites' do
%ul.list
- @account.sites.each do |site|
%li
%strong= link_to site.name, site_url(site)
%em= site.domains.join(', ')
= f.inputs :name => :sites, :class => "sites inputs foldable #{'folded' if inputs_folded?(@account)}" do
%li.input.empty.no-label.last
.list
- @account.sites.each do |site|
.entry
%strong= link_to site.name, site_url(site)
%em= site.domains.join(', ')
- if admin_on?(site) && site != current_site
%span{ :class => 'actions' }
= link_to 'x', site_url(site), :class => 'remove first', :confirm => t('locomotive.messages.confirm'), :method => :delete
= f.inputs :name => :language, :class => 'language' do
- Locomotive.config.locales.each do |locale|
%span
= f.radio_button :locale, locale
%label{ :for => "my_account_locale_#{locale.downcase}" }
= image_tag "admin/icons/flags/#{locale}.png"
= t(".#{locale}")
/ &nbsp;
- if admin_on?(site) && site != current_site
%span{ :class => 'actions' }
= link_to 'x', site_url(site), :class => 'remove first', :confirm => t('locomotive.messages.confirm'), :method => :delete
= render 'locomotive/shared/form_actions', :button_label => :update