Project overview page
This commit is contained in:
parent
01b8494f18
commit
0e6b0d7e43
8 changed files with 80 additions and 1 deletions
16
lib/articlesummary.rb
Normal file
16
lib/articlesummary.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require 'nokogiri'
|
||||
|
||||
def article_summary(item, separator=/<!-- *more *-->/)
|
||||
# Has intro attribute? Use this
|
||||
if (item[:intro] && item[:intro].length>0)
|
||||
return parse_markdown(item[:intro])
|
||||
end
|
||||
# Try to extract marked teaser from article
|
||||
summary,body = item.compiled_content.split(separator)
|
||||
if (body)
|
||||
return summary
|
||||
end
|
||||
# Else: Extract first top level html element
|
||||
doc = Nokogiri::Slop(item.compiled_content)
|
||||
return doc.children[0].to_html
|
||||
end
|
||||
9
lib/projectpages.rb
Normal file
9
lib/projectpages.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def projects_by_state()
|
||||
@cache_projects ||= items.select { |i| i[:kind] == 'project' }.sort_by { |i| i[:title] }
|
||||
@cache_projects_by_state ||= @cache_projects.group_by { |item| item[:status] }
|
||||
@cache_projects_by_state
|
||||
end
|
||||
|
||||
def project_id(project)
|
||||
project.identifier.split('/')[2]
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue