Project

General

Profile

Default columns plugin

Added by Vitaly Klimov over 14 years ago

Up to date plugin page

http://www.redmine.org/plugins/redmine_default_columns

Intro

I would like to share plugin which i wrote to implement Feature request #3967. Plugin was tested on Redmine 0.9.0 (r3285) Please read below to get the idea of how it works:

Features

  • Allows to define default query on project by project basis
  • Allows to define default query based on project custom field value
  • Uses existing query system thus providing compatibility with future Redmine versions

Details

This plugin is very useful if you are using Redmine projects for more than one purpose. For example, we have projects for bug-tracking as well as for project management and invoice tracking. I was really missing the ability to define default query for project or group of projects - and without it it was very inconvenient to create set of public queries which you had manually apply each time you switch projects.

Logic behind the plugin

First of all - plugin uses existing queries system thus (hopefully) maintaining maximal compatibility with further Redmine versions. It uses existing queries and small patch to the Issues Controller to apply default query if no query is defined.

Plugin retrieves queries from dedicated project (defined in settings) and applies them to the current project.

I would advise to create dedicated project which will hold all the necessary types of queries. This project has to include all trackers and all custom fields to make all the types of queries possible.

How it works

There are several nested levels by which default query is determined

  • If the project has query with the name defined in plugin settings (field Default query name) plugin uses this query as a default query
  • If no such query exists in project, value of project custom field (defined in drop down Custom field to define type on the plugin settings screen) appended to the string Default_ to create query name
  • If no such custom field exists, value Default_Project used for query name
  • After that query with such name is retrieved from project defined in the drop down named Project with default queries (on the plugin settings screen)
  • If there are no such query exist then plugin does nothing

Example of usage

For example, we have projects of three several types - one for bug-tracking, another one for PM and another one for invoices. Also we have one special project named SpecialCase for whom we want to have its own default query.

Step by step tutorial

  1. Create special project which will hold all our default queries (lets call it DefaultQueries) We should include all possible trackers and issues' custom fields to this project to be able to create queries for all our projects
  2. Create project custom field which will hold project type (lets make it drop-down named Type with values Bugs, Invoices and Tasks). To make things easier we'll make it required for all projects with the default value of Tasks
  3. Set this custom field for each project according to the project type
  4. Go to plugin settings and select project we created (DefaultQueries) and custom field name (Type). We will leave value for the Default query name as it was - Default
  5. Go to the project DefaultQueries and create there three queries named Default_Bugs, Default_Tasks and Default_Invoices For each query we can use its own set of columns/sort order/grouping
  6. Go to the project SpecialCase and create query named Default

We all set for now.

What would happen if we will decide to view issues in the project with custom field Type set to Bugs? Plugin will lookup query named Default_Bugs in project DefaultQueries and apply it to the issues view! Same will be done for projects with type Tasks and Invoices - queries named Default_Tasks and Default_Invoices will be applied to their views. If we will choose project named SpecialCase the query named Default will be applied because it exists there regardless of the project type.

Installation and Setup

  1. Follow the Redmine plugin installation steps at: http://www.redmine.org/wiki/redmine/Plugins Make sure the plugin is installed to vendor/plugins/redmine_default_columns
  2. Restart your Redmine web servers (e.g. mongrel, thin, mod_rails)
  3. Login and configure the plugin (Administration > Plugins > Configure)

Replies (84)

RE: Default columns plugin - Added by Daniel Schaarschmidt over 13 years ago

Ok, I found a working solution:
If you just want to have it working and don't really need the Query-Filter-Section collapsed in the Issues-View, just delete the contents of <plugindir>\app\views\issues\

If you want that section collapsed, replace the 3 files in the above mentioned folder with the original ones from your Redmine-Install (<redmineroot>\app\views\issues\). Now have a look at the plugins index.rhtml and notice the 2 sections marked with "<%# VVK changes". Just copy these to the corresponding position inside the just copied index.rhtml and you should be fine.

RE: Default columns plugin - Added by Thomas Martin over 13 years ago

Hi there, this plugin is much needed for me but unfortunatly I can't make it work on Redmine 1.2.0.
The workaround from Daniel does not work either as I end up with this error :

ActionView::TemplateError (undefined method `show_desc' for #<Query:0x5d746e8>) on line #1 of vendor/plugins/redmine_default_columns_plus/app/views/queries/_custom_params.rhtml:
1: <%= check_box :query, :show_desc, {}, '1', '0' ><= l(:label_show_description_plural) %>

Is there anyone that managed to make this plugin work on redmine 1.2.0 ? Any info would be much appreciated.

RE: Default columns plugin - Added by Daniel Schaarschmidt over 13 years ago

I'm currently using my modified plugin with Redmine 1.2.0 (Windows Server 2003 with Bitnami Redmine Stack) and it's working fine.

redmine_default_columns_plus_ds.zip (21.2 KB) redmine_default_columns_plus_ds.zip Plugin with modifications for 1.2.0

RE: Default columns plugin - Added by Luis Serrano Aranda over 13 years ago

All the functions (included permissions and descriptions) for Redmine 1.2.x

RE: Default columns plugin - Added by Thomas Martin over 13 years ago

Thanks for your replies.
I've tested both of your files and I'm still getting the same error as I quoted in my previous post.
I thought it might come from another plugin I'm using so I removed all the other plugin and tested again and still the same error. So I'm a bit clueless about what's happening here but I'll keep searching. If anyone knows what I'm doing wrong please let me know.

RE: Default columns plugin - Added by Luis Serrano Aranda over 13 years ago

Are you sure ?

I have tested this plugin in redmine 1.2

What's plugins do you have ?

RE: Default columns plugin - Added by Thomas Martin over 13 years ago

Right now I have no plugins installed.
I did install this patch though : http://www.redmine.org/attachments/6054/0001-Make-CSV-export-work-like-PDF.patch

I'm using bitnami redmine stack with redmine 1.2.0 on windows XP

RE: Default columns plugin - Added by Vitaly Klimov over 13 years ago

I have released version 0.0.6 which is compatible with Redmine 1.2.x

Please download it from plugin page:

http://www.redmine.org/plugins/redmine_default_columns

RE: Default columns plugin - Added by Steven Wong over 13 years ago

Hi,Vitaly Klimov,

I found that the plugin is conflict with the plugin Redmine_show_description.Please check it. thanks.

the Redmine_show_description URL is:
http://www.redmine.org/plugins/redmine_show_descriptions

Vitaly Klimov wrote:

I have released version 0.0.6 which is compatible with Redmine 1.2.x

Please download it from plugin page:

http://www.redmine.org/plugins/redmine_default_columns

RE: Default columns plugin - Added by Vitaly Klimov over 13 years ago

Please be aware that show_description is not compatible with 1.2.1 - it uses old issues/index.rhtml file

If you want to use both plugins, simply remove files from redmine_default_columns/app/views/issues and restart server

RE: Default columns plugin - Added by Tony Marschall about 13 years ago

Hello,

i got an error on db:migrate_plugins. Some other plugins working fine.

Can somebody help?

Redmine 1.2.1.stable (MySQL)

# RAILS_ENV=production rake db:migrate_plugins --trace
(in /var/www/dev.domain.tld/)
** Invoke db:migrate_plugins (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant Rails::Plugin::Dispatcher
/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:131:in `const_missing'
/var/www/dev.domain.tld/vendor/plugins/redmine_default_columns/init.rb:27:in `evaluate_init_rb'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/rails/plugin.rb:158:in `evaluate_init_rb'
/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/rails/plugin.rb:154:in `evaluate_init_rb'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/rails/plugin.rb:48:in `load'
/var/www/dev.domain.tld/config/../vendor/plugins/engines/lib/engines/plugin.rb:44:in `load'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/rails/plugin/loader.rb:38:in `load_plugins'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/rails/plugin/loader.rb:37:in `each'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/rails/plugin/loader.rb:37:in `load_plugins'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:369:in `load_plugins'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:165:in `process'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
/var/www/dev.domain.tld/config/environment.rb:20
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/var/lib/gems/1.8/gems/rails-2.3.11/lib/tasks/misc.rake:4
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/bin/rake:31

RE: Default columns plugin - Added by Steven Wong about 13 years ago

Hi,Vitaly Klimov

Thanks a lot. I'll try again.

Vitaly Klimov wrote:

Please be aware that show_description is not compatible with 1.2.1 - it uses old issues/index.rhtml file

If you want to use both plugins, simply remove files from redmine_default_columns/app/views/issues and restart server

RE: Default columns plugin - Added by Tony Marschall about 13 years ago

Luis Serrano Aranda wrote:

All the functions (included permissions and descriptions) for Redmine 1.2.x

Thanks, this version works for me :)

RE: Default columns plugin - Added by Tony Marschall about 13 years ago

Luis Serrano Aranda wrote:

All the functions (included permissions and descriptions) for Redmine 1.2.x

Filters and options are not displayed on issues page, but can be passed by GET parameters

exp.

https://dev.example.tld/devx/projects/name/issues?set_filter=1&f[]=status_id&op[status_id]=ox%x%...

RE: Default columns plugin - Added by Sven Müller about 13 years ago

How can I fix this? Removing all other plugins doesn't make a different.
@ Toni Marschall : can you help?

redmine@dev-server:~/redmine$ rake db:migrate_plugins RAILS_ENV=production --trace
(in /home/redmine/redmine)
rake aborted!
uninitialized constant Rails::Plugin::Dispatcher
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:131:in `const_missing'
/home/redmine/redmine/vendor/plugins/redmine_default_columns/init.rb:27:in `evaluate_init_rb'
/home/redmine/redmine/config/../vendor/rails/railties/lib/rails/plugin.rb:158:in `evaluate_init_rb'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/home/redmine/redmine/config/../vendor/rails/railties/lib/rails/plugin.rb:154:in `evaluate_init_rb'
/home/redmine/redmine/config/../vendor/rails/railties/lib/rails/plugin.rb:48:in `load'
/home/redmine/redmine/config/../vendor/plugins/engines/lib/engines/plugin.rb:44:in `load'
/home/redmine/redmine/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:38:in `load_plugins'
/home/redmine/redmine/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `each'
/home/redmine/redmine/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `load_plugins'
/home/redmine/redmine/config/../vendor/rails/railties/lib/initializer.rb:369:in `load_plugins'
/home/redmine/redmine/config/../vendor/rails/railties/lib/initializer.rb:165:in `process'
/home/redmine/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/home/redmine/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/home/redmine/redmine/config/environment.rb:20
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/home/redmine/redmine/vendor/plugins/redmine_reminder/lib/tasks/reminder_all.rake:29
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:171:in `load_without_new_constant_marking'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:171:in `load'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/redmine/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:171:in `load'
/home/redmine/redmine/vendor/rails/railties/lib/tasks/rails.rb:13
/home/redmine/redmine/vendor/rails/railties/lib/tasks/rails.rb:13:in `each'
/home/redmine/redmine/vendor/rails/railties/lib/tasks/rails.rb:13
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
/home/redmine/redmine/Rakefile:10
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/redmine/gems/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/bin/rake:31

RE: Default columns plugin - Added by Tony Marschall about 13 years ago

@ Toni Marschall : can you help?

[...]

Sry, had the same problem. After a complete new installation (debootstrap) it works.
I have no idea what i made different ...

RE: Default columns plugin - Added by Tony Marschall about 13 years ago

... and i use redmine_default_columns_plus.tar.gz (16.1 kB) a few replies above ...

RE: Default columns plugin - Added by Olivier Scherler about 13 years ago

Toni Marschall wrote:

Hello,

i got an error on db:migrate_plugins. Some other plugins working fine.

Can somebody help?

redmine@dev-server:~/redmine$ rake db:migrate_plugins RAILS_ENV=production --trace
(in /home/redmine/redmine)
rake aborted!
uninitialized constant Rails::Plugin::Dispatcher

Yes, the plugin’s init.rb is missing a call to require 'dispatcher'. Add it near the top:

require 'redmine'
require 'dispatcher'
require 'query_per_project_constants'
require 'query_per_project_patches'

unless Redmine::Plugin.registered_plugins.keys.include?(:redmine_default_columns)
...

RE: Default columns plugin - Added by Tomasz Bielinski almost 13 years ago

Thank you Vitaly Klimov for good job! After adding the line 'require dispatcher' to init.rb file it works correctly.

For my purposes I had to make a change to the 'query_per_project_patches.rb' file. I created a query in Readmine that are available in all projects - I set null the project identifier (projekt_id is null). It is very convenient because I do not need make the same query to all projects. For this reason, I changed line 56 to:

@query = Query.find_by_name(query_default_name, :conditions => "project_id = #{@project.id} OR project_id IS NULL")

Could I ask about adding this fix in future versions?

RE: Default columns plugin - Added by Lari Pulkkinen almost 13 years ago

Is there any progress on making this plugin available in Redmine 1.3? Installing the plugin seems to work but plugin configuration page responds with internal server error:

ActionView::TemplateError (undefined method `visible_by' for #<Class:0x2b4c9c4370b0>) on line #4 of vendor/plugins/redmine_default_columns/app/views/settings/_default_columns_settings.html.erb:
1: <p>
2:   <%= label_tag('settings[query_templates_project_id]', l(:label_plugin_dc_query_project)) %>
3:      <%= select_tag( 'settings[query_templates_project_id]',
4:                      dc_fill_projects_dropdown(@settings['query_templates_project_id']))%>
5: </p>
6:
7: <p>

    vendor/plugins/redmine_default_columns/app/helpers/settings_helper.rb:8:in `dc_fill_projects_dropdown'
    vendor/plugins/redmine_default_columns/app/views/settings/_default_columns_settings.html.erb:4
    app/views/settings/plugin.html.erb:6
    app/views/settings/plugin.html.erb:4
    passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
    passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
    passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
    passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
    passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
    passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
    passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
    passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in `start'
    passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
    passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
    passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
    passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
    passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
    passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
    passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
    passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    passenger (3.0.11) helper-scripts/passenger-spawn-server:99

Rendering /var/www/redmine/public/500.html (500 Internal Server Error)

RE: Default columns plugin - Added by Naveen Prabhu almost 13 years ago

Changing Project.visible_by to Project.visible_condition(User.current) in the file vendor/plugins/redmine_default_columns/app/helpers/settings_helper.rb got rid of the above error.

RE: Default columns plugin - Added by Mischa The Evil almost 13 years ago

Naveen Prabhu wrote:

Changing Project.visible_by to Project.visible_condition(User.current) in the file vendor/plugins/redmine_default_columns/app/helpers/settings_helper.rb got rid of the above error.

Project.visible_by was already deprecated in Redmine 1.2.0 with r5324.

RE: Default columns plugin - Added by Sven Pissoort almost 13 years ago

Will there be a version in the future which supports redmine 1.3.0?

RE: Default columns plugin - Added by Sven Pissoort almost 13 years ago

I have installed v0.0.7 @ a bitnami redmine v1.3.0 stack installation.

When following the step-by-step tutorial

Step by step tutorial

1.Create special project which will hold all our default queries (lets call it DefaultQueries) We should include all possible trackers and issues' custom fields to this project to be able to create queries for all our projects
2.Create project custom field which will hold project type (lets make it drop-down named Type with values Bugs, Invoices and Tasks). To make things easier we'll make it required for all projects with the default value of Tasks
3.Set this custom field for each project according to the project type
4.Go to plugin settings and select project we created (DefaultQueries) and custom field name (Type). We will leave value for the Default query name as it was - Default
5.Go to the project DefaultQueries and create there three queries named Default_Bugs, Default_Tasks and Default_Invoices For each query we can use its own set of columns/sort order/grouping
6.Go to the project SpecialCase and create query named Default>

At step 5, I go to the project DefaultQueries, but can't see any option to create queries.
How do I create queries?

Br

RE: Default columns plugin - Added by Luis Serrano Aranda almost 13 years ago

In my redmine 1.3 the last plugin version don't work.

(26-50/84)