How to add additional information to issues list?

Added by Peter Schott over 4 years ago

Hi there!

I'm pretty new to redmine and looking for a possibility to add additional information to the issues list.

We use a redmine installation for tracking all our projects, which are often not more than 3 to 5 hrs. tasks.
They are all numbered and pretty different. The number can NOT be the one that redmine gives to it, as we have several classes like orders and inquiries or RFQs which might have the same number, but are different.
Therefore this number with the class is the project's name in redmine (e.g. PSBA0538 or A0127). A very short description is stored in @project.description.

It would be very convenient to show this project description in the issues list, ideally in the column after the project name (which in this case is the number "PSBA0538" or so.)

I was able to show the project description in redmines header by adding a line in

app/helpers/application_helper.rb

  def page_header_title
    if @project.nil? || @project.new_record?
      h(Setting.app_title)
    else
      b = []
      ancestors = (@project.root? ? [] : @project.ancestors.visible.to_a)
      if ancestors.any?
        root = ancestors.shift
        b << link_to_project(root, {:jump => current_menu_item}, :class => 'root')
        if ancestors.size > 2
          b << "\xe2\x80\xa6" 
          ancestors = ancestors[-2, 2]
        end
        b += ancestors.collect {|p| link_to_project(p, {:jump => current_menu_item}, :class => 'ancestor') }
      end
      b << h(@project)

#line to add description right after Project's name
      b << h(@project.description)

      b.join(" \xc2\xbb ").html_safe
    end
  end

Unfortunately I do not have any idea, how to get the issues list tuned to my needs! -> Any ideas or tips?

Best regards

Peter

Replies (8)

RE: How to add additional information to issues list? - Added by Kush Suryavanshi over 4 years ago

Hi Peter,
Were you able to achieve this? I kind of need similar help
Thanks
Kush

RE: How to add additional information to issues list? - Added by Peter Schott over 4 years ago

Hi Kush,

unfortunately I did not solve my problem for now.
Let me tell you, what I found out so far:

By adding some line in "app/models/issue_query.rb" at self.available_columns I was able to get an additional field, that can be selected for the issues list.

  self.available_columns = [
    QueryColumn.new(:id, :sortable => "#{Issue.table_name}.id", :default_order => 'desc', :caption => '#', :frozen => true),
    QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
#change
    QueryColumn.new(:projectdesc, :sortable => "Beschreibung", :groupable => false),

    QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true),

By adding some line in "config/locales" and for me "de.yml" I was able to translate that

   field_project: Projekt
#change
   field_projectdesc: Projektbeschreibung

   field_redirect_existing_links: Existierende Links umleiten

Unfortunately I am not able to get any content linked to this field and get an 500 error when selecting it.
Do you have any ideas?

Best regards

Peter

RE: How to add additional information to issues list? - Added by Kush Suryavanshi over 4 years ago

Thanks much Peter for replying in detail. I also figured out I need to make changes in self.available_columns but I haven't figured out what exactly. I come from Windows\C#\.Net background, so I will give a couple days to learn basics of Ruby and Rails and maybe I can figure it out then.

In your code, whats "Beschreibung"? The reason you get 500 error is probably related to that. You may need something like "#{Project.table_name}.description"(or whatever redmine uses for description. Because, internally it would need a parameter to sort on. I will update you my progress once I figure this out.

RE: How to add additional information to issues list? - Added by Peter Schott over 4 years ago

Hi Kush,

"Beschreibung" is simply the german translation for the column title, that I wish to show there. I thought it would just be a return value, that's why I simply put it like this. But I also tried with stolen return values from different columns, with no success.

I think the error is related to the trial of printing values in this column which in that case cannot be filled.

Looking forward to your findings!

Will keep you updated, as soon as I find out something.

RE: How to add additional information to issues list? - Added by Kush Suryavanshi over 4 years ago

Thanks much Peter.
1) I tried to use computed custom field plugin - but didn't have any luck.
2) I have traced the error to
views\issues\_lists.html.erb

The changes you have suggested are failing at following function on line 34 -
column_content(column, issue)

I will update once I figured out why the code is failing here.

RE: How to add additional information to issues list? - Added by Kush Suryavanshi over 4 years ago

Ok - finally figured this out.

Just make following change in app\models\issue.rb

  def projectdesc
    self.project.description
  end

And you are all set :). Now,
1) I really wish redmine could provide the ability to filter the projects and export data, just like issues
2) I really wish we could simply join the project data to issue data rather than these tricky changes - but maybe we are expected to use some reporting tools...

Anyways, good luck and let me know if you face any issue with this.
ps - Thanks for all of your help in figuring out the initial changes.

RE: How to add additional information to issues list? - Added by Peter Schott over 4 years ago

Hello Kush,

was on holiday... thanks for your help, this worked perfectly for me!

Best regards

Peter

RE: How to add additional information to issues list? - Added by Kush Suryavanshi over 4 years ago

No worries. Glad it worked :).
Cheers
Kush

(1-8/8)