This commit is contained in:
Andreas Stephanides
2015-02-23 09:21:54 +01:00
parent 53ef07ab1a
commit 52a33a027c

View File

@@ -2,16 +2,17 @@
<div class="content-wrap content-column"> <div class="content-wrap content-column">
<% @themengruppen.each do |tg| %> <% @themengruppen.each do |tg| %>
<% if can?(:show, tg) %> <% themen = tg.themen.accessible_by(current_ability, :show).order(:priority).reverse_order.select{|t| !t.fragen.empty?} %>
<% if can?(:show, tg) && !themen.empty? %>
<div class="contentbox"> <div class="contentbox">
<a name="themengruppe_<%=tg.id.to_s%>"></a> <a name="themengruppe_<%=tg.id.to_s%>"></a>
<h2> <%= tg.title%></h2> <h2> <%= tg.title%></h2>
<ul> <ul>
<% tg.themen.order(:priority).reverse.each do |t| %> <% tg.themen.order(:priority).reverse.each do |t| %>
<% if can?(:show, t) %> <% if can?(:show, t) && !t.fragen.empty? %>
<li> <%= t.title %> <li> <%= t.title %>
<ul> <ul>
<% t.fragen.each do |f| %> <% t.fragen.order(:title).each do |f| %>
<li> <li>
<b> <%= f.title %>?</b> <b> <%= f.title %>?</b>
<p> <%= raw(f.text) %></p> <p> <%= raw(f.text) %></p>