Project overview page
This commit is contained in:
parent
01b8494f18
commit
0e6b0d7e43
8 changed files with 80 additions and 1 deletions
1
Gemfile
1
Gemfile
|
|
@ -8,4 +8,5 @@ gem 'adsf'
|
||||||
gem 'sass'
|
gem 'sass'
|
||||||
gem 'rdiscount'
|
gem 'rdiscount'
|
||||||
gem 't'
|
gem 't'
|
||||||
|
gem 'nokogiri'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,15 @@ GEM
|
||||||
rb-kqueue (>= 0.2)
|
rb-kqueue (>= 0.2)
|
||||||
lumberjack (1.0.4)
|
lumberjack (1.0.4)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
|
mini_portile (0.5.1)
|
||||||
multi_json (1.6.1)
|
multi_json (1.6.1)
|
||||||
multipart-post (1.1.5)
|
multipart-post (1.1.5)
|
||||||
nanoc (3.6.4)
|
nanoc (3.6.4)
|
||||||
cri (~> 2.3)
|
cri (~> 2.3)
|
||||||
nanoc3 (3.3.0)
|
nanoc3 (3.3.0)
|
||||||
nanoc (>= 3.3.0)
|
nanoc (>= 3.3.0)
|
||||||
|
nokogiri (1.6.0)
|
||||||
|
mini_portile (~> 0.5.0)
|
||||||
oauth (0.4.7)
|
oauth (0.4.7)
|
||||||
oj (2.0.7)
|
oj (2.0.7)
|
||||||
pry (0.9.12.2)
|
pry (0.9.12.2)
|
||||||
|
|
@ -105,6 +108,7 @@ DEPENDENCIES
|
||||||
adsf
|
adsf
|
||||||
guard-nanoc
|
guard-nanoc
|
||||||
nanoc3
|
nanoc3
|
||||||
|
nokogiri
|
||||||
rdiscount
|
rdiscount
|
||||||
sass
|
sass
|
||||||
systemu
|
systemu
|
||||||
|
|
|
||||||
25
content/projects/index.html
Normal file
25
content/projects/index.html
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
-----
|
||||||
|
title: Projekte
|
||||||
|
kind: page
|
||||||
|
-----
|
||||||
|
<%
|
||||||
|
prj = projects_by_state
|
||||||
|
%>
|
||||||
|
<% if prj.has_key?('active') %>
|
||||||
|
<h1>Aktive Projekte</h1>
|
||||||
|
<div class="itemlist">
|
||||||
|
<%= render 'project_list', :projects => prj['active'], :extended => true %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if prj.has_key?('completed') %>
|
||||||
|
<h1>Abgeschlossene Projekte</h1>
|
||||||
|
<div class="itemlist">
|
||||||
|
<%= render 'project_list', :projects => prj['completed'], :extended => true %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if prj.has_key?('stalled') %>
|
||||||
|
<h1>Ruhende Projekte</h1>
|
||||||
|
<div class="itemlist">
|
||||||
|
<%= render 'project_list', :projects => prj['stalled'], :extended => true %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
<li><a class="active" href="/about/">Wir über uns</a>
|
<li><a class="active" href="/about/">Wir über uns</a>
|
||||||
<li><a href="#">Veranstaltungen</a>
|
<li><a href="#">Veranstaltungen</a>
|
||||||
<li><a href="#">Aktivitäten</a>
|
<li><a href="#">Aktivitäten</a>
|
||||||
<li><a href="#">Projekte</a>
|
<li><a href="/projects/">Projekte</a>
|
||||||
<li><a href="/members/">Members</a>
|
<li><a href="/members/">Members</a>
|
||||||
<li><a href="/planet-cccs/">Planet CCCS</a>
|
<li><a href="/planet-cccs/">Planet CCCS</a>
|
||||||
<li><a href="#">Archiv</a>
|
<li><a href="#">Archiv</a>
|
||||||
|
|
|
||||||
21
layouts/project_intro.erb
Normal file
21
layouts/project_intro.erb
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
-----
|
||||||
|
filter: erb
|
||||||
|
-----
|
||||||
|
<%
|
||||||
|
prjname = @project.identifier.split('/')[2]
|
||||||
|
%>
|
||||||
|
<article id="p_<%= prjname %>">
|
||||||
|
<header>
|
||||||
|
<h1><a href="/projects/<%= prjname %>"><%= @project[:title]%></a></h1>
|
||||||
|
<% if @project.attributes.has_key?(:subtitle) then %>
|
||||||
|
<h2><%= @project[:subtitle] %></h2>
|
||||||
|
<% end %>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</header>
|
||||||
|
<section class="<%= @classes %>">
|
||||||
|
<% if @extended then %>
|
||||||
|
<%= article_summary(@project) %>
|
||||||
|
<% end %>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
|
||||||
3
layouts/project_list.erb
Normal file
3
layouts/project_list.erb
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<% @projects.each do |prj| %>
|
||||||
|
<%= render 'project_intro', :project => prj, :classes => "hyphenate", :extended => @extended %>
|
||||||
|
<% end %>
|
||||||
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