Skip to content

Commit

Permalink
More formatting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
elzj committed Dec 20, 2011
1 parent a77d7ba commit 2727b73
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions app/helpers/works_helper.rb
Expand Up @@ -169,21 +169,26 @@ def download_url_for_work(work, format)
# Generates a list of a work's tags and details for use in feeds
def feed_summary(work)
tags = work.tags.group_by(&:type)
%w(Fandom Rating Warning Category Character Relationship Freeform).each do |type|
tags[type] ||= []
text = "<p>by #{byline(work, :visibility => 'public')}</p>"
text << work.summary
text << "<p>Words: #{work.word_count}, Chapters: #{work.chapter_total_display}, Language: #{work.language ? work.language.name : 'English'}</p>"
unless work.series.count == 0
text << "<p>Series: #{series_list_for_feeds(work)}</p>"
end
fandoms = tags['Fandom'].map{ |t| link_to_tag_works(t) }.join(', ')
rating_and_warnings = (tags['Rating'] + tags['Warning'] + tags['Category']).map{ |t| link_to_tag_works(t) }.join(', ')
other_tags = (tags['Character'] + tags['Relationship'] + tags['Freeform']).map{ |t| link_to_tag_works(t) }.join(', ')
text = work.summary
# Create list of tags
text << "<ul>"
text << "<li>Author: #{byline(work, :visibility => 'public')}</li>"
text << "<li>Fandom: #{fandoms}</li>"
text << "<li>Rating, warnings, and categories: #{rating_and_warnings}</li>"
text << "<li>Characters, relationships, and other tags: #{other_tags}</li>"
text << "<li>Words: #{work.word_count}, Chapters: #{work.chapter_total_display}, Language: #{work.language ? work.language.name : 'English'}</li>"
unless work.series.count == 0
text << "<li>Series: #{series_list_for_feeds(work)}</li>"
%w(Fandom Rating Warning Category Character Relationship Freeform).each do |type|
if tags[type]
label = case type
when 'Freeform'
'Additional Tags'
when 'Rating'
'Rating'
else
type.pluralize
end
text << "<li>#{label}: #{tags[type].map{ |t| link_to_tag_works(t) }.join(', ')}</li>"
end
end
text << "</ul>"
text
Expand Down

0 comments on commit 2727b73

Please sign in to comment.