diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index e8ceeebf..5b8f1a16 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -27,7 +27,7 @@ class PostsController < ApplicationController # XXX: Cada vez que cambiamos un Post tocamos el sitio con lo que es # más simple saber si hubo cambios. - if @category || @layout || stale?(@site) + if @category || @layout || stale?([current_usuarie, @site]) @posts = @site.posts(lang: locale) @posts = @posts.where(categories: @category) if @category @posts = @posts.where(layout: @layout) if @layout diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index a9819a1b..e46b2eda 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -43,7 +43,7 @@ - metadata = post[attribute] - type = metadata.type - - cache metadata do + - cache [metadata, I18n.locale] do = render("posts/attributes/#{type}", base: 'post', post: post, attribute: attribute, metadata: metadata, site: site, diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 291945ae..8d54069c 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -73,10 +73,7 @@ -# TODO: Solo les usuaries cachean porque tenemos que separar les botones por permisos. - - TODO: Verificar qué pasa cuando se gestiona el sitio en - distintos idiomas a la vez - - cache_if @usuarie, post do + - cache_if @usuarie, [post, I18n.locale] do - checkbox_id = "checkbox-#{post.uuid.value}" %tr{ id: post.uuid.value, data: { target: 'reorder.row' } } %td diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 9d6f37cd..da6ac9db 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -22,7 +22,7 @@ - metadata = @post[attr] - next unless metadata.front_matter? - - cache metadata do + - cache [metadata, I18n.locale] do = render("posts/attribute_ro/#{metadata.type}", post: @post, attribute: attr, metadata: metadata, @@ -36,6 +36,6 @@ - metadata = @post[attr] - next if metadata.front_matter? - - cache metadata do + - cache [metadata, I18n.locale] do %section.editor{ id: attr, dir: dir } = @post.public_send(attr).to_s.html_safe diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index dfcc2203..9d831584 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -18,7 +18,7 @@ -# TODO: Solo les usuaries cachean porque tenemos que separar les botones por permisos. - - cache_if (rol.usuarie? && !rol.temporal), site do + - cache_if (rol.usuarie? && !rol.temporal), [site, I18n.locale] do %tr %td %h2