Sha256: 7abdd376f0b2afec8471464a16cb68812ce74b66a50f30cae43881a512f0db08
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
class <%= model_name %>Query < EasyQuery self.queried_class = <%= model_name %> def initialize_available_filters <%- db_columns.each do |column_name, column_options| -%> <%- if project? && column_name == 'project_id' -%> if project.nil? add_available_filter '<%= column_name %>', name: <%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] %>, values: all_projects_values end <%- else -%> add_available_filter '<%= column_name %>', name: <%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] -%> <%- end -%> <%- end -%> <%- if acts_as_customizable? -%> add_custom_fields_filters(<%= model_name %>CustomField) <%- end -%> end def available_columns return @available_columns if @available_columns <%- db_columns.each do |column_name, column_options| -%> add_available_column '<%= column_options[:query_column_name] || column_name %>', title: <%= model_name %>.human_attribute_name(:<%= column_name %>) <%- end -%> <%- if acts_as_customizable? -%> @available_columns += <%= model_name %>CustomField.visible.collect {|cf| QueryCustomFieldColumn.new(cf) } <%- end -%> @available_columns end def default_list_columns super.presence || <%= db_columns.collect{|column_name, column_options| (column_options[:query_column_name] || column_name).to_sym}[0..3].to_s %>.flat_map{|c| [c.to_s, c.to_sym]} end end
Version data entries
3 entries across 3 versions & 1 rubygems