FIXED themengruppe verwalten + faqs order

This commit is contained in:
Andreas Stephanides
2014-03-29 13:10:41 +01:00
parent 7f9b0b996e
commit 5134e25b81
5 changed files with 9 additions and 6 deletions

View File

@@ -77,7 +77,7 @@ class ThemenController < ApplicationController
end end
end end
def fragen def fragen
@thema = Thema.find(params[:thema_id]) @thema = Thema.find(params[:id])
@fragen=@thema.fragen @fragen=@thema.fragen
respond_to do |format| respond_to do |format|
format.js format.js

View File

@@ -13,7 +13,7 @@ class ThemengruppenController < ApplicationController
end end
end end
def faqs def faqs
@themengruppen = Themengruppe.order(:priority).includes(:themen,{themen: :fragen}) @themengruppen = Themengruppe.order("themengruppen.priority").includes(:themen,{themen: :fragen}).order("themen.priority").reverse
end end

View File

@@ -1,3 +1,3 @@
<% verw_liste.each do |thema| %> <% verw_liste.each do |thema| %>
<li id="themen_<%= thema.id %>" class="sort" ><div class="contentbox handle" ><h2><%= thema.title %></h2> </div> <%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> <%= link_to thema_fragen_path(thema),:remote=>true do %> Fragen <% end %></li> <li id="themen_<%= thema.id %>" class="sort" ><div class="contentbox handle" ><h2><%= thema.title %></h2> </div> <%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> <%= link_to fragen_thema_path(thema),:remote=>true do %> Fragen <% end %></li>
<% end %> <% end %>

View File

@@ -2,8 +2,10 @@
<h2><%= tg.title%></h2> <h2><%= tg.title%></h2>
<ul> <ul>
<% tg.themen.each do |t| %> <% tg.themen.order(:priority).reverse.each do |t| %>
<li> <%= t.title %> <li><a name="themengruppe_<%=t.id.to_s%>"> <%= t.title %> &nbsp;</a>
<ul> <ul>
<% t.fragen.each do |f| %> <% t.fragen.each do |f| %>

View File

@@ -1,5 +1,6 @@
<div class="content-wrap content-column" > <div class="content-wrap content-column" >
<h2>sdffs2</h2> <%= link_to fa_icon("arrow-circle-left 2x")+" Alle Themengruppen", themengruppen_path, :class=>"linkbox" %>
<%= link_to fa_icon("question 2x")+" Häufige Fragen", faqs_themengruppen_path(:anchor=>"themengruppe_"+@themengruppe.id.to_s), :class=>"linkbox" %>
<h1><%= @themengruppe.title %></h1> <h1><%= @themengruppe.title %></h1>
<p> <p>
<%= @themengruppe.text %> <%= @themengruppe.text %>