Skip to content

Commit

Permalink
fixing value of checked box in list view always set to true
Browse files Browse the repository at this point in the history
  • Loading branch information
yairgo committed Jan 30, 2009
1 parent bbb72bf commit 19d6755
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/active_scaffold/helpers/list_column_helpers.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ def active_scaffold_column_text(column, record)


def active_scaffold_column_checkbox(column, record) def active_scaffold_column_checkbox(column, record)
column_value = record.send(column.name) column_value = record.send(column.name)
checked = column_value.class.to_s.include?('Class') ? column_value : column_value == 1
if column.inplace_edit and record.authorized_for?(:action => :update, :column => column.name) if column.inplace_edit and record.authorized_for?(:action => :update, :column => column.name)
id_options = {:id => record.id.to_s, :action => 'update_column', :name => column.name.to_s} id_options = {:id => record.id.to_s, :action => 'update_column', :name => column.name.to_s}
tag_options = {:tag => "span", :id => element_cell_id(id_options), :class => "in_place_editor_field"} tag_options = {:tag => "span", :id => element_cell_id(id_options), :class => "in_place_editor_field"}
script = remote_function(:method => 'POST', :url => {:controller => params_for[:controller], :action => "update_column", :column => column.name, :id => record.id.to_s, :value => !column_value, :eid => params[:eid]}) script = remote_function(:method => 'POST', :url => {:controller => params_for[:controller], :action => "update_column", :column => column.name, :id => record.id.to_s, :value => !column_value, :eid => params[:eid]})
content_tag(:span, check_box_tag(tag_options[:id], 1, column_value || column_value == 1, {:onchange => script}) , tag_options) content_tag(:span, check_box_tag(tag_options[:id], 1, checked, {:onchange => script}) , tag_options)
else else
check_box_tag(nil, 1, column_value || column_value == 1, :disabled => true) check_box_tag(nil, 1, checked, :disabled => true)
end end
end end


Expand Down

0 comments on commit 19d6755

Please sign in to comment.