Class: BBMB::Html::View::CustomerForm
- Inherits:
-
HtmlGrid::Form
- Object
- HtmlGrid::Form
- BBMB::Html::View::CustomerForm
- Includes:
- HtmlGrid::ErrorMessage
- Defined in:
- lib/bbmb/html/view/customer.rb
Constant Summary collapse
- COMPONENTS =
{ [0,0] => :organisation, [2,0] => :customer_id, [0,1] => :ean13, [2,1,0] => :turnover, [3,1,0] => ' - ', [3,1,1] => :history, [0,2] => 'contact', [0,3] => :title, [2,3] => :drtitle, [0,4] => :lastname, [2,4] => :firstname, [0,5] => :address1, [0,6] => :address2, [0,7] => :address3, [0,8,0] => :plz, [0,8,1] => '/', [0,8,2] => :city, [2,8] => :canton, [0,9] => :email, [2,9] => :order_confirmation, [0,10] => :phone_business, [2,10] => :phone_private, [0,11] => :phone_mobile, [2,11] => :fax, [0,12] => :pass, [1,12,3]=> :change_pass, # in UserView#change_pass, the third # number here is used as the value of # the colspan attribute [1,12,4]=> ' ', [1,12,5]=> :generate_pass, [2,12] => :confirm_pass, [1,13] => :submit, }
- CSS_ID_MAP =
{ [0,8,0] => 'plz', [0,8,2] => 'city', }
- CSS_MAP =
{ [0,2,4] => 'contact', }
- DEFAULT_CLASS =
HtmlGrid::InputText
- EVENT =
"save"
- FORM_NAME =
'hospital'
- LABELS =
true
- SYMBOL_MAP =
{ :canton => HtmlGrid::Select, :title => HtmlGrid::Select, }
Instance Method Summary collapse
- #_pass(key, model) ⇒ Object
- #change_pass(model) ⇒ Object
- #confirm_pass(model) ⇒ Object
- #generate_pass(model) ⇒ Object
- #history(model) ⇒ Object
- #init ⇒ Object
- #order_confirmation(model) ⇒ Object
- #pass(model) ⇒ Object
- #popup(url, name = 'popup') ⇒ Object
- #set_pass? ⇒ Boolean
- #turnover(model) ⇒ Object
Instance Method Details
#_pass(key, model) ⇒ Object
115 116 117 118 119 |
# File 'lib/bbmb/html/view/customer.rb', line 115 def _pass(key, model) if(set_pass?) HtmlGrid::Pass.new(key, model, @session, self) end end |
#change_pass(model) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/bbmb/html/view/customer.rb', line 69 def change_pass(model) unless(set_pass?) = HtmlGrid::Button.new(:change_pass, model, @session, self) form = "document.#{formname}" .onclick = "#{form}.event.value='change_pass';#{form}.submit();" .value = @lookandfeel.lookup("change_pass") matrix = components.key(:change_pass) @grid.set_colspan(*matrix) end end |
#confirm_pass(model) ⇒ Object
80 81 82 |
# File 'lib/bbmb/html/view/customer.rb', line 80 def confirm_pass(model) _pass(:confirm_pass, model) end |
#generate_pass(model) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/bbmb/html/view/customer.rb', line 83 def generate_pass(model) unless(set_pass?) if(@session.state.cleartext) link = HtmlGrid::Link.new(:show_pass, model, @session, self) link.href = 'javascript:' << popup(@lookandfeel._event_url(:show_pass), 'password') link else = HtmlGrid::Button.new(:generate_pass, model, @session, self) form = "document.#{formname}" .onclick = "#{form}.event.value='generate_pass';#{form}.submit();" matrix = components.key(:change_pass) @grid.set_colspan(*matrix) end end end |
#history(model) ⇒ Object
100 101 102 103 104 105 |
# File 'lib/bbmb/html/view/customer.rb', line 100 def history(model) link = HtmlGrid::Link.new(:history, model, @session, self) link.href = @lookandfeel._event_url(:history, :customer_id => model.customer_id) link end |
#init ⇒ Object
65 66 67 68 |
# File 'lib/bbmb/html/view/customer.rb', line 65 def init super end |
#order_confirmation(model) ⇒ Object
106 107 108 109 110 111 |
# File 'lib/bbmb/html/view/customer.rb', line 106 def order_confirmation(model) if BBMB.config.mail_confirm_reply_to HtmlGrid::InputCheckbox.new(:order_confirmation, model, @session, self) end end |
#pass(model) ⇒ Object
112 113 114 |
# File 'lib/bbmb/html/view/customer.rb', line 112 def pass(model) _pass(:pass, model) end |
#popup(url, name = 'popup') ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/bbmb/html/view/customer.rb', line 120 def popup(url, name='popup') script = "window.open('#{url}','#{name}','resizable=yes,menubar=no,height=350,width=500').focus();" if(self.respond_to?(:onload=)) self.onload = script end script end |
#set_pass? ⇒ Boolean
127 128 129 130 |
# File 'lib/bbmb/html/view/customer.rb', line 127 def set_pass? @session.event == :change_pass \ || @session.error(:pass) || @session.error(:confirm_pass) end |
#turnover(model) ⇒ Object
131 132 133 134 135 136 137 138 |
# File 'lib/bbmb/html/view/customer.rb', line 131 def turnover(model) link = HtmlGrid::Link.new(:turnover, model, @session, self) args = { :customer_id => model.customer_id } link.href = @lookandfeel._event_url(:orders, args) link.value = sprintf(@lookandfeel.lookup(:currency_format), model.turnover) link.label = true link end |