5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 05:44:16 +00:00

tomar en cuenta el idioma actual al cachear

para que al cambiar de idioma no se vean partes en el anterior
This commit is contained in:
f 2021-05-10 14:27:47 -03:00
parent 1e2b2d9de3
commit e0eeaf7fc6
5 changed files with 6 additions and 9 deletions

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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

View file

@ -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