Class: YDIM::Html::View::ItemList

Inherits:
HtmlGrid::List show all
Defined in:
lib/ydim/html/view/invoice.rb

Constant Summary collapse

COMPONENTS =
{
	[0,0]	=>	:time,
	[1,0]	=>	:text,
	[2,0]	=>	:quantity,
	[3,0]	=>	:unit,
	[4,0]	=>	:price,
	[5,0]	=>	:total_netto,
	[6,0]	=>	:delete,
}
CSS_ID =
'items'
CSS_MAP =
{
	[0,0]	=>	'standard-width',
	[5,0]	=>	'right',
}
COMPONENT_CSS_MAP =
{
	[1,0]	=>	'extralarge',
	[2,0]	=>	'small',
	[3,0]	=>	'medium',
	[4,0]	=>	'medium',
}
DEFAULT_CLASS =
HtmlGrid::InputText
SORT_DEFAULT =
nil

Constants inherited from HtmlGrid::List

HtmlGrid::List::STRIPED_BG

Instance Method Summary collapse

Methods inherited from HtmlGrid::List

ajax_inputs

Instance Method Details



49
50
51
52
53
54
55
# File 'lib/ydim/html/view/invoice.rb', line 49

def compose_footer(offset)
	link = HtmlGrid::Button.new(:create_item, @model, @session, self)
	args = { :unique_id => @session.state.model.unique_id }
	url = @lookandfeel.event_url(:ajax_create_item, args)
	link.set_attribute('onClick', "reload_list('items', '#{url}');")
	@grid.add(link, *offset)
end

#delete(model) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/ydim/html/view/invoice.rb', line 56

def delete(model)
	link = HtmlGrid::Link.new(:delete, model, @session, self)
	args = {
		:unique_id	=>	@session.state.model.unique_id,
		:index			=>	model.index,
	}
	url = @lookandfeel.event_url(:ajax_delete_item, args)
	link.href = "javascript: reload_list('items', '#{url}')"
	link
end

#time(model) ⇒ Object



66
67
68
69
70
# File 'lib/ydim/html/view/invoice.rb', line 66

def time(model)
	if(time = model.time)
		@lookandfeel.format_time(model.time)
	end
end

#total_netto(model) ⇒ Object



71
72
73
74
75
# File 'lib/ydim/html/view/invoice.rb', line 71

def total_netto(model)
	val = SpanValue.new(:total_netto, model, @session, self)
	val.css_id = "total_netto#{model.index}"
	val
end