caching fuer neuigkeiten and bsp
This commit is contained in:
@@ -20,7 +20,7 @@ class Calentry < ActiveRecord::Base
|
|||||||
validates :object, :presence => true
|
validates :object, :presence => true
|
||||||
validates :typ, :presence => true
|
validates :typ, :presence => true
|
||||||
before_save :get_public
|
before_save :get_public
|
||||||
belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
belongs_to :object, polymorphic: true, touch: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
||||||
|
|
||||||
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
|
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
|
||||||
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
|
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class Meeting < ActiveRecord::Base
|
class Meeting < ActiveRecord::Base
|
||||||
belongs_to :parent, :polymorphic=>true
|
belongs_to :parent, :polymorphic=>true, touch: true
|
||||||
belongs_to :meetingtyp
|
belongs_to :meetingtyp
|
||||||
|
|
||||||
attr_accessible :desc, :intern, :name, :parent_id, :parent_type, :calentry,:calentry_attributes, :meetingtyp_id
|
attr_accessible :desc, :intern, :name, :parent_id, :parent_type, :calentry,:calentry_attributes, :meetingtyp_id
|
||||||
|
|
||||||
belongs_to :neuigkeit
|
belongs_to :neuigkeit, touch: true
|
||||||
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
|
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
|
||||||
has_one :agenda , :as=>:parent,:conditions=>{:typ=>11}, :class_name=>'Document'
|
has_one :agenda , :as=>:parent,:conditions=>{:typ=>11}, :class_name=>'Document'
|
||||||
has_one :calentry, as: :object
|
has_one :calentry, as: :object
|
||||||
|
|||||||
@@ -82,8 +82,10 @@
|
|||||||
</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 %>
|
||||||
<% @lva.beispiele.order(:datum).each do |b| %>
|
<% @lva.beispiele.order(:datum).each do |b| %>
|
||||||
|
<% cache("beispiel_" +b.id.to_s + "_" + b.updated_at.try(:utc).try(:to_s)) do %>
|
||||||
<%= render b%>
|
<%= render b%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<% if defined?(wrap_in) && !wrap_in.blank? %>
|
<% if defined?(wrap_in) && !wrap_in.blank? %>
|
||||||
|
|
||||||
<%= content_tag wrap_in do %>
|
<%= content_tag wrap_in do %>
|
||||||
|
|
||||||
|
<% cache("neuigkeit_"+neuigkeit.id.to_s+"_"+neuigkeit.updated_at.try(:utc).try(:to_s)) do %>
|
||||||
<% c =[:linkbox] %>
|
<% c =[:linkbox] %>
|
||||||
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
||||||
<% c << "unpublished" unless neuigkeit.published? %>
|
<% c << "unpublished" unless neuigkeit.published? %>
|
||||||
@@ -9,13 +11,20 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
|
<% cache("neuigkeit_"+neuigkeit.id.to_s+"_"+neuigkeit.updated_at.try(:utc).try(:to_s)) do %>
|
||||||
|
|
||||||
<% c =[:linkbox] %>
|
<% c =[:linkbox] %>
|
||||||
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
<% 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 %>
|
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
|
||||||
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
|
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ module LikeVoteable
|
|||||||
else
|
else
|
||||||
@obj.liked_by current_user
|
@obj.liked_by current_user
|
||||||
end
|
end
|
||||||
|
@obj.touch
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to @obj
|
redirect_to @obj
|
||||||
@@ -30,7 +31,7 @@ module LikeVoteable
|
|||||||
else
|
else
|
||||||
@obj.disliked_by current_user
|
@obj.disliked_by current_user
|
||||||
end
|
end
|
||||||
|
@obj.touch
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to @obj
|
redirect_to @obj
|
||||||
|
|||||||
Reference in New Issue
Block a user