Class: ODDB::View::Drugs::DateChooser

Inherits:
HtmlGrid::Composite show all
Defined in:
src/view/drugs/recentregs.rb

Constant Summary

COMPONENTS =
{
  [0,0,0] =>  :months,
  [0,0,1] =>  'navigation_divider',
  [0,0,2] =>  :years,
}
CSS_CLASS =
'composite'
LEGACY_INTERFACE =
false

Instance Method Summary (collapse)

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) months(model)



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'src/view/drugs/recentregs.rb', line 35

def months(model)
  date = @session.state.date
  year = date.year
  cmonth = date.month
  months = @session.state.months
  separator = @lookandfeel.lookup(:dash_separator)
  (1..12).collect { |month|
    mstr = @lookandfeel.lookup("month_#{month}")
    if(cmonth != month && months.include?(month))
      link = HtmlGrid::Link.new(:recent_registrations, model, @session, self)
      args = { :year => year, :month => month } 
      link.href = @lookandfeel._event_url(:recent_registrations, args)
      link.value = mstr
      link.css_class = 'list'
      [link, separator]
    else
      [mstr, separator]
    end
  }.flatten[0..-2]
end

- (Object) years(model)



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'src/view/drugs/recentregs.rb', line 17

def years(model)
  date = @session.state.date
  cyear = date.year
  month = date.month
  separator = @lookandfeel.lookup(:dash_separator)
  @session.state.years.collect { |year|
    if(cyear == year)
       [year, separator]
    else
      link = HtmlGrid::Link.new(:recent_registrations, model, @session, self)
      args = { :year => year, :month => month } 
      link.href = @lookandfeel._event_url(:recent_registrations, args)
      link.value = year
      link.css_class = 'list'
      [link, separator]
    end
  }.flatten[0..-2]
end