Class: RailsAdminContentBuilder::ContentBuilder

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Includes:
SearchCop
Defined in:
app/models/rails_admin_content_builder/content_builder.rb

Instance Method Summary collapse

Instance Method Details

#attributes_hashObject



37
38
39
40
41
# File 'app/models/rails_admin_content_builder/content_builder.rb', line 37

def attributes_hash
  %w(
    src class alt href allowfullscreen frameborder height width
  )
end

#content_sanitizedObject



21
22
23
24
25
26
27
28
# File 'app/models/rails_admin_content_builder/content_builder.rb', line 21

def content_sanitized
  white_list_sanitizer = Rails::Html::WhiteListSanitizer.new
  white_list_sanitizer.sanitize(
    content,
    tags: tags_hash,
    attributes: attributes_hash
  ).try(:html_safe)
end

#tags_hashObject



30
31
32
33
34
35
# File 'app/models/rails_admin_content_builder/content_builder.rb', line 30

def tags_hash
  %w(
    div b i a u p img figure figcaption a iframe footer aside
    section blockquote ul ol li h1 h2 h3 h4 h5 h6
  )
end