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



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

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



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

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



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

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

#total_netto(model) ⇒ Object



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

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