#2102: Custom Fields stehen nun als GroupBy und Filter zur Verfügung, nachdem sie gespeichert wurden

pull/6827/head
Tim Felgentreff 14 years ago
parent 84a076bb2a
commit e3b0b2ae68
  1. 4
      app/models/cost_query/custom_field_mixin.rb
  2. 5
      init.rb
  3. 26
      lib/reporting_issue_custom_field_patch.rb

@ -20,6 +20,10 @@ module CostQuery::CustomFieldMixin
@all ||= generate_subclasses
end
def reset!
@all = nil
end
def generate_subclasses
IssueCustomField.all.map do |field|
class_name = class_name_for field.name

@ -3,6 +3,11 @@ require 'redmine'
# Hooks
require 'view_projects_show_sidebar_bottom_hook'
Dispatcher.to_prepare do
# Model Patches
require_dependency 'reporting_issue_custom_field_patch'
end
Redmine::Plugin.register :redmine_reporting do
name 'Reporting Plugin'
author 'Konstantin Haase, Philipp Tessenow @ finnlabs'

@ -0,0 +1,26 @@
module ReportingIssueCustomFieldPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
# Same as typing in the class
base.class_eval do
unloadable
after_save :generate_custom_field_filters
after_save :generate_custom_field_group_bys
end
end
module InstanceMethods
def generate_custom_field_filters
CostQuery::Filter.reset!
CostQuery::Filter::CustomFieldEntries.reset!
end
def generate_custom_field_group_bys
CostQuery::GroupBy.reset!
CostQuery::GroupBy::CustomFieldEntries.reset!
end
end
end
IssueCustomField.send(:include, ReportingIssueCustomFieldPatch)
Loading…
Cancel
Save