mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 17:16:22 +00:00
Merge branch 'rails' of 0xacab.org:sutty/sutty into rails
This commit is contained in:
commit
6ca3adc265
7 changed files with 44 additions and 33 deletions
1
Gemfile
1
Gemfile
|
@ -79,6 +79,7 @@ gem 'webpacker'
|
||||||
gem 'yaml_db', git: 'https://0xacab.org/sutty/yaml_db.git'
|
gem 'yaml_db', git: 'https://0xacab.org/sutty/yaml_db.git'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'device_detector'
|
gem 'device_detector'
|
||||||
|
gem 'htmlbeautifier'
|
||||||
gem 'dry-schema'
|
gem 'dry-schema'
|
||||||
gem 'rubanok'
|
gem 'rubanok'
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,7 @@ GEM
|
||||||
hiredis (0.6.3-x86_64-linux-musl)
|
hiredis (0.6.3-x86_64-linux-musl)
|
||||||
hiredis-client (0.14.1-x86_64-linux-musl)
|
hiredis-client (0.14.1-x86_64-linux-musl)
|
||||||
redis-client (= 0.14.1)
|
redis-client (= 0.14.1)
|
||||||
|
htmlbeautifier (1.4.2)
|
||||||
http_parser.rb (0.8.0-x86_64-linux-musl)
|
http_parser.rb (0.8.0-x86_64-linux-musl)
|
||||||
httparty (0.21.0)
|
httparty (0.21.0)
|
||||||
mini_mime (>= 1.0.0)
|
mini_mime (>= 1.0.0)
|
||||||
|
@ -659,6 +660,7 @@ DEPENDENCIES
|
||||||
hamlit-rails
|
hamlit-rails
|
||||||
hiredis
|
hiredis
|
||||||
hiredis-client
|
hiredis-client
|
||||||
|
htmlbeautifier
|
||||||
httparty
|
httparty
|
||||||
icalendar
|
icalendar
|
||||||
image_processing
|
image_processing
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'htmlbeautifier'
|
||||||
|
|
||||||
# Se encarga del contenido del artículo y quizás otros campos que
|
# Se encarga del contenido del artículo y quizás otros campos que
|
||||||
# requieran texto largo.
|
# requieran texto largo.
|
||||||
class MetadataContent < MetadataTemplate
|
class MetadataContent < MetadataTemplate
|
||||||
|
@ -86,7 +88,7 @@ class MetadataContent < MetadataTemplate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
html.to_s.html_safe
|
HtmlBeautifier.beautify(html.to_s).html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
# Limpia estilos en base a una lista de permitidos
|
# Limpia estilos en base a una lista de permitidos
|
||||||
|
|
|
@ -289,6 +289,8 @@ class Site < ApplicationRecord
|
||||||
#
|
#
|
||||||
# @return [Hash] { post: Layout }
|
# @return [Hash] { post: Layout }
|
||||||
def layouts
|
def layouts
|
||||||
|
return {} if data['layouts'].blank?
|
||||||
|
|
||||||
# Crea un Struct dinámico cuyas llaves son los nombres de todos los
|
# Crea un Struct dinámico cuyas llaves son los nombres de todos los
|
||||||
# layouts. Si pasamos un layout que no existe, obtenemos un
|
# layouts. Si pasamos un layout que no existe, obtenemos un
|
||||||
# NoMethodError
|
# NoMethodError
|
||||||
|
|
|
@ -36,8 +36,7 @@ class SiteUsuariePolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept_invitation?
|
def accept_invitation?
|
||||||
su = site_usuarie
|
!!site_usuarie.usuarie.rol_for_site(site_usuarie.site)&.temporal
|
||||||
(usuarie? || invitade?) && su.usuarie.rol_for_site(su.site).temporal
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject_invitation?
|
def reject_invitation?
|
||||||
|
|
|
@ -10,4 +10,6 @@
|
||||||
-# XXX: Solo un nivel de recursividad
|
-# XXX: Solo un nivel de recursividad
|
||||||
- unless local_assigns[:parent_schema]
|
- unless local_assigns[:parent_schema]
|
||||||
- schema.schemas.each do |s|
|
- schema.schemas.each do |s|
|
||||||
|
- next if s.hidden?
|
||||||
= render 'schemas/row', schema: s, site: site, filter: filter, parent_schema: schema
|
= render 'schemas/row', schema: s, site: site, filter: filter, parent_schema: schema
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
%p.lead= t('.help')
|
%p.lead= t('.help')
|
||||||
- if policy(Site).new?
|
- if policy(Site).new?
|
||||||
= link_to t('sites.new.title'), new_site_path,
|
= link_to t('sites.new.title'), new_site_path,
|
||||||
class: 'btn btn-secondary'
|
class: 'btn btn-secondary'
|
||||||
|
|
||||||
%section.col
|
%section.col
|
||||||
- if @sites.empty?
|
- if @sites.empty?
|
||||||
|
@ -15,39 +15,42 @@
|
||||||
%tbody
|
%tbody
|
||||||
- @sites.each do |site|
|
- @sites.each do |site|
|
||||||
- next unless site.jekyll?
|
- next unless site.jekyll?
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%h2
|
%h2
|
||||||
- if policy(site).show?
|
- if policy(site).show?
|
||||||
= link_to site.title, site_posts_path(site, locale: site.default_locale)
|
= link_to site.title,
|
||||||
|
site_posts_path(site,
|
||||||
|
locale: site.default_locale)
|
||||||
- else
|
- else
|
||||||
= site.title
|
= site.title
|
||||||
%p.lead= site.description
|
%p.lead= site.description
|
||||||
%br
|
.d-flex.flex-row
|
||||||
= link_to t('.visit'), site.url, class: 'btn btn-secondary'
|
= link_to t('.visit'), site.url, class: 'btn btn-secondary'
|
||||||
- if current_usuarie.rol_for_site(site).temporal?
|
- if current_usuarie.rol_for_site(site).temporal?
|
||||||
= render 'components/btn_base',
|
= render 'components/btn_base',
|
||||||
text: t('sites.invitations.accept'),
|
text: t('sites.invitations.accept'),
|
||||||
path: site_usuaries_accept_invitation_path(site),
|
path: site_usuaries_accept_invitation_path(site),
|
||||||
title: t('help.sites.invitations.accept'),
|
title: t('help.sites.invitations.accept'),
|
||||||
class: 'btn-secondary'
|
class: 'btn-secondary'
|
||||||
= render 'components/btn_base',
|
= render 'components/btn_base',
|
||||||
text: t('sites.invitations.reject'),
|
text: t('sites.invitations.reject'),
|
||||||
path: site_usuaries_reject_invitation_path(site),
|
path: site_usuaries_reject_invitation_path(site),
|
||||||
title: t('help.sites.invitations.reject'),
|
title: t('help.sites.invitations.reject'),
|
||||||
class: 'btn-secondary'
|
class: 'btn-secondary'
|
||||||
- else
|
- else
|
||||||
- if policy(site).show?
|
- if policy(site).show?
|
||||||
= render 'layouts/btn_with_tooltip',
|
= render 'layouts/btn_with_tooltip',
|
||||||
tooltip: t('help.sites.edit_posts'),
|
tooltip: t('help.sites.edit_posts'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
link: site_path(site),
|
link: site_path(site),
|
||||||
text: t('sites.posts')
|
text: t('sites.posts')
|
||||||
= render 'sites/build', site: site
|
= render 'sites/build', site: site
|
||||||
= render 'sites/moderation_queue', site: site
|
= render 'sites/moderation_queue', site: site
|
||||||
- if policy(SiteUsuarie.new(site, current_usuarie)).index?
|
- if policy(SiteUsuarie.new(site, current_usuarie)).index?
|
||||||
= render 'layouts/btn_with_tooltip',
|
= render 'layouts/btn_with_tooltip',
|
||||||
tooltip: t('usuaries.index.help.self'),
|
tooltip: t('usuaries.index.help.self'),
|
||||||
text: t('usuaries.index.title'),
|
text: t('usuaries.index.title'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
link: site_usuaries_path(site)
|
link: site_usuaries_path(site)
|
||||||
|
|
Loading…
Reference in a new issue