Feature #26642 » query_humanize_attribute.patch
app/models/query.rb | ||
---|---|---|
202 | 202 |
def initialize(field, options) |
203 | 203 |
@field = field.to_s |
204 | 204 |
@options = options |
205 |
@options[:name] ||= l(options[:label] || "field_#{field}".gsub(/_id$/, '')) |
|
206 | 205 |
# Consider filters with a Proc for values as remote by default |
207 | 206 |
@remote = options.key?(:remote) ? options[:remote] : options[:values].is_a?(Proc) |
208 | 207 |
end |
... | ... | |
674 | 673 |
# Adds an available filter |
675 | 674 |
def add_available_filter(field, options) |
676 | 675 |
@available_filters ||= ActiveSupport::OrderedHash.new |
676 | ||
677 |
field_name = field.gsub(/_id$/, '') |
|
678 |
options[:name] ||= l(options[:label], default: queried_class.human_attribute_name(field_name)) |
|
679 |
|
|
677 | 680 |
@available_filters[field] = QueryFilter.new(field, options) |
678 | 681 |
@available_filters |
679 | 682 |
end |
- « Previous
- 1
- 2
- Next »