From b9d436789c7550c5423c7af5ca3704193410a143 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Wed, 24 Jun 2015 11:17:15 +0200
Subject: [PATCH] beispiel ability cache fix
---
app/models/ability.rb | 7 ++++---
app/views/lvas/show.html.erb | 2 +-
app/views/themes/blue2/lvas/show.html.erb | 6 +++---
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 1b460d5..2696730 100755
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -21,10 +21,11 @@ class Ability
can [:create, :show], Beispiel
if loggedin
can :like, Beispiel
- can :dislike, Beispiel
-
+ can :dislike, Beispiel
+ end
+ if (user.has_role?("moderator",Beispiel))
+ can :flag, Beispiel
end
-
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :manage, Modulgruppe
can :manage, Modul
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index 4bc6e79..e873aa7 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -86,7 +86,7 @@
<%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %>
<% @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%>
<% end %>
<% end %>
diff --git a/app/views/themes/blue2/lvas/show.html.erb b/app/views/themes/blue2/lvas/show.html.erb
index cd7efcb..253114a 100755
--- a/app/views/themes/blue2/lvas/show.html.erb
+++ b/app/views/themes/blue2/lvas/show.html.erb
@@ -88,14 +88,14 @@
<%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %>
<% @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%>
<% end %>
<% end %>
<% if @beispiele_badQ.count > 0 %>
Bad Quality or Outdated
<% @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%>
<% end %>
<% end %>
@@ -103,7 +103,7 @@
<% if @beispiele_deleted.count > 0 %>
Trash
<% @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%>
<% end %>
<% end %>