Class: YDIM::Html::View::Template

Inherits:
HtmlGrid::DivTemplate
  • Object
show all
Defined in:
lib/ydim/html/view/template.rb

Direct Known Subclasses

Confirm, Debitor, Debitors, Init, Invoice, Invoices

Constant Summary collapse

COMPONENTS =
{
	[0,0]		=>	:subnavigation,
	[1,0]		=>	:foot,
	[0,1]		=>	:content,
	[0,2]		=>	:version,
	[1,2]		=>	'ydim',
}
CSS_MAP =
['head', 'content', 'foot',]
DIV_CLASS =
'template'
FOOT =
Navigation
LEGACY_INTERFACE =
false

Instance Method Summary collapse

Instance Method Details

#content(model) ⇒ Object



25
26
27
# File 'lib/ydim/html/view/template.rb', line 25

def content(model)
	@content ||= super
end


28
29
30
31
32
# File 'lib/ydim/html/view/template.rb', line 28

def cpr_link(model)
	link = standard_link(:cpr_link, model)
	link.href = 'http://www.ywesee.com'
	link
end

#lgpl_license(model) ⇒ Object



33
34
35
36
37
# File 'lib/ydim/html/view/template.rb', line 33

def lgpl_license(model)
	link = standard_link(:lgpl_license, model)
	link.href = 'http://www.gnu.org/copyleft/lesser.html'
	link
end

#other_html_headers(context) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ydim/html/view/template.rb', line 38

def other_html_headers(context)
	res = super
	['dojo', 'ydim'].each { |name|
		properties = {
			"language"	=>	"JavaScript",
			"type"			=>	"text/javascript",
			"src"				=>	@lookandfeel.resource_global(:javascript, "#{name}.js"),
		}
		res << context.script(properties)
	}
	res
end


50
51
52
# File 'lib/ydim/html/view/template.rb', line 50

def standard_link(key, model)
	HtmlGrid::Link.new(key, model, @session, self)
end

#version(model) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/ydim/html/view/template.rb', line 53

def version(model)
	span = HtmlGrid::Span.new(model, @session, self)
	span.css_id = 'version'
	span.value = [ 
		lgpl_license(model), @lookandfeel.lookup('comma'), Time.now.year.to_s,
		cpr_link(model), @lookandfeel.lookup('comma'), ydim_version(model),
	]
	span
end

#ydim_version(model) ⇒ Object



62
63
64
65
66
67
# File 'lib/ydim/html/view/template.rb', line 62

def ydim_version(model)
	link = standard_link(:ydim_version, model)
	link.href = 'https://github.com/zdavatz/ydim-html'
	link.set_attribute('title', YDIM_VERSION)
	link
end