Module: IsoDoc::HtmlFunction::Form
- Included in:
- IsoDoc::HtmlConvert
- Defined in:
- lib/isodoc/html_function/form.rb
Instance Method Summary collapse
- #form_parse(node, out) ⇒ Object
- #input_parse(node, out) ⇒ Object
- #label_parse(node, out) ⇒ Object
- #option_parse(node, out) ⇒ Object
- #select_parse(node, out) ⇒ Object
- #textarea_parse(node, out) ⇒ Object
Instance Method Details
#form_parse(node, out) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/isodoc/html_function/form.rb', line 4 def form_parse(node, out) out.form **attr_code(id: node["id"], name: node["name"], class: node["class"], action: node["action"]) do |div| node.children.each do |n| parse(n, div) end end end |
#input_parse(node, out) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/isodoc/html_function/form.rb', line 14 def input_parse(node, out) out.input nil, **attr_code( id: node["id"], name: node["name"], type: node["type"], value: node["value"], disabled: node["disabled"], readonly: node["readonly"], checked: node["checked"], maxlength: node["maxlength"], minlength: node["minlength"] ) end |
#label_parse(node, out) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/isodoc/html_function/form.rb', line 36 def label_parse(node, out) out.label **attr_code(for: node["for"]) do |div| node.children.each do |n| parse(n, div) end end end |
#option_parse(node, out) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/isodoc/html_function/form.rb', line 44 def option_parse(node, out) out.option **attr_code( disabled: node["disabled"], selected: node["selected"], value: node["value"] ) do |o| node.children.each do |n| parse(n, o) end end end |
#select_parse(node, out) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/isodoc/html_function/form.rb', line 23 def select_parse(node, out) selected = node.at(ns("./option[@value = '#{node['value']}']")) selected and selected["selected"] = true out.select **attr_code( id: node["id"], name: node["name"], size: node["size"], disabled: node["disabled"], multiple: node["multiple"] ) do |div| node.children.each do |n| parse(n, div) end end end |
#textarea_parse(node, out) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/isodoc/html_function/form.rb', line 55 def textarea_parse(node, out) out.textarea **attr_code( id: node["id"], name: node["name"], rows: node["rows"], cols: node["cols"] ) do |div| node["value"] and div << node["value"] end end |