Module: Ludy::CheckBox
- Defined in:
- lib/ludy/helpers/check_box.rb
Overview
check box helper for html view generation.
require 'ludy/helpers/check_box'
module ApplicationHelper
include Ludy::CheckBox
end
Instance Method Summary collapse
-
#check_all(text, id_and_or_class) ⇒ Object
create a link respond to onclick and check all check_box for all specified elements.
-
#uncheck_all(text, id_and_or_class) ⇒ Object
create a link respond to onclick and uncheck all check_box for all specified elements.
Instance Method Details
#check_all(text, id_and_or_class) ⇒ Object
create a link respond to onclick and check all check_box for all specified elements.
id_and_or_class, e.g., #form_inviting input.check_box_friend
^^^^^id elements^^^ ^^^^^^^^^^^class
13 14 15 |
# File 'lib/ludy/helpers/check_box.rb', line 13 def check_all text, id_and_or_class "<a href=\"#\" onclick=\"$$('#{id_and_or_class}').each(function(box){box.checked='checked'});return false;\">#{text}</a>" end |
#uncheck_all(text, id_and_or_class) ⇒ Object
create a link respond to onclick and uncheck all check_box for all specified elements.
id_and_or_class, e.g., #form_inviting input.check_box_friend
^^^^^id elements^^^ ^^^^^^^^^^^class
20 21 22 |
# File 'lib/ludy/helpers/check_box.rb', line 20 def uncheck_all text, id_and_or_class "<a href=\"#\" onclick=\"$$('#{id_and_or_class}').each(function(box){box.checked=''});return false;\">#{text}</a>" end |