Class: Interview::HtmlTextAttribute

Inherits:
Attribute show all
Defined in:
lib/interview/html_text_attribute.rb

Instance Attribute Summary collapse

Attributes inherited from Attribute

#align, #caption, #hide_caption, #hide_tooltip, #html_class, #link, #method, #nil_value, #on_changed, #only_for, #style, #surrounding_tag

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods inherited from Attribute

#initialize, #render, #tooltip, #value

Methods inherited from Control

#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #initialize, #render, #set_attributes, #set_defaults

Constructor Details

This class inherits a constructor from Interview::Attribute

Instance Attribute Details

#cutObject

Returns the value of attribute cut.



4
5
6
# File 'lib/interview/html_text_attribute.rb', line 4

def cut
  @cut
end

#plain_textObject

Returns the value of attribute plain_text.



4
5
6
# File 'lib/interview/html_text_attribute.rb', line 4

def plain_text
  @plain_text
end

Instance Method Details

#render_readObject



6
7
8
9
10
11
12
# File 'lib/interview/html_text_attribute.rb', line 6

def render_read
  return '' if value.nil?
  val = value
  val.gsub! /<.+?>/, ' ' if @plain_text
  val = val[0..29] + '...' if @cut and val.size > 30
  return val.html_safe
end

#render_writeObject



14
15
16
# File 'lib/interview/html_text_attribute.rb', line 14

def render_write
  form_builder.cktext_area @method, class: 'form-control'
end