NARKOZ/ginatra

View on GitHub
views/atom.erb

Summary

Maintainability
Test Coverage
<%
  base_url = url prefix_url("#{@repo.param}")

  if params[:ref]
    url   = "#{base_url}/#{params[:ref]}"
    name  = "#{@repo.name}: #{params[:ref]}"
  else
    url   = base_url
    name  = "#{@repo.name}: master"
  end
%><?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id><%= url %></id>
  <title>Commits to <%= name %></title>
  <subtitle><%= h(@repo.description) %></subtitle>
  <link href="<%= url %>"/>
  <link rel="self" href="<%= url %>.atom"/>
  <updated><%= @commits.first ? rfc_date(@commits.first.committer[:time]) : rfc_date(Time.now.utc) %></updated>
  <% @commits.each do |commit| %>
    <entry>
      <id><%= "#{base_url}/commit/#{commit.oid[0..6]}" %></id>
      <title><%= "Commit #{commit.oid[0..6]} to #{@repo.name}" %></title>
      <content><%= h(simple_format commit.message) %></content>
      <link href="<%= "#{base_url}/commit/#{commit.oid[0..6]}" %>"/>
      <updated><%= rfc_date(commit.committer[:time]) %></updated>
      <author>
        <name><%= commit.author[:name] %></name>
        <email><%= commit.author[:email] %></email>
      </author>
    </entry>
  <% end %>
</feed>