Class: ODDB::View::SuggestedAddress

Inherits:
HtmlGrid::Composite show all
Includes:
AddressMap
Defined in:
src/view/address.rb

Direct Known Subclasses

Address, Admin::ActiveAddress

Constant Summary

COMPONENTS =
{
  [1,0] =>  :address_message,  
  [1,1] =>  :message,  
}
SYMBOL_MAP =
{
  :address_email  => HtmlGrid::MailLink,
  :email_suggestion =>  HtmlGrid::MailLink,
  :address_message=>  HtmlGrid::LabelText,
  :praxis_header  => HtmlGrid::LabelText,
  :contact_email  => HtmlGrid::MailLink,
  :contact_header =>  HtmlGrid::LabelText,
  :email_header   => HtmlGrid::LabelText,
  :fax_header     =>  HtmlGrid::LabelText,
  :fons_header    =>  HtmlGrid::LabelText,
  :nbsp           => HtmlGrid::Text,
  :phone_label    =>  HtmlGrid::Text,
  :work_header    =>  HtmlGrid::LabelText,
}
CSS_MAP =
{
  [1,0] =>  'list',
  [1,1] =>  'top',
}
DEFAULT_CLASS =
HtmlGrid::Value
LEGACY_INTERFACE =
false
YPOS =
0
CSS_CLASS =
'component'

Instance Method Summary (collapse)

Methods included from AddressMap

#map, #mapsearch_format

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) correct(model)



100
101
102
103
104
105
106
107
108
109
110
111
# File 'src/view/address.rb', line 100

def correct(model)
  button = HtmlGrid::Button.new(:correct, 
    model, @session, self)
  args = {
    :pointer =>  model.pointer,
    :zone      => @session.zone,
  }
  url = @lookandfeel._event_url(:suggest_address, args)
  button.set_attribute('onclick', 
    "document.location.href='#{url}'")
  button
end

- (Object) fax(model)



112
113
114
# File 'src/view/address.rb', line 112

def fax(model)
  model.fax.join('<br>')
end

- (Object) fons(model)



115
116
117
# File 'src/view/address.rb', line 115

def fons(model)
  model.fon.join('<br>')
end

- (Object) init



61
62
63
64
# File 'src/view/address.rb', line 61

def init
  init_components unless(@model.nil?)
  super
end

- (Object) init_components



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
# File 'src/view/address.rb', line 65

def init_components
  ypos = ystart = self.class.const_get(:YPOS)
  if(@model.type)
    components.store([0,ypos], :type)
    ypos += 1
  end
  components.update({
    [0,ypos]     =>  :lines,
    [0,ypos + 1] =>  :map,
  })
  ypos += 2
  unless(@model.fon.empty?)
    components.update({
      [0,ypos]      => :fons_header,
      [0,ypos + 1]  => :fons,
    })
    ypos += 2
  end
  unless(@model.fax.to_s.strip.empty?)
    components.update({
      [0,ypos]     => :fax_header,
      [0,ypos + 1] => :fax,
    })
    ypos += 2
  end
  if(@model.respond_to?(:email_suggestion))
    components.update({
      [0,ypos]      => :email_header,
      [0,ypos + 1]  => :email_suggestion,
    })
    ypos += 2
  end
  css_map.store([0,ystart,1,ypos],  
    'top address-width list')
end

- (Object) lines(model)



118
119
120
# File 'src/view/address.rb', line 118

def lines(model)
  model.lines.join('<br>')
end

- (Object) message(model)



124
125
126
# File 'src/view/address.rb', line 124

def message(model)
  model.message.to_s.gsub("\n", '<br>')
end

- (Object) type(model)



121
122
123
# File 'src/view/address.rb', line 121

def type(model)
  HtmlGrid::LabelText.new("address_#{model.type}", model, @session, self)
end