Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Contact
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Simple_html::Html_Contact
- Defined in:
- lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ Html_Contact
constructor
A new instance of Html_Contact.
- #writeHtml(hContact) ⇒ Object
Constructor Details
#initialize(html) ⇒ Html_Contact
Returns a new instance of Html_Contact.
20 21 22 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb', line 20 def initialize(html) @html = html end |
Instance Method Details
#writeHtml(hContact) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb', line 24 def writeHtml(hContact) # classes used onlineClass = Html_OnlineResource.new(@html) graphicClass = Html_Graphic.new(@html) @html.div do @html.div(hContact[:name], {'id' => 'CID_' + hContact[:contactId], 'class' => 'h3'}) @html.div(:class => 'block') do # contact - contact ID unless hContact[:contactId].nil? @html.em('Contact ID: ') @html.text!(hContact[:contactId]) @html.br end # contact - isOrganization @html.em('is Organization: ') @html.text!(hContact[:isOrganization].to_s) @html.br # contact - type unless hContact[:contactType].nil? @html.em('Contact Type: ') @html.text!(hContact[:contactType]) @html.br end # contact - position unless hContact[:positionName].nil? @html.em('Position Name: ') @html.text!(hContact[:positionName]) @html.br end # contact - member of organizations [] hContact[:memberOfOrgs].each do |org| hMember = Html_Document.getContact(org) unless hMember.empty? @html.em('is Member of: ') @html.a(hMember[:name], 'href' => '#CID_'+hMember[:contactId]) @html.br end end # contact - address hContact[:addresses].each do |hAddress| @html.div do @html.div('Address', {'class' => 'h5'}) @html.div(:class => 'block') do # address - delivery points hAddress[:deliveryPoints].each do |addLine| @html.text!(addLine) @html.br end # address - city, adminArea postalCode unless hAddress[:city].nil? @html.text!(hAddress[:city]) end unless hAddress[:adminArea].nil? @html.text!(', ' + hAddress[:adminArea]) end unless hAddress[:postalCode].nil? @html.text!(' ' + hAddress[:postalCode]) end @html.br # address - country unless hAddress[:country].nil? @html.text!(hAddress[:country]) @html.br end # address - type hAddress[:addressTypes].each do |addType| @html.em('Address Type: ') @html.text!(addType) @html.br end # address - description if hAddress[:description] @html.em('Description: ') @html.text!(hAddress[:description]) @html.br end end end end # contact - phones hContact[:phones].each do |hPhone| @html.div do @html.div('Phone', {'class' => 'h5'}) @html.div(:class => 'block') do # phone - name unless hPhone[:phoneName].nil? @html.em('Phone Name: ') @html.text!(hPhone[:phoneName]) @html.br end # phone - number unless hPhone[:phoneNumber].nil? @html.em('Phone Number: ') @html.text!(hPhone[:phoneNumber]) @html.br end # phone - service types unless hPhone[:phoneServiceTypes].empty? @html.em('Service Types: ') hPhone[:phoneServiceTypes].each do |phoneType| @html.text!(phoneType + ' ') end @html.br end end end end # contact - email [] hContact[:eMailList].each do |email| @html.em('Electronic Mail: ') @html.text!(email) @html.br end # contact - online resource [] hContact[:onlineResources].each do |hOnline| @html.div do @html.div('Online Resource', {'class' => 'h5'}) @html.div(:class => 'block') do onlineClass.writeHtml(hOnline) end end end # contact - logos [] hContact[:logos].each do |hLogo| @html.div do @html.div('Logo Graphic', {'class' => 'h5'}) @html.div(:class => 'block') do graphicClass.writeHtml(hLogo) end end end # contact - hours of service [] hContact[:hoursOfService].each do |hours| @html.em('Hours of Service: ') @html.text!(hours) @html.br end # contact - instructions unless hContact[:contactInstructions].nil? @html.em('Contact Instructions: ') @html.text!(hContact[:contactInstructions]) @html.br end end end end |