Class: Blocky::ContentBlock
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Blocky::ContentBlock
- Defined in:
- app/models/blocky/content_block.rb
Instance Method Summary collapse
Instance Method Details
#global? ⇒ Boolean
8 9 10 |
# File 'app/models/blocky/content_block.rb', line 8 def global? self.page_path.nil? end |
#tidy_content ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/blocky/content_block.rb', line 12 def tidy_content tidy = Tidy.new({ char_encoding: "raw", doctype: "omit", indent: "auto", indent_spaces: 2, markup: true, output_xhtml: true, show_body_only: "yes", tab_size: 2, tidy_mark: false }) html = tidy.clean(self.content.to_s.strip).force_encoding("utf-8") self.content = "\n" + (html.blank? ? "<p><br/></p>" : html) + "\n" end |