caching fuer neuigkeiten and bsp

This commit is contained in:
Andreas Stephanides
2015-03-06 16:41:08 +01:00
parent bd3c3a25e1
commit 8bf5583e00
5 changed files with 25 additions and 13 deletions

View File

@@ -82,7 +82,9 @@
</p>
<%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %>
<% @lva.beispiele.order(:datum).each do |b| %>
<%= render b%>
<% cache("beispiel_" +b.id.to_s + "_" + b.updated_at.try(:utc).try(:to_s)) do %>
<%= render b%>
<% end %>
<% end %>
</div>
</div>

View File

@@ -1,21 +1,30 @@
<% if defined?(wrap_in) && !wrap_in.blank? %>
<%= content_tag wrap_in do %>
<% c =[:linkbox] %>
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
<% c << "unpublished" unless neuigkeit.published? %>
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
<% end %>
<%= content_tag wrap_in do %>
<% end %>
<% cache("neuigkeit_"+neuigkeit.id.to_s+"_"+neuigkeit.updated_at.try(:utc).try(:to_s)) do %>
<% c =[:linkbox] %>
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
<% c << "unpublished" unless neuigkeit.published? %>
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
<% end %>
<% end %>
<% end %>
<% else %>
<% cache("neuigkeit_"+neuigkeit.id.to_s+"_"+neuigkeit.updated_at.try(:utc).try(:to_s)) do %>
<% c =[:linkbox] %>
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
<% c << "unpublished" unless neuigkeit.published? %>
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
<% end %>
<% end %>
<% end %>