Class: AcmsRuby::Column

Inherits:
ARBase
  • Object
show all
Includes:
FieldSelectMethods
Defined in:
lib/acms_ruby/models/column.rb

Constant Summary collapse

ACMS_UNIT_TEXT_DELIMITER =
':acms_unit_text_delimiter:'

Instance Method Summary collapse

Methods included from FieldSelectMethods

#field, #field_group_names, #field_groups, #field_names, #image_field_names, #image_fields, #val

Methods inherited from ARBase

create_methods, next_id, #next_id

Instance Method Details

#htmlObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/acms_ruby/models/column.rb', line 27

def html
  case type
  when 'text'
    "<#{field_2}>#{text}</#{field_2}>"
  when 'image'
    "<img src=\"#{field_2}\" />"
  else
    nil
  end
end

#text(sel = nil) ⇒ Object



16
17
18
19
20
# File 'lib/acms_ruby/models/column.rb', line 16

def text(sel=nil)
  return nil if type != 'text'
  sel ||= 0
  texts[sel]
end

#textsObject



22
23
24
25
# File 'lib/acms_ruby/models/column.rb', line 22

def texts
  return nil if type != 'text'
  field_1.split(ACMS_UNIT_TEXT_DELIMITER)
end