Class: BBMB::Html::View::Unavailables

Inherits:
HtmlGrid::List
  • Object
show all
Defined in:
lib/bbmb/html/view/current_order.rb

Constant Summary collapse

BACKGROUND_ROW =
'bg'
BACKGROUND_SUFFIX =
''
CSS_CLASS =
'list'
COMPONENTS =
{
  [0,0]  =>  :delete_position,
  [1,0]  =>  :quantity,
  [2,0]  =>  :description,
}
CSS_MAP =
{
  [0,0] => 'delete',
  [1,0] => 'tiny right',
  [2,0] => 'description',
  [3,0] => 'right',
}
SORT_DEFAULT =
nil
OMIT_HEADER =
true

Instance Method Summary collapse

Instance Method Details

#delete_position(model) ⇒ Object



399
400
401
402
403
404
405
406
# File 'lib/bbmb/html/view/current_order.rb', line 399

def delete_position(model)
  link = HtmlGrid::Link.new(:delete, model, @session, self)
  url = @lookandfeel.base_url
  id = @list_index
  event = 'delete_unavailable'
  link.href = "javascript:delete_position('#{url}', '#{event}', '#{id}');"
  link
end

#description(model) ⇒ Object



407
408
409
410
411
412
413
414
415
416
417
# File 'lib/bbmb/html/view/current_order.rb', line 407

def description(model)
  span = HtmlGrid::Span.new(model, @session, self)
  parts = [model.description].compact
  [:ean13, :pcode].each { |key|
    if(value = model.send(key))
      parts.push(sprintf("%s: %s", @lookandfeel.lookup(key), value))
    end
  }
  span.value = @lookandfeel.lookup(:unavailable, parts.join(', '))
  span
end