mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-25 23:56:22 +00:00
feat: poder establecer una lista de esquemas para invitades #17343
This commit is contained in:
parent
cbe2f66a94
commit
78f757d429
2 changed files with 7 additions and 3 deletions
|
@ -13,11 +13,15 @@ class Site
|
||||||
# Por defecto, si el sitio no lo soporta, se obtienen los layouts
|
# Por defecto, si el sitio no lo soporta, se obtienen los layouts
|
||||||
# ordenados alfabéticamente por traducción.
|
# ordenados alfabéticamente por traducción.
|
||||||
#
|
#
|
||||||
|
# @param [Usuarie,nil]
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
def schema_organization
|
def schema_organization(usuarie = nil)
|
||||||
@schema_organization ||=
|
@schema_organization ||=
|
||||||
begin
|
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&.symbolize_keys!
|
||||||
schema_organization&.transform_values! do |ary|
|
schema_organization&.transform_values! do |ary|
|
||||||
ary.map(&:to_sym)
|
ary.map(&:to_sym)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
%h3= t('posts.new')
|
%h3= t('posts.new')
|
||||||
%table.table.table-sm.mb-3
|
%table.table.table-sm.mb-3
|
||||||
%tbody
|
%tbody
|
||||||
- @site.schema_organization.each do |schema, _|
|
- @site.schema_organization(current_usuarie).each do |schema, _|
|
||||||
- schema = @site.layouts[schema]
|
- schema = @site.layouts[schema]
|
||||||
- next if schema.hidden?
|
- next if schema.hidden?
|
||||||
= render 'schemas/row', site: @site, schema: schema, filter: @filter_params
|
= render 'schemas/row', site: @site, schema: schema, filter: @filter_params
|
||||||
|
|
Loading…
Reference in a new issue