Module: SirTrevorRails::Blocks::Textable

Included in:
OembedBlock, SolrDocumentsBlock, UploadedItemsBlock
Defined in:
app/models/sir_trevor_rails/blocks/textable.rb

Overview

Mixin for blocks that display text

Instance Method Summary collapse

Instance Method Details

#content_alignObject



16
17
18
19
20
# File 'app/models/sir_trevor_rails/blocks/textable.rb', line 16

def content_align
  return unless text?

  text_align == 'left' ? 'right' : 'left'
end

#textObject



22
23
24
25
26
27
# File 'app/models/sir_trevor_rails/blocks/textable.rb', line 22

def text
  val = super

  # empty, in sir-trevor speak
  val unless val == '<p><br></p>'
end

#text?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/models/sir_trevor_rails/blocks/textable.rb', line 8

def text?
  text.present?
end

#text_alignObject



12
13
14
# File 'app/models/sir_trevor_rails/blocks/textable.rb', line 12

def text_align
  send(:'text-align')
end