--- init.rb.KEEP 2014-05-28 17:32:19.000000000 +1000 +++ init.rb 2014-05-28 17:32:19.000000000 +1000 @@ -35,6 +35,22 @@ :caption => :label_issue_watchers, :value => lambda { |issue| issue.watchers.size })) +# +#TODO: This should be extracted to an extension of this extension (or pushed up to the extension if the community wants it) +#Take each Project custom field and make it available as a column in issue queries. +0.upto( ProjectCustomField.all.size - 1 ) do |loop_index| + issue_query.add_available_column(ExtendedQueryColumn.new( + #Create a unique symbol for this entry + ("project_cf_"+loop_index.to_s).to_sym, + #Get the custom field name from the first (any) project. + #NB: This assumes that CF will be the same on the first project as the issue project..... + :caption => "Project's " + Project.first.custom_field_values[loop_index].custom_field.name, + #Get the CF value - via a temp function - that is assigned to the project for this issue + :value => lambda { |issue| Project.find_by_id(issue.project_id).custom_field_values[loop_index].value } ) + ) +end +# + Rails.configuration.to_prepare do unless String.method_defined?(:html_safe) @@ -131,10 +147,10 @@ end Redmine::Plugin.register :extended_fields do - name 'Extended fields' - author 'Andriy Lesyuk' + name 'Extended fields (BK Edition)' + author 'Andriy Lesyuk (+Brody Kenrick)' author_url 'http://www.andriylesyuk.com' - description 'Adds new custom field types, improves listings etc.' + description 'Adds new custom field types, improves listings etc. (BK Added/hacked support for provisioning project settings in issues lists/queries)' url 'http://projects.andriylesyuk.com/projects/extended-fields' - version '0.2.3' + version '0.2.3-BK' end