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 Vitaly Klimov over 12 years ago

Hello, update is due in a couple of weeks - i have a quite busy schedule right now. Sorry about that.

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

Plugin updated to version 0.0.7 and compatible with the Redmine 1.3.x

Download it from the plugin page: http://www.redmine.org/plugins/redmine_default_columns

Please do remove plugin folder completely before installing new version!

RE: Default columns plugin - Added by J Hat over 12 years ago

I've installed the latest version of the plugin(0.0.7) but whenever I access Gantt Chart tab it keep raising this error:

My Redmine version is 1.3.1 with better_gantt_chart plugin installed

Can any one help me

RE: Default columns plugin - Added by Vincent Lizzi over 12 years ago

I had the same problem. There's a patch for the Default Columns plugin at www.redmine.org/boards/3/topics/22288

RE: Default columns plugin - Added by J Hat over 12 years ago

Thank you for your help Vincent, it worked

RE: Default columns plugin - Added by Y Z over 12 years ago

Guys, redmine 1.3.1 stopped deleting the created filters, saying "The page doesn't exist or you have no permissions to access this page". Could you please investigate it and fix?

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

Version 0.0.8:

  • Patches QueriesHelper differently for more compatibility
  • Now compatible with BetterGanttChart plugin

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

Nice .

I will test it with redmine 1.3.1 and plugin:BetterGanttChart

Thanks.

RE: Default columns plugin - Added by Y Z over 12 years ago

Yura Zaplavnov wrote:

Guys, redmine 1.3.1 stopped deleting the created filters, saying "The page doesn't exist or you have no permissions to access this page". Could you please investigate it and fix?

Great, It was fixed!

RE: Default columns plugin - Added by Y Z over 12 years ago

I have a default filter created and configured. It works well, however when I click on my own filter and click on the View all issues link located in sidebar it doesn't show up the issues from my Default filter anymore ((. Could it be fixed?

RE: Default columns plugin - Added by Y Z over 12 years ago

Is there any news regarding the fix?

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

Can you be more precise on what is wrong? If possible, describe it step-by-step. View all issues link is not affected by any filters of the plugin. To apply view explicitly while you still on the issues page choose Default query instead.

RE: Default columns plugin - Added by Y Z over 12 years ago

View all issues links to /issues?set_filter=1 address. Is there any way to load Default project filter in case if set_filter=1 parameter is passed?

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

There are ways, but it won't be correct. View all issues does what it says - displays all open issues. You can rename your default filter from Default to View all filtered issues and have it on your sidebar.

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

Plugin now compatible with both Redmine 1.3.x+ and 2.x versions.

RE: Default columns plugin - Added by Pawel Orzechowski over 12 years ago

Hi, I have installed the plugin in Redmine 1.4.4. with its prerequisite. Installation went ok, apart from two strange statements after rake task rake redmine:plugins:process_version_change RAILS_ENV=production:

[...]
--------- processing plugin redmine_default_columns
    Using version 1.3.0 for file /app/views/issues/index.api.rb
    Using version 1.3.0 for file /app/views/issues/index.html.erb
--------- processing plugin [...]

Then I created a project "DefaultQueries" with query named "MojeZagadnienia". I marked query to be added to all projects.
Then on plugin configure page I changed Default Query name to "MojeZagadnienia".

Unfortunatelly after I enter any project now the query is not run:-( though the query "MojeZagadniena" exists there.

Did I missed something in plugin configuration or is it some bug? I suppose that for the functionalilty I described I do not need to create custom field for projects.

Regards

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

Pawel Orzechowski wrote:

Hi, I have installed the plugin in Redmine 1.4.4. with its prerequisite. Installation went ok, apart from two strange statements after rake task rake redmine:plugins:process_version_change RAILS_ENV=production:

This is perfectly normal.

Then I created a project "DefaultQueries" with query named "MojeZagadnienia". I marked query to be added to all projects.

Please do not do it. All those queries should be 'hidden' inside this special project

Then on plugin configure page I changed Default Query name to "MojeZagadnienia".

Please note that default query applies only on project per project basis - so for this to work each project should have its own query named "MojeZagadnienia" that is public.

I understand that you want to make query which will be applied by default for all projects. To do it you need to name your query Default_Project in the project DefaultQueries and do not make it marked for all projects.

RE: Default columns plugin - Added by # And about 12 years ago

Hi, Vitaly. Do you use git/svn repository for your plugin?
Need Redmine 2.1.x compatibility. I can send you patch or pool-request.

RE: Default columns plugin - Added by John Digital almost 12 years ago

Hello Vitaly,
Does the default query per project plugin is akready compatible with Redline 2.1.x ? Thanks

RE: Default columns plugin - Added by Miroslav Zaťko over 11 years ago

installing this plugin on redmine2.1.2 and redmine2.2.3 causes you are not able to create custom query anymore... Means you are not able even create queries as described in "Example of usage"

RE: Default columns plugin - Added by mark kalender over 11 years ago

Miroslav Zaťko wrote:

installing this plugin on redmine2.1.2 and redmine2.2.3 causes you are not able to create custom query anymore... Means you are not able even create queries as described in "Example of usage"

yup same issue,

had to edit template from
"$('query_form').action='#{ Herve Harster ? new_project_query_path(Herve Harster) : new_query_path }'; submit_query_form('query_form')",
to
"$('#query_form').attr('action', '#{ Herve Harster ? new_project_query_path(Herve Harster) : new_query_path }'); submit_query_form('query_form')",

is there a repo for this? if not i will create one on git to keep track of changes or fixes ppl might need

RE: Default columns plugin - Added by Greg Ten over 11 years ago

I've just switched to 2.3-stable, and I'm experiencing the following problem:

Started GET "/projects/company?jump=issues" for 192.168.1.5 at Thu May 09 12:05:41 +0400 2013
Processing by ProjectsController#show as HTML
  Parameters: {"id"=>"company", "jump"=>"issues"}
  Current user: greg (id=3)
Redirected to http://pm.company.local/projects/company/issues
Completed 302 Found in 13ms (ActiveRecord: 1.3ms)
Started GET "/projects/company/issues" for 192.168.1.5 at Thu May 09 12:05:41 +0400 2013a
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"company"}
  Current user: greg (id=3)
  Rendered queries/_filters.html.erb (301.6ms)
  Rendered queries/_columns.html.erb (325.3ms)
  Rendered plugins/redmine_default_columns/app/views/issues/index.html.erb within layouts/base (630.4ms)
Completed 500 Internal Server Error in 755ms

ActionView::Template::Error (undefined local variable or method `tag_name' for #<#<Class:0x2acf1cbe8190>:0x2acf1c6bf9c0>):
    17:     <td>
    18:       <%= label_tag "selected_columns", l(:description_selected_columns) %>
    19:       <br />
    20:       <%= select_tag tag_name,
    21:               options_for_select(query_selected_inline_columns_options(query)),
    22:               :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px",
    23:               :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);" %>
  app/views/queries/_columns.html.erb:20:in `_app_views_queries__columns_html_erb__1063194974_23534513552340'
  app/controllers/issues_controller.rb:83:in `index'
  app/controllers/issues_controller.rb:82:in `index'

Is this still not solved? Just in case you are interested about the version I use:

$ svn info
Path: .
Working Copy Root Path: /wwwroot/pm.company.local/site
URL: http://redmine.rubyforge.org/svn/branches/2.3-stable
Repository Root: http://redmine.rubyforge.org/svn
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 11803
Node Kind: directory
Schedule: normal
Last Changed Author: tmaruyama
Last Changed Rev: 11801
Last Changed Date: 2013-05-08 05:36:46 +0400 (Wed, 08 May 2013)

RE: Default columns plugin - Added by Miroslav Zaťko over 11 years ago

Hi, same problem here

Environment:
  Redmine version                          2.3.0.stable.11670
  Ruby version                             1.8.7 (x86_64-linux)
  Rails version                            3.2.13
  Environment                              production
  Database adapter                         PostgreSQL
Redmine plugins:
  due_date_reminder                        0.3.2
  extended_fields                          0.2.1
  extended_profile                         1.2.0
  project_overview                         1.1.0
  projects_table                           0.0.4
  redmine_anonymous_authors                0.0.4
  redmine_anonymous_watchers               0.1.0
  redmine_code_review                      0.6.1
  redmine_contacts                         3.2.0-light
  redmine_contacts_invoices                2.1.0-light
  redmine_custom_workflows                 0.0.4
  redmine_default_columns                  0.1.1
  redmine_dmsf                             1.4.5 stable
  redmine_hide_estimated_hours             1.0.3
  redmine_inline_attach_screenshot         0.4.2
  redmine_issue_checklist                  2.0.5
  redmine_knowledgebase                    2.2.0
  redmine_lightbox                         0.0.1
  redmine_mylyn_connector                  2.8.2.stable
  redmine_plugin_views_revisions           0.0.1
  redmine_release_notes                    1.3.1-beta
  redmine_timesheet_plugin                 0.7.0
  redmine_work_time                        0.2.10
  redmine_xls_export                       0.2.1

Started GET "/projects/test/issues" for 192.168.1.1 at Thu May 30 17:42:10 +0200 2013
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"test"}
  Current user: mirec (id=3)
  Rendered queries/_filters.html.erb (33.0ms)
  Rendered queries/_columns.html.erb (199.4ms)
  Rendered plugins/redmine_default_columns/app/views/issues/index.html.erb within layouts/base (235.9ms)
Completed 500 Internal Server Error in 358ms

ActionView::Template::Error (undefined local variable or method `tag_name' for #<#<Class:0x7fe2bedfa928>:0x7fe2beb974b0>):
    17:     <td>
    18:       <%= label_tag "selected_columns", l(:description_selected_columns) %>
    19:       <br />
    20:       <%= select_tag tag_name,
    21:               options_for_select(query_selected_inline_columns_options(query)),
    22:               :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px",
    23:               :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);" %>
  app/views/queries/_columns.html.erb:20:in `_app_views_queries__columns_html_erb___547276611_70305921279720'
  app/controllers/issues_controller.rb:83:in `index'
  app/controllers/issues_controller.rb:82:in `index'

RE: Default columns plugin - Added by Miroslav Zaťko over 11 years ago

no idea if it is correct as I don't know ROR at all but after changing
${REDMINE_ROOT}/app/views/queries/_columns.html.erb
from

    18:       <%= label_tag "selected_columns", l(:description_selected_columns) %>
    19:       <br />
    20:       <%= select_tag tag_name,
    21:               options_for_select(query_selected_inline_columns_options(query)),

to
    18:       <%= label_tag "selected_columns", l(:description_selected_columns) %>
    19:       <br />
    20:       <%= select_tag "selected_columns",
    21:               options_for_select(query_selected_inline_columns_options(query)),

and restarting afterwards it seems to be fixed...

I just changed it to "look similar" as other <td> element in same file

     4:      <%= label_tag "available_columns", l(:description_available_columns) %>
     5:      <br />
     6:      <%= select_tag 'available_columns',
     7:              options_for_select(query_available_inline_columns_options(query)),

RE: Default columns plugin - Added by Noya B over 11 years ago

Hi,
I think you don't have to change redmine code but plugin one.
It seems that a helper function is now used to render the query colums: render_query_columns_selection. This function defines tag_name variable.

Anyway, you have to merge the index.html.erb file entirely:
Replace app/views/issues/index.html.erb plugin file by redmine one and apply VVK changes:

<%# VVK changes start %>
    <fieldset id="filters" class="collapsible <%= @query.new_record? && @query.name != "_QPP_"  ? "" : "collapsed" %>">
<%# VVK changes end %>
      <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
<%# VVK changes start %>
      <div style="<%= @query.new_record? && @query.name != "_QPP_" ? "" : "display: none;" %>">
<%# VVK changes end %>
<pre>
(51-75/84)