Skip to content

Commit

Permalink
Add a link to download epub in atom feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Jul 1, 2013
1 parent 9262cef commit ad5c642
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -96,9 +96,9 @@ See also
If you want the full stack for running LinuxFr.org, you should also look at:

* [The admin files](https://github.com/nono/admin-linuxfr.org)
* [The migration script](https://github.com/nono/migration-linuxfr.org)
* [The board daemon](https://github.com/nono/board-sse-linuxfr.org)
* [The share daemon](https://github.com/nono/share-LinuxFr.org)
* [The migration script](https://github.com/nono/migration-linuxfr.org)
* [The epub daemon](https://github.com/nono/epub-LinuxFr.org)
* [The img daemon](https://github.com/nono/img-LinuxFr.org)

Expand Down
3 changes: 2 additions & 1 deletion app/views/diaries/index.atom.builder
Expand Up @@ -14,7 +14,8 @@ atom_feed(:root_url => diaries_url, "xmlns:wfw" => "http://wellformedweb.org/Com
if diary.node.cc_licensed
entry.rights("Licence CC by-sa http://creativecommons.org/licenses/by-sa/3.0/deed.fr")
end
entry.content(diary.body + atom_comments_link(url), :type => 'html')
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
entry.content(diary.body + epub + atom_comments_link(url), :type => 'html')
entry.author do |author|
author.name(diary.owner.name)
end
Expand Down
3 changes: 2 additions & 1 deletion app/views/forums/index.atom.builder
Expand Up @@ -12,7 +12,8 @@ atom_feed(:root_url => forums_url, "xmlns:wfw" => "http://wellformedweb.org/Comm
url = forum_post_url(:forum_id => post.forum, :id => post)
feed.entry(post, :url => url) do |entry|
entry.title(post.title)
entry.content(post.body + atom_comments_link(url), :type => 'html')
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
entry.content(post.body + epub + atom_comments_link(url), :type => 'html')
entry.author do |author|
author.name(post.user.name)
end
Expand Down
3 changes: 2 additions & 1 deletion app/views/forums/show.atom.builder
Expand Up @@ -6,8 +6,9 @@ atom_feed(:root_url => forum_url(@forum), "xmlns:wfw" => "http://wellformedweb.o
@posts.each do |post|
url = url_for([@forum, post])
feed.entry([@forum, post], :id => "tag:linuxfr.org,2005:ForumPost/#{post.id}") do |entry|
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
entry.title(post.title)
entry.content(post.body + atom_comments_link(url), :type => 'html')
entry.content(post.body + epub + atom_comments_link(url), :type => 'html')
entry.author do |author|
author.name(post.user.name)
end
Expand Down
6 changes: 4 additions & 2 deletions app/views/news/index.atom.builder
Expand Up @@ -10,6 +10,7 @@ atom_feed(:root_url => news_index_url, "xmlns:wfw" => "http://wellformedweb.org/

@nodes.map(&:content).each do |news|
feed.entry(news, :published => news.node.created_at) do |entry|
url = news_url news
entry.title(news.title)
if news.node.cc_licensed
entry.rights("Licence CC by-sa http://creativecommons.org/licenses/by-sa/3.0/deed.fr")
Expand All @@ -20,8 +21,9 @@ atom_feed(:root_url => news_index_url, "xmlns:wfw" => "http://wellformedweb.org/
link_to(l.title, "http://#{MY_DOMAIN}/redirect/#{l.id}", :title => l.url, :hreflang => l.lang))
end.join.html_safe)
second = content_tag(:div, news.second_part)
comments = atom_comments_link(news_url news)
entry.content(first + links + second + comments, :type => 'html')
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
comments = atom_comments_link(url)
entry.content(first + links + second + epub + comments, :type => 'html')
news.attendees.each do |attendee|
entry.author do |author|
author.name(attendee.name)
Expand Down
3 changes: 2 additions & 1 deletion app/views/polls/index.atom.builder
Expand Up @@ -7,7 +7,8 @@ atom_feed(:root_url => polls_url, "xmlns:wfw" => "http://wellformedweb.org/Comme
feed.entry(poll, :published => poll.node.created_at) do |entry|
url = poll_url(poll)
entry.title(poll.title)
entry.content(poll_body(poll) + atom_comments_link(url), :type => 'html')
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
entry.content(poll_body(poll) + epub + atom_comments_link(url), :type => 'html')
entry.author do |author|
author.name(poll.node.user.name)
end
Expand Down
4 changes: 3 additions & 1 deletion app/views/sections/show.atom.builder
Expand Up @@ -7,7 +7,9 @@ atom_feed(:root_url => section_url(@section), "xmlns:wfw" => "http://wellformedw
@news.each do |news|
feed.entry(news) do |entry|
entry.title(news.title)
entry.content(news.body + atom_comments_link(news_url news), :type => 'html')
url = news_url news
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
entry.content(news.body + epub + atom_comments_link(url), :type => 'html')
entry.author do |author|
author.name(news.author_name)
end
Expand Down
4 changes: 3 additions & 1 deletion app/views/wiki_pages/index.atom.builder
Expand Up @@ -7,7 +7,9 @@ atom_feed(:root_url => wiki_pages_url, "xmlns:wfw" => "http://wellformedweb.org/
@wiki_pages.each do |page|
feed.entry(page) do |entry|
entry.title(page.title)
entry.content(page.body + atom_comments_link(wiki_page_url page), :type => 'html')
url = wiki_page_url page
epub = content_tag(:div, link_to("Télécharger ce contenu au format Epub", "#{url}.epub"))
entry.content(page.body + epub + atom_comments_link(url), :type => 'html')
entry.author do |author|
author.name(page.node.user.try :name)
end
Expand Down

0 comments on commit ad5c642

Please sign in to comment.