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



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

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


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

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

#lgpl_license(model) ⇒ Object



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

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



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

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


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

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

#version(model) ⇒ Object



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

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



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

def ydim_version(model)
	link = standard_link(:ydim_version, model)
	link.href = 'http://scm.ywesee.com/?p=ydim-html;a=summary'
	link.set_attribute('title', YDIM_VERSION)
	link
end