diff --git a/app/models/site/layout_ordering.rb b/app/models/site/layout_ordering.rb index 9fecbf21..79e53c75 100644 --- a/app/models/site/layout_ordering.rb +++ b/app/models/site/layout_ordering.rb @@ -13,11 +13,15 @@ class Site # Por defecto, si el sitio no lo soporta, se obtienen los layouts # ordenados alfabéticamente por traducción. # + # @param [Usuarie,nil] # @return [Hash] - def schema_organization + def schema_organization(usuarie = nil) @schema_organization ||= begin - schema_organization = data.dig('schema', 'organization') + # XXX: retrocompatibilidad + key = (usuarie.blank? || usuarie?(usuarie)) ? 'organization' : 'organization_guest' + schema_organization = data.dig('schema', key) + schema_organization ||= data.dig('schema', 'organization') schema_organization&.symbolize_keys! schema_organization&.transform_values! do |ary| ary.map(&:to_sym) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 5d180518..0ff30799 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -16,7 +16,7 @@ %h3= t('posts.new') %table.table.table-sm.mb-3 %tbody - - @site.schema_organization.each do |schema, _| + - @site.schema_organization(current_usuarie).each do |schema, _| - schema = @site.layouts[schema] - next if schema.hidden? = render 'schemas/row', site: @site, schema: schema, filter: @filter_params