Sha256: d008252930d2b131a3304b0b5a4d7234c58f74d001f9b7a277ddc77419008d91
Contents?: true
Size: 890 Bytes
Versions: 4
Compression:
Stored size: 890 Bytes
Contents
module AbAdmin module Models module Header extend ActiveSupport::Concern included do include ActionView::Helpers::SanitizeHelper belongs_to :headerable, polymorphic: true before_save :normalize_html end def empty? [keywords, description, title].map(&:blank?).all? end def has_info? !empty? end def read(key) value = read_attribute(key) value.blank? ? nil : value end def normalize_html ::I18n.available_locales.each do |loc| %w(title h1 keywords description).each do |attr| send("#{attr}_#{loc}=", send("#{attr}_#{loc}").to_s.no_html) end end ::I18n.available_locales.each do |loc| send("seo_block_#{loc}=", sanitize(send("seo_block_#{loc}").to_s)) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ab_admin-0.6.1 | lib/ab_admin/models/header.rb |
ab_admin-0.6.0 | lib/ab_admin/models/header.rb |
ab_admin-0.5.0 | lib/ab_admin/models/header.rb |
ab_admin-0.4.0 | lib/ab_admin/models/header.rb |