Patch #30919

Group Issues Custom Fields - (Form like Issues)

Added by Frederico Camara about 1 year ago. Updated about 1 month ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:Candidate for next major release

Description

This patch adds a new tab in the project settings. In this tab, you can reorder and group custom fields for each tracker.

Reordering and grouping custom fields makes them appear as this for this project only in vieweing an issue and editing an issue.

It was developed for Redmine 3.2. In Redmine 3.4~, you can make a custom field take the full width, which makes these go to the bottom of the issue page. I had to adapt it so that you can still reorder the half width custom fields separated from the full width custom fields.

If it sounds confusing, see the screenshots (sorry they are in portuguese).

To apply:

patch p1 < GCF<your redmine version>.patch
touch tmp/restart.txt
RAILS_ENV=production bundle exec rake db:migrate

PDF and email formatting not implemented yet.

GCF1.jpg - Settings tab for Grouping Custom Fields (128 KB) Frederico Camara, 2019-02-25 16:58

GCF2.jpg - Grouped Custom Fields in a new issue (109 KB) Frederico Camara, 2019-02-25 16:58

GCF3.jpg - Grouped Custom Fields in a new issue (filled) (160 KB) Frederico Camara, 2019-02-25 16:58

GCF4.jpg - Issue view with Grouped Custom Fields (137 KB) Frederico Camara, 2019-02-25 16:58

GCF-3.2.patch Magnifier (21.8 KB) Frederico Camara, 2019-02-25 17:05

GCF-3.4.patch Magnifier (25.7 KB) Frederico Camara, 2019-02-25 17:05

GCF-4.0.patch Magnifier (26.3 KB) Frederico Camara, 2019-02-25 17:05

GCFep-4.0.patch Magnifier (12.7 KB) Frederico Camara, 2019-02-27 15:03

GCFep-3.4.patch Magnifier (12.7 KB) Frederico Camara, 2019-02-27 15:03

GCFep-3.2.patch Magnifier (6.4 KB) Frederico Camara, 2019-02-27 15:03

GCF-3.4-final1.patch Magnifier (39.3 KB) Frederico Camara, 2019-03-01 17:22

GCF-4.0-final1.patch Magnifier (39.9 KB) Frederico Camara, 2019-03-01 17:22

GCF-3.2-final1.patch Magnifier (33.6 KB) Frederico Camara, 2019-03-01 17:22

GCF-4.0-final1-fixed.patch Magnifier - Fix for rails 5 or greater (39.9 KB) Frederico Camara, 2020-01-01 19:28

Snímek obrazovky 2020-01-05 v 9.58.02.png (42.9 KB) Petr Kokosak, 2020-01-05 09:59

Snímek obrazovky 2020-01-05 v 9.58.36.png (65.1 KB) Petr Kokosak, 2020-01-05 09:59

Snímek obrazovky 2020-01-05 v 9.58.52.png (46.4 KB) Petr Kokosak, 2020-01-05 09:59

History

#1 Updated by Frederico Camara about 1 year ago

Cant edit description. Forgot to include the patch. For stable versions of Redmine 3.2, 3.4 and 4.0.

To apply:

patch -p1 < GCF-<your redmine version>.patch
touch tmp/restart.txt
RAILS_ENV=production bundle exec rake db:migrate

#2 Updated by Go MAEDA about 1 year ago

  • Target version set to Candidate for next major release

#3 Updated by Frederico Camara 12 months ago

Including patches for mail and pdf formatting. Apply after the first patch:

patch -p1 < GCFen-<your redmine version>.patch
touch tmp/restart.txt

#4 Updated by Frederico Camara 12 months ago

BUGFIX: Can't delete projects, trackers, custom_fields if there is any grouping.

- Very problematic, you would have to look project by project, remove groups. This patch fixes everything.
- Other fix: the database position entry was created incorrectly. acts_as_list has to set position to null.
- A bit of code refactoring.

Consolidated patch.

This is a consolidated patch for redmine 3.2, 3.4 and 4.0. Apply just this one.

patch -p1 < GCF-<your redmine version>.patch
RAILS_ENV=production bundle exec rake db:migrate
touch tmp/restart.txt

#5 Updated by Zoltán Schmidt about 1 month ago

I have installed the patch and does not work.
Please give me some advice, how to use your patch!
Redmine version: 4.0.5.stable

The result:

Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Back

and the production.log:

Redirected to https://oururl/
Completed 302 Found in 35ms (ActiveRecord: 23.6ms)
Started GET "/" for 80.95.86.254 at 2019-12-31 20:24:13 +0000
Processing by WelcomeController#index as HTML
Current user: myname (id=21)
Rendering welcome/index.html.erb within layouts/base
Rendered welcome/index.html.erb within layouts/base (3.5ms)
Completed 200 OK in 156ms (Views: 15.1ms | ActiveRecord: 12.0ms)
Started GET "/projects" for 80.95.86.254 at 2019-12-31 20:24:17 +0000
Processing by ProjectsController#index as HTML
Current user: myname (id=21)
Rendering projects/index.html.erb within layouts/base
Rendered projects/index.html.erb within layouts/base (11.8ms)
Completed 200 OK in 50ms (Views: 24.6ms | ActiveRecord: 13.3ms)
Started GET "/projects/ourproject" for 80.95.86.254 at 2019-12-31 20:24:19 +0000
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"ourproject"}
Current user: myname (id=21)
Rendering projects/show.html.erb within layouts/base
Rendered projects/_members_box.html.erb (5.4ms)
Rendered projects/show.html.erb within layouts/base (19.4ms)
Completed 200 OK in 125ms (Views: 48.8ms | ActiveRecord: 19.3ms)
Started GET "/projects/ourproject/settings" for 80.95.86.254 at 2019-12-31 20:24:21 +0000
Processing by ProjectsController#settings as HTML
Parameters: {"id"=>"ourproject"}
Current user: myname (id=21)
Completed 500 Internal Server Error in 59ms (ActiveRecord: 10.6ms)

@NameError (uninitialized constant ProjectsController::AttributeGroup):


@app/controllers/projects_controller.rb:180:in `settings'

lib/redmine/sudo_mode.rb:63:in `sudo_mode'

#6 Updated by Frederico Camara about 1 month ago

Zoltán Schmidt wrote:

I have installed the patch and does not work.
Please give me some advice, how to use your patch!
Redmine version: 4.0.5.stable

Maybe you had issues with the database migration. Migrations are versioned since Rails 5.
I'm submitting a fixed 4.0 patch. if you already have it patched, try this:

# adds a '[4.2]' to the end of first line
cd <redmine directory>
sed 's/ActiveRecord::Migration$/&[4.2]/' -i db/migrate/20180913211420_create_attribute_groups.rb
sed 's/ActiveRecord::Migration$/&[4.2]/' -i db/migrate/20180913212008_create_attribute_group_fields.rb
sed 's/ActiveRecord::Migration$/&[4.2]/' -i db/migrate/20190301162408_change_group_position_attributes.rb
RAILS_ENV=production bundle exec rake db:migrate
touch tmp/restart.tmp

#7 Updated by Petr Kokosak about 1 month ago

Hello, please help me. I have installed the your patch for Redmine version 4.1.0.stable and work perfect.
I need help with designing items in a group.

My environment:
Redmine version 4.1.0.stable
Ruby version 2.7.0-p0 (2019-12-25) [x86_64-darwin18]
Rails version 5.2.4.1
Environment production
Database adapter Mysql2

How can I solve the following samples ?

First example :  9.58.02.png
Second example : 9.58.36.png
Third example : 9.58.52.png

Thank you so much for your answer.
Petr

#8 Updated by Frederico Camara about 1 month ago

Petr Kokosak wrote:

Hello, please help me. I have installed the your patch for Redmine version 4.1.0.stable and work perfect.
I need help with designing items in a group.

This is not addressed by this patch. It does not meddle with Redmine's original css widths. Maybe you should fix the width in a theme.

At this moment, this patch does not organize which information goes on the left or right column, or how much space it takes, they are distributed evenly. Redmine originally does not care which information goes where, or even the order. This is mainly to give the order more flexibility.

To have real forms in Redmine, the effort should be bigger. Redmine makes possible that different roles see different fields, and some custom fields show up only when the issue is at cartain statuses. A real form do not address any of these things.

Best Regards.

Also available in: Atom PDF