Class: ODDB::View::Rss::MiniFi

Inherits:
HtmlGrid::Component show all
Includes:
Latin1
Defined in:
src/view/rss/minifi.rb

Constant Summary

HTTP_HEADERS =
{
  "Content-Type"  => "application/rss+xml",
}

Instance Method Summary (collapse)

Methods included from Latin1

#sanitize

Methods inherited from HtmlGrid::Component

#additional_javascripts, #dynamic_html

Instance Method Details

- (Object) date2time(date)



58
59
60
# File 'src/view/rss/minifi.rb', line 58

def date2time(date)
  Time.parse(date.strftime('%Y-%m-%d 08:00:00 CET'))
end

- (Object) to_html(context)



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'src/view/rss/minifi.rb', line 31

def to_html(context)
  RSS::Maker.make('2.0') { |feed|
    feed.channel.title = @lookandfeel.lookup(:minifi_feed_title)
    feed.channel.link = @lookandfeel._event_url(:home)
    feed.channel.description = @lookandfeel.lookup(:minifi_feed_description)
    feed.channel.language = @session.language
    feed.image.url = @lookandfeel.resource(:logo_rss)
    feed.image.title = @lookandfeel.lookup(:logo)
    feed.encoding = 'UTF-8'
    feed.xml_stylesheets.new_xml_stylesheet.href = @lookandfeel.resource(:css)
    @model.each { |minifi|

      document = minifi.send(@session.language)
      item = feed.items.new_item
      item.author = "ODDB.org"

      comp = MiniFiTemplate.new(minifi, @session, self)

      item.title = sanitize(document.heading)
      item.guid.content = item.link = @lookandfeel._event_url(:resolve, 
                                        :pointer => minifi.pointer)
      item.guid.isPermaLink = true
      item.date = date2time(minifi.publication_date)
      item.description = sanitize(comp.to_html(context))
    }
  }.to_s
end