Class: QueryColumn

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

Overview

– copyright ChiliProject is a project management system.

Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

See doc/COPYRIGHT.rdoc for more details. ++

Direct Known Subclasses

QueryCustomFieldColumn

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from Redmine::I18n

#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages

Constructor Details

- (QueryColumn) initialize(name, options = {})



19
20
21
22
23
24
25
26
27
28
# File 'app/models/query_column.rb', line 19

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.default_order = options[:default_order]
  @caption_key = options[:caption] || "field_#{name}"
end

Instance Attribute Details

- (Object) default_order

Returns the value of attribute default_order



16
17
18
# File 'app/models/query_column.rb', line 16

def default_order
  @default_order
end

- (Object) groupable

Returns the value of attribute groupable



16
17
18
# File 'app/models/query_column.rb', line 16

def groupable
  @groupable
end

- (Object) name

Returns the value of attribute name



16
17
18
# File 'app/models/query_column.rb', line 16

def name
  @name
end

- (Object) sortable

Returns the value of attribute sortable



16
17
18
# File 'app/models/query_column.rb', line 16

def sortable
  @sortable
end

Instance Method Details

- (Object) caption



30
31
32
# File 'app/models/query_column.rb', line 30

def caption
  l(@caption_key)
end

- (Boolean) sortable?

Returns true if the column is sortable, otherwise false



35
36
37
# File 'app/models/query_column.rb', line 35

def sortable?
  !sortable.nil?
end

- (Object) value(issue)



39
40
41
# File 'app/models/query_column.rb', line 39

def value(issue)
  issue.send name
end