1
0
Fork 0

Damn checkboxes

This commit is contained in:
magnolia-fan 2011-09-15 09:42:41 +04:00
parent d0f5e35100
commit 4e6e5a6751
3 changed files with 9 additions and 5 deletions

View File

@ -59,3 +59,7 @@ $('#settings-forms form').live 'submit', ->
$('#settings-forms input[type$="submit"]').live 'mouseup', ->
$(this).parent().parent().parent().submit();
false
$('#settings-forms input[type$="checkbox"]').live 'click', (e) ->
sorry
false

View File

@ -48,7 +48,7 @@ class UserController < ApplicationController
params[:params] = params[:params].each{ |k, v| update_params[k.to_sym] = v }
if (update_params.keys - allowed_params).empty?
if update_params.include? :show
update_params[:show].map!{ |k, v| k.to_sym }
update_params[:show] = update_params[:show].map{ |k, v| k.to_sym }
end
params[:params].each do |k, v|

View File

@ -43,19 +43,19 @@
%ul.inputs-list
%li
%label{ :for => "show_album" }
%input#show_album{ :name => "show[album]", :type => "checkbox", :checked => "checked" }
%input#show_album{ :name => "show[album]", :type => "checkbox", :checked => @user.music.include?(:album) }
%span= I18n.t 'settings.music.albums'
%li
%label{ :for => "show_single" }
%input#show_single{ :name => "show[single]", :type => "checkbox" }
%input#show_single{ :name => "show[single]", :type => "checkbox", :checked => @user.music.include?(:single) }
%span= I18n.t 'settings.music.singles'
%li
%label.disabled{ :for => "show_live" }
%input#show_live{ :name => "show[live]", :type => "checkbox", :disabled => "disabled" }
%input#show_live{ :name => "show[live]", :type => "checkbox", :disabled => "disabled", :checked => @user.music.include?(:live) }
%span= I18n.t 'settings.music.live'
%li
%label.disabled{ :for => "show_bootleg" }
%input#show_bootleg{ :name => "show[bootleg]", :type => "checkbox", :disabled => "disabled" }
%input#show_bootleg{ :name => "show[bootleg]", :type => "checkbox", :disabled => "disabled", :checked => @user.music.include?(:bootleg) }
%span= I18n.t 'settings.music.bootlegs'
.actions
%input.btn.primary{ :type => "submit", :value => I18n.t('settings.save') }