You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

feed.atom.builder 1.4KB

12345678910111213141516171819202122232425262728293031323334
  1. # frozen_string_literal: true
  2. xml.instruct!
  3. xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
  4. xml.title truncate_single_line_raw(@title, 300)
  5. xml.link "rel" => "self", "href" => url_for(:params => request.query_parameters, :only_path => false, :format => 'atom')
  6. xml.link "rel" => "alternate", "href" => url_for(:params => request.query_parameters.merge(:format => nil, :key => nil), :only_path => false)
  7. xml.id home_url
  8. xml.icon favicon_url
  9. xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
  10. xml.author {xml.name "#{Setting.app_title}"}
  11. xml.generator(:uri => Redmine::Info.url) {xml.text! Redmine::Info.app_name}
  12. @items.each do |item|
  13. xml.entry do
  14. url = url_for(item.event_url(:only_path => false))
  15. if @project == item.project
  16. xml.title truncate_single_line_raw(item.event_title, 300)
  17. else
  18. xml.title truncate_single_line_raw("#{item.project} - #{item.event_title}", 300)
  19. end
  20. xml.link "rel" => "alternate", "href" => url
  21. xml.id url
  22. xml.updated item.event_datetime.xmlschema
  23. author = item.event_author if item.respond_to?(:event_author)
  24. xml.author do
  25. xml.name(author)
  26. xml.email(author.mail) if author.is_a?(User) && author.mail.present? && !author.pref.hide_mail
  27. end if author
  28. xml.content "type" => "html" do
  29. xml.text! textilizable(item, :event_description, :only_path => false)
  30. end
  31. end
  32. end
  33. end