Class: ODDB::Html::View::Rss::Feedback

Inherits:
HtmlGrid::Component
  • Object
show all
Includes:
Drugs::PackageMethods
Defined in:
lib/oddb/html/view/rss/feedback.rb

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#to_html(context) ⇒ Object



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
58
59
# File 'lib/oddb/html/view/rss/feedback.rb', line 31

def to_html(context)
  RSS::Maker.make('2.0') { |feed|
    feed.channel.title = @lookandfeel.lookup(:feedback_feed_title)
    feed.channel.link = @lookandfeel._event_url(:home)
    feed.channel.description = @lookandfeel.lookup(:feedback_feed_description)
    feed.channel.language = @session.language
    feed.encoding = 'UTF-8'
    feed.xml_stylesheets.new_xml_stylesheet.href = @lookandfeel.resource(:css)
    size = @model.size
    @model.each_with_index { |feedback, idx|
      if(parent = feedback.item)
        item = feed.items.new_item
        item.author = "de.ODDB.org"
        title = @lookandfeel.lookup(:feedback_for, parent.name, size(parent))
        item.title = title
        
        url = @lookandfeel._event_url(:feedback, 
                                      [:pzn, parent.code(:cid),
                                       :index, size - idx])
        item.guid.content = item.link = url
        item.guid.isPermaLink = true
        item.date = feedback.time

        comp = FeedbackTemplate.new(feedback, @session, self)
        item.description = comp.to_html(context)
      end
    }
  }.to_s
end