Class: ODDB::View::PopupLogo

Inherits:
HtmlGrid::Component show all
Defined in:
src/view/logo.rb

Direct Known Subclasses

Logo

Constant Summary

CSS_CLASS =
'logo'
LOGO_KEY =
:logo

Instance Method Summary (collapse)

Methods inherited from HtmlGrid::Component

#additional_javascripts, #dynamic_html

Instance Method Details

- (Object) init



11
12
13
14
15
16
17
18
# File 'src/view/logo.rb', line 11

def init
  super
  if(@lookandfeel)
    @attributes.update(@lookandfeel.attributes(self::class::LOGO_KEY))
    @attributes['src'] = zone_logo_src(self::class::LOGO_KEY)
    @attributes['alt'] = @lookandfeel.lookup(self::class::LOGO_KEY)
  end
end

- (Object) logo_src(key)



27
28
29
30
31
32
33
# File 'src/view/logo.rb', line 27

def logo_src(key)
  if(@lookandfeel.enabled?(:multilingual_logo, false))
    @lookandfeel.resource_localized(key)
  else
    @lookandfeel.resource(key)
  end
end

- (Object) to_html(context)



19
20
21
22
23
24
25
26
# File 'src/view/logo.rb', line 19

def to_html(context)
  link_attrs = {
    "href" => @lookandfeel._event_url(:home)
  }
  context.a(link_attrs) {
    context.img(@attributes)
  }
end

- (Object) zone_logo_src(key)



34
35
36
37
38
39
40
# File 'src/view/logo.rb', line 34

def zone_logo_src(key)
  src = if(@lookandfeel.enabled?(:zone_logo))
    zone_key = [key, @session.state.zone].join('_').intern
    logo_src(zone_key)
  end
  src || logo_src(key)
end