Module: SurveyorGui::Models::ColumnMethods

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::ForbiddenAttributesProtection, ActiveModel::Validations, Surveyor::MustacheContext
Included in:
Column
Defined in:
lib/surveyor_gui/models/column_methods.rb

Instance Method Summary collapse

Instance Method Details

#help_textObject



36
37
38
# File 'lib/surveyor_gui/models/column_methods.rb', line 36

def help_text
  #stub
end

#help_text_for(context = nil, locale = nil) ⇒ Object



18
19
20
# File 'lib/surveyor_gui/models/column_methods.rb', line 18

def help_text_for(context = nil, locale = nil)
  in_context(translation(locale)[:help_text], context)
end

#reference_identifierObject

stub



39
40
# File 'lib/surveyor_gui/models/column_methods.rb', line 39

def reference_identifier
end

#split(text, position = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/surveyor_gui/models/column_methods.rb', line 21

def split(text, position=nil)
  case position
  when :pre
    text.split("|",2)[0]
  when :post
    text.split("|",2)[1]
  else
    text
  end.to_s
end

#text_for(position = nil, context = nil, locale = nil) ⇒ Object



15
16
17
# File 'lib/surveyor_gui/models/column_methods.rb', line 15

def text_for(position = nil, context = nil, locale = nil)
split(in_context(translation(locale)[:text], context), position)
end

#translation(locale) ⇒ Object



31
32
33
34
35
# File 'lib/surveyor_gui/models/column_methods.rb', line 31

def translation(locale)
  {:text => self.text, :help_text => self.help_text}.with_indifferent_access.merge(
    (self.question_group.questions.first.survey_section.translation(locale)[:columns] || {})[self.reference_identifier] || {}
  )
end