Class: QueryColumn

Inherits:
Object
  • Object
show all
Includes:
Redmine::I18n
Defined in:
app/models/query.rb

Overview

Since:

  • 0.6.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Redmine::I18n

#current_language, #day_letter, #day_name, #find_language, #format_date, #format_hours, #format_time, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #set_language_if_valid, #valid_languages

Constructor Details

#initialize(name, options = {}) ⇒ QueryColumn

Returns a new instance of QueryColumn



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/query.rb', line 24

def initialize(name, options={})
  self.name = name
  self.sortable = options[:sortable]
  self.groupable = options[:groupable] || false
  if groupable == true
    self.groupable = name.to_s
  end
  self.totalable = options[:totalable] || false
  self.default_order = options[:default_order]
  @inline = options.key?(:inline) ? options[:inline] : true
  @caption_key = options[:caption] || "field_#{name}".to_sym
  @frozen = options[:frozen]
end

Instance Attribute Details

#default_orderObject

Returns the value of attribute default_order

Since:

  • 0.7.0



21
22
23
# File 'app/models/query.rb', line 21

def default_order
  @default_order
end

#groupableObject

Returns the value of attribute groupable

Since:

  • 0.9.0



21
22
23
# File 'app/models/query.rb', line 21

def groupable
  @groupable
end

#nameObject

Returns the value of attribute name



21
22
23
# File 'app/models/query.rb', line 21

def name
  @name
end

#sortableObject

Returns the value of attribute sortable



21
22
23
# File 'app/models/query.rb', line 21

def sortable
  @sortable
end

#totalableObject

Returns the value of attribute totalable

Since:

  • 3.2.0



21
22
23
# File 'app/models/query.rb', line 21

def totalable
  @totalable
end

Instance Method Details

#captionObject

Since:

  • 0.6.1



38
39
40
41
42
43
44
45
46
47
# File 'app/models/query.rb', line 38

def caption
  case @caption_key
  when Symbol
    l(@caption_key)
  when Proc
    @caption_key.call
  else
    @caption_key
  end
end

#css_classesObject

Since:

  • 1.2.0



74
75
76
# File 'app/models/query.rb', line 74

def css_classes
  name
end

#frozen?Boolean

Returns:

  • (Boolean)

Since:

  • 2.3.0



62
63
64
# File 'app/models/query.rb', line 62

def frozen?
  @frozen
end

#inline?Boolean

Returns:

  • (Boolean)

Since:

  • 2.2.0



58
59
60
# File 'app/models/query.rb', line 58

def inline?
  @inline
end

#sortable?Boolean

Returns true if the column is sortable, otherwise false

Returns:

  • (Boolean)

Since:

  • 0.9.0



50
51
52
# File 'app/models/query.rb', line 50

def sortable?
  !@sortable.nil?
end

#value(object) ⇒ Object

Since:

  • 0.9.0



66
67
68
# File 'app/models/query.rb', line 66

def value(object)
  object.send name
end

#value_object(object) ⇒ Object

Since:

  • 2.6.0



70
71
72
# File 'app/models/query.rb', line 70

def value_object(object)
  object.send name
end