beispiel ability cache fix

This commit is contained in:
Andreas Stephanides
2015-06-24 11:17:15 +02:00
parent d93fd7e6b0
commit b9d436789c
3 changed files with 8 additions and 7 deletions

View File

@@ -22,9 +22,10 @@ class Ability
if loggedin if loggedin
can :like, Beispiel can :like, Beispiel
can :dislike, Beispiel can :dislike, Beispiel
end end
if (user.has_role?("moderator",Beispiel))
can :flag, Beispiel
end
if( user.has_role?("fetuser") || user.has_role?("fetadmin")) if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :manage, Modulgruppe can :manage, Modulgruppe
can :manage, Modul can :manage, Modul

View File

@@ -86,7 +86,7 @@
</p> </p>
<%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %> <%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %>
<% @beispiele_all.each do |b| %> <% @beispiele_all.each do |b| %>
<% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + b.updated_at.try(:utc).try(:to_s)) do %> <% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + can?(:flag, b).to_s + "_" + can?(:like, b).to_s + "_" + b.updated_at.try(:utc).try(:to_s) + get_theme.to_s) do %>
<%= render b%> <%= render b%>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -88,14 +88,14 @@
</p> </p>
<%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %> <%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %>
<% @beispiele.each do |b| %> <% @beispiele.each do |b| %>
<% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + b.updated_at.try(:utc).try(:to_s)) do %> <% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + can?(:flag, b).to_s + "_" + can?(:like, b).to_s + "_" + b.updated_at.try(:utc).try(:to_s) + get_theme.to_s) do %>
<%= render b%> <%= render b%>
<% end %> <% end %>
<% end %> <% end %>
<% if @beispiele_badQ.count > 0 %> <% if @beispiele_badQ.count > 0 %>
<h3> Bad Quality or Outdated</h3> <h3> Bad Quality or Outdated</h3>
<% @beispiele_badQ.each do |b| %> <% @beispiele_badQ.each do |b| %>
<% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + b.updated_at.try(:utc).try(:to_s)) do %> <% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + can?(:flag, b).to_s + "_" + can?(:like, b).to_s + "_" + b.updated_at.try(:utc).try(:to_s) + get_theme.to_s) do %>
<%= render b%> <%= render b%>
<% end %> <% end %>
<% end %> <% end %>
@@ -103,7 +103,7 @@
<% if @beispiele_deleted.count > 0 %> <% if @beispiele_deleted.count > 0 %>
<h3> Trash</h3> <h3> Trash</h3>
<% @beispiele_deleted.each do |b| %> <% @beispiele_deleted.each do |b| %>
<% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + can?(:flag,b).to_s+ "_" + b.updated_at.try(:utc).try(:to_s)) do %> <% cache("beispiel_" +I18n.locale.to_s+b.id.to_s+can?(:delete,b).to_s+"_"+can?(:edit,b).to_s + "_" + can?(:flag, b).to_s + "_" + can?(:like, b).to_s + "_" + b.updated_at.try(:utc).try(:to_s) + get_theme.to_s) do %>
<%= render b%> <%= render b%>
<% end %> <% end %>
<% end %> <% end %>