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

Inherits:
HtmlGrid::Component show all
Includes:
Latin1
Defined in:
src/view/rss/feedback.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) to_html(context)



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'src/view/rss/feedback.rb', line 42

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.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 { ||
      if(parent = .item)
        item = feed.items.new_item
        item.author = "ODDB.org"
        title = case parent.odba_instance
                when ODDB::Package
                  title = @lookandfeel.lookup(:feedback_title, 
                                              parent.name, parent.size)
                when ODDB::Migel::Product
                  title = [ @lookandfeel.lookup(:feedback_title_migel), 
                            parent.name ].join
                end
        item.title = sanitize title
        
        url = @lookandfeel._event_url(:feedbacks, :pointer => parent.pointer)
        item.guid.content = item.link = url
        item.guid.isPermaLink = true
        item.date = .time

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