Class: ODDB::View::PayPal::ReturnComposite

Inherits:
HtmlGrid::Composite show all
Includes:
DataDeclaration
Defined in:
src/view/paypal/return.rb

Constant Summary

COMPONENTS =

in this class, COMPONENTS only includes the unchanging components

{
  [0,0,1] =>  'dash_separator',
  [0,0,2] =>  :data_declaration,
}
CSS_CLASS =
'composite'
CSS_MAP =
{
  [0,0] =>  'th',
  [0,1] =>  'list',
}
LEGACY_INTERFACE =
false

Instance Method Summary (collapse)

Methods included from DataDeclaration

#data_declaration

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) back(model)



103
104
105
106
107
# File 'src/view/paypal/return.rb', line 103

def back(model)
  button = super
  button.value = @lookandfeel.lookup(:back_to_download)
  button
end


108
109
110
# File 'src/view/paypal/return.rb', line 108

def download_links(model)
  ReturnDownloads.new(model.items, @session, self)
end

- (Object) init



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
# File 'src/view/paypal/return.rb', line 72

def init
  if(@model.nil?)
    components.update({
      [0,0,0] =>  'paypal_unconfirmed',
      [0,1]   =>  'paypal_e_missing_invoice',
      [0,2]   =>  :back,
    })
    css_map.store([0,1], 'error')
  else
    if(@model.payment_received?)
      suffix = @model.items.size == 1 ? 's' : 'p'
      txt = @model.items.first.text
      if protocol = DOWNLOAD_PROTOCOLS.find do |prt| %r{#{prt}}.match(txt) end
        suffix = 'p'
      end
      components.update({
        [0,0,0]  => 'paypal_success',
        [0,1]  =>  "paypal_msg_success_#{suffix}",
        [0,2]  =>  :download_links,
        [0,3]  =>  :back,
      })
    else
      components.update({
        [0,0,0]  => 'paypal_unconfirmed',
        [0,1]    => 'paypal_msg_unconfirmed',
        [0,2]    => :back,
      })
    end
  end
  super
end