プロジェクト

全般

プロフィール

Vote #79863

未完了

Group Issues Custom Fields - (Form like Issues)

Admin Redmine さんがほぼ2年前に追加. ほぼ2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
0
issue_org_id:
30919
author_id:
127719
assigned_to_id:
0
comments:
30
status_id:
1
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

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-.patch
touch tmp/restart.txt
RAILS_ENV=production bundle exec rake db:migrate

PDF and email formatting not implemented yet.


journals

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

To apply:

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

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

<pre>
patch -p1 < GCFen-<your redmine version>.patch
touch tmp/restart.txt
</pre>
--------------------------------------------------------------------------------
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.*

<pre>
patch -p1 < GCF-<your redmine version>.patch
RAILS_ENV=production bundle exec rake db:migrate
touch tmp/restart.txt
</pre>
--------------------------------------------------------------------------------
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'@

--------------------------------------------------------------------------------
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:

<pre>
# 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
</pre>
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Can you make diff patch for redmine 4.1.0 please?
--------------------------------------------------------------------------------
Yuri Azanov wrote:
> Can you make diff patch for redmine 4.1.0 please?

Here it is.
--------------------------------------------------------------------------------
Frederico Camara wrote:
> Yuri Azanov wrote:
> > Can you make diff patch for redmine 4.1.0 please?
>
> Here it is.

Thanks! I have some problem:
Patch apply successfully, no error.
DB migrate execute whitout any verbose steps in console (DB was not modifed!!! Why?).
New db migrate file found in db/mifrate folder (it's OK):
20180913211420_create_attribute_groups.rb
20180913212008_create_attribute_group_fields.rb
20190301162408_change_group_position_attributes.rb

After restart redmine there are error in production.log:
ActiveRecord::StatementInvalid (Mysql2::Error: Table 'bitnami_redmineplusagile.attribute_groups' doesn't exist: SHOW FULL FIELDS FROM `attribute_groups`):

tables was not created...why?

@Environment:
Redmine version 4.1.0.stable
Ruby version 2.5.7-p206 (2019-10-01) [x86_64-linux]
Rails version 5.2.4.1
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp@
--------------------------------------------------------------------------------
Yuri Azanov wrote:
> DB migrate execute whitout any verbose steps in console (DB was not modifed!!! Why?).

It does not make any sense. Wrong directory? Wrong command?

I used 'RAILS_ENV=production bundle exec rake db:migrate'.
--------------------------------------------------------------------------------
Now it's migrated successfully, thank.
I don't understand how it's work this subject.
There are new tab "Grouped Custom Fileds" in project settings, i fill Groupded Custom Fields, then press "+" and "Save" but there are nothing happened...
How it's work?
--------------------------------------------------------------------------------
Yuri Azanov wrote:
> Now it's migrated successfully, thank.
> I don't understand how it's work this subject.
> There are new tab "Grouped Custom Fileds" in project settings, i fill Groupded Custom Fields, then press "+" and "Save" but there are nothing happened...
> How it's work?

Look at the reference jpgs I posted (first attachments on this issue). Your picture looks nothing like them.

Maybe you are using an old browser or have disabled javascript, or the css is not getting through to the browser.

--------------------------------------------------------------------------------
You are right. If change theme to Standard, it's worked nice!!!

It seem to me there are "PurpleMine2" theme trouble.

Thank you!Be healthy!

p.s. It would be nice make this option Global, for trackers (not only for each project...)
--------------------------------------------------------------------------------
Hello,
wonderful patch.

I have Redmine 4.0.3

If I try to apply the patch it gives the followingg message

patch --dry-run -p1 < /home/bitnami/GCF-4.0-final1-fixed.patch
checking file app/controllers/projects_controller.rb
checking file app/helpers/issues_helper.rb
checking file app/helpers/projects_helper.rb
checking file app/models/attribute_group.rb
checking file app/models/attribute_group_field.rb
checking file app/models/custom_field.rb
checking file app/models/project.rb
checking file app/models/tracker.rb
checking file app/views/issues/_form_custom_fields.html.erb
checking file app/views/issues/show.html.erb
checking file app/views/projects/settings/_groupissuescustomfields.html.erb
checking file config/locales/en.yml
Hunk #1 succeeded at 1227 (offset 4 lines).
checking file config/locales/pt-BR.yml
Hunk #1 succeeded at 1243 (offset 4 lines).
checking file config/routes.rb
Hunk #1 succeeded at 108 (offset 3 lines).
checking file db/migrate/20180913211420_create_attribute_groups.rb
checking file db/migrate/20180913212008_create_attribute_group_fields.rb
checking file db/migrate/20190301162408_change_group_position_attributes.rb
checking file lib/redmine.rb
checking file lib/redmine/export/pdf/issues_pdf_helper.rb
*Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #2 succeeded at 74 with fuzz 1 (offset 6 lines).
Hunk #3 FAILED at 85.
Hunk #4 FAILED at 101.
Hunk #5 succeeded at 147 with fuzz 2 (offset -46 lines).
Hunk #6 succeeded at 174 (offset -46 lines).
Hunk #7 succeeded at 202 (offset -46 lines).
Hunk #8 succeeded at 222 (offset -46 lines).
Hunk #9 FAILED at 297.
Hunk #10 succeeded at 278 (offset -46 lines).
Hunk #11 succeeded at 286 (offset -46 lines).
Hunk #12 succeeded at 294 (offset -46 lines).
Hunk #13 succeeded at 334 (offset -46 lines).
Hunk #14 succeeded at 347 (offset -46 lines).
Hunk #15 succeeded at 366 (offset -46 lines).
3 out of 15 hunks FAILED
checking file public/stylesheets/application.css
Hunk #1 succeeded at 476 (offset 1 line).
Hunk #2 succeeded at 1551 (offset 1 line).
checking file test/fixtures/attribute_group_fields.yml
checking file test/fixtures/attribute_groups.yml*

I have another patch applied on field permissions. Does it mean they are not compatible?

--------------------------------------------------------------------------------
Adriano Bellia wrote:
> Hello,
> wonderful patch.
>
>
> I have Redmine 4.0.3
>
>
> If I try to apply the patch it gives the followingg message
>
> patch --dry-run -p1 < /home/bitnami/GCF-4.0-final1-fixed.patch
> checking file app/controllers/projects_controller.rb
> checking file app/helpers/issues_helper.rb
> checking file app/helpers/projects_helper.rb
> checking file app/models/attribute_group.rb
> checking file app/models/attribute_group_field.rb
> checking file app/models/custom_field.rb
> checking file app/models/project.rb
> checking file app/models/tracker.rb
> checking file app/views/issues/_form_custom_fields.html.erb
> checking file app/views/issues/show.html.erb
> checking file app/views/projects/settings/_groupissuescustomfields.html.erb
> checking file config/locales/en.yml
> Hunk #1 succeeded at 1227 (offset 4 lines).
> checking file config/locales/pt-BR.yml
> Hunk #1 succeeded at 1243 (offset 4 lines).
> checking file config/routes.rb
> Hunk #1 succeeded at 108 (offset 3 lines).
> checking file db/migrate/20180913211420_create_attribute_groups.rb
> checking file db/migrate/20180913212008_create_attribute_group_fields.rb
> checking file db/migrate/20190301162408_change_group_position_attributes.rb
> checking file lib/redmine.rb
> checking file lib/redmine/export/pdf/issues_pdf_helper.rb
> *Reversed (or previously applied) patch detected! Assume -R? [n] y
> Hunk #2 succeeded at 74 with fuzz 1 (offset 6 lines).
> Hunk #3 FAILED at 85.
> Hunk #4 FAILED at 101.
> Hunk #5 succeeded at 147 with fuzz 2 (offset -46 lines).
> Hunk #6 succeeded at 174 (offset -46 lines).
> Hunk #7 succeeded at 202 (offset -46 lines).
> Hunk #8 succeeded at 222 (offset -46 lines).
> Hunk #9 FAILED at 297.
> Hunk #10 succeeded at 278 (offset -46 lines).
> Hunk #11 succeeded at 286 (offset -46 lines).
> Hunk #12 succeeded at 294 (offset -46 lines).
> Hunk #13 succeeded at 334 (offset -46 lines).
> Hunk #14 succeeded at 347 (offset -46 lines).
> Hunk #15 succeeded at 366 (offset -46 lines).
> 3 out of 15 hunks FAILED
> checking file public/stylesheets/application.css
> Hunk #1 succeeded at 476 (offset 1 line).
> Hunk #2 succeeded at 1551 (offset 1 line).
> checking file test/fixtures/attribute_group_fields.yml
> checking file test/fixtures/attribute_groups.yml*
>
> I have another patch applied on field permissions. Does it mean they are not compatible?

Not exactly, see that most of the patch would apply, except for lib/redmine/export/pdf/issues_pdf_helper.rb

Also, you should not assume -R (revert), as the patch must be applied.

The problem is I have found whitespaces in the source file and tried to fix that with the patch (I shouldn' have tried it). Probably maintainers fixed that concurrently. The result is a file (before the patch) somewhat different, so the patch gives errors. You may edit that part out of the patch and apply it manually, it's not that difficult. Most hunks just delete whitespaces.
--------------------------------------------------------------------------------
Thank yoy for your reply, I didn't see it before.
I'll try soon and ask your help if I don't undestand something :)

Thank you again

Frederico Camara wrote:
> Adriano Bellia wrote:
> > Hello,
> > wonderful patch.
> >
> >
> > I have Redmine 4.0.3
> >
> >
> > If I try to apply the patch it gives the followingg message
> >
> > patch --dry-run -p1 < /home/bitnami/GCF-4.0-final1-fixed.patch
> > checking file app/controllers/projects_controller.rb
> > checking file app/helpers/issues_helper.rb
> > checking file app/helpers/projects_helper.rb
> > checking file app/models/attribute_group.rb
> > checking file app/models/attribute_group_field.rb
> > checking file app/models/custom_field.rb
> > checking file app/models/project.rb
> > checking file app/models/tracker.rb
> > checking file app/views/issues/_form_custom_fields.html.erb
> > checking file app/views/issues/show.html.erb
> > checking file app/views/projects/settings/_groupissuescustomfields.html.erb
> > checking file config/locales/en.yml
> > Hunk #1 succeeded at 1227 (offset 4 lines).
> > checking file config/locales/pt-BR.yml
> > Hunk #1 succeeded at 1243 (offset 4 lines).
> > checking file config/routes.rb
> > Hunk #1 succeeded at 108 (offset 3 lines).
> > checking file db/migrate/20180913211420_create_attribute_groups.rb
> > checking file db/migrate/20180913212008_create_attribute_group_fields.rb
> > checking file db/migrate/20190301162408_change_group_position_attributes.rb
> > checking file lib/redmine.rb
> > checking file lib/redmine/export/pdf/issues_pdf_helper.rb
> > *Reversed (or previously applied) patch detected! Assume -R? [n] y
> > Hunk #2 succeeded at 74 with fuzz 1 (offset 6 lines).
> > Hunk #3 FAILED at 85.
> > Hunk #4 FAILED at 101.
> > Hunk #5 succeeded at 147 with fuzz 2 (offset -46 lines).
> > Hunk #6 succeeded at 174 (offset -46 lines).
> > Hunk #7 succeeded at 202 (offset -46 lines).
> > Hunk #8 succeeded at 222 (offset -46 lines).
> > Hunk #9 FAILED at 297.
> > Hunk #10 succeeded at 278 (offset -46 lines).
> > Hunk #11 succeeded at 286 (offset -46 lines).
> > Hunk #12 succeeded at 294 (offset -46 lines).
> > Hunk #13 succeeded at 334 (offset -46 lines).
> > Hunk #14 succeeded at 347 (offset -46 lines).
> > Hunk #15 succeeded at 366 (offset -46 lines).
> > 3 out of 15 hunks FAILED
> > checking file public/stylesheets/application.css
> > Hunk #1 succeeded at 476 (offset 1 line).
> > Hunk #2 succeeded at 1551 (offset 1 line).
> > checking file test/fixtures/attribute_group_fields.yml
> > checking file test/fixtures/attribute_groups.yml*
> >
> > I have another patch applied on field permissions. Does it mean they are not compatible?
>
> Not exactly, see that most of the patch would apply, except for lib/redmine/export/pdf/issues_pdf_helper.rb
>
> Also, you should not assume -R (revert), as the patch must be applied.
>
> The problem is I have found whitespaces in the source file and tried to fix that with the patch (I shouldn' have tried it). Probably maintainers fixed that concurrently. The result is a file (before the patch) somewhat different, so the patch gives errors. You may edit that part out of the patch and apply it manually, it's not that difficult. Most hunks just delete whitespaces.

--------------------------------------------------------------------------------
Does GCF-4.1.patch can be used for 4.1.1?
--------------------------------------------------------------------------------
Ivan Nikhayev wrote:
> Does GCF-4.1.patch can be used for 4.1.1?

It works in my 4.1.1 redmine.

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Instead of scheduling this specific implementation proposal, I've scheduled the meta issue that I've just created.
--------------------------------------------------------------------------------
Could you make diff patch for redmine 4.2.1 please?
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Thanks for your quickly support, it works perfect in 4.2.1 Redmine.
--------------------------------------------------------------------------------
The Patch GCP-4.1 works perfectly, except with PDF exporting.
The long text fields appear in a single line, going beyond the page boundaries and being cut off, as demonstrated in attached image.

I checked that the patch applied all the changes to the file issues_pdf_helper.rb like it was supposed. Do you have any idea what it could be and how I can solve this problem?
--------------------------------------------------------------------------------
Lúcia Rodrigues,

Thanks for reporting. I think I fixed it in the code attached. Apply over previous patches.
--------------------------------------------------------------------------------
@Frederico: First, thank you for sharing your solution with the broader Redmine community. I think that this would be a good improvement to the Redmine core for instances (with projects) that use a larger amount of custom fields. I'm at the moment actually considering to start a new project which could really benefit from this feature.

I have had a quick look at your patches (more specifically: attachment:0001-Add-Group-Issue-Custom-Fields-functionality.patch) and have some questions and remarks though:
* How does the design of the implementation you've chosen for your patches compare to the design of the patch that is provided in #13839#note-8?
* Did you choose the name @groupissuescustomfields@ on purpose? Rails convention tends to lean more towards something like @group_issues_custom_fields@. I noticed that this seems a recurring theme with some more variables like @tid@, @gid@, @cfid@, @gp@, @cfs@, @cfp@, etc.
* Where are full-width custom fields actually placed after your patch has been applied?
* In which cases is the wiki formatting toolbar actually provided?
* In the screenshots you've posted it looks like the right borders of field inputs are cutoff. I don't think that's intentional. Is this still present?
* Do you see a way to extent this patch to also allow for grouping of default fields?
* Can you update the patch to apply to the (current) trunk?
* Can you confirm if the current test suite passes without failures/errors with your patch applied?
* Can you provide (solid) test coverage for your changes (this would be required to get it integrated within the Redmine core)?

--------------------------------------------------------------------------------
Mischa The Evil wrote:
> * How does the design of the implementation you've chosen for your patches compare to the design of the patch that is provided in #13839#note-8?
I did not know about #13839#note-8 before writing my own. I downloaded #13839#note-8 and tried to apply it with Redmine stable from 3.0 to 4.2 but it shows errors. I have not tried to merge that patch. Just reading it, I noticed some differences:
Both patches do similar things, but there are differences:
#13839#note-8 saves changes as json to a new model, and there is no db migration code. Is it missing?
#13839#note-8 changes the layout and could insert blanks between fields. It does not group them. It has no full width code (maybe it's older then full width fields).
My patch (this one) is somewhat broader, it also works with pdf export and mail.
Neither patch seems to copy itself when copying a project (at least this doesn't).
I haven't seen how #13839#note-8 deals with adding/removing custom fields to/from a project/tracker.

> * Did you choose the name @groupissuescustomfields@ on purpose? Rails convention tends to lean more towards something like @group_issues_custom_fields@. I noticed that this seems a recurring theme with some more variables like @tid@, @gid@, @cfid@, @gp@, @cfs@, @cfp@, etc.
No, it's plain inexperience with Rails convention. Easy fix, though.

> * Where are full-width custom fields actually placed after your patch has been applied?
What I do is mix them (full-width custom fields) inbetween two column fields. They interrupt the flow of two column fields, go full width, and then the flow continues.
I just didn't like full-width custom fields being at the bottom.

Let me give an ordered example, how it works (comma separated fields are full with when they end with a 'w')
*Group A: f1, f2, f3w, f4, f5, f6, f7w, f8w f9*; the layout would be:
Group A
| f1 | f2 |
|\2. f3w |
| f4 | f6 |
| f5 | |
|\2. f7w |
|\2. f8w |
| f9 | |

> * In which cases is the wiki formatting toolbar actually provided?
As usual. If the formatting toolbar is set for the custom field, it shows above it, when editing the issue.

> * In the screenshots you've posted it looks like the right borders of field inputs are cutoff. I don't think that's intentional. Is this still present?
Could not reproduce it now. Maybe I fixed it after I took the screenshots, or the screenshots were (badly) edited for size. I can't recall, it was so long ago.

> * Do you see a way to extent this patch to also allow for grouping of default fields?
I never thought of that.
Custom fields's layout are a loop. I divide them in 3 categories: Redmine ordered, ordered but not grouped, grouped. I show these categories in that order.
Before layouting I know which custom fields would show.
Default fields code is different, the order and layout are hardcoded. I would have to break that into the layouting code, and the db layout points to the custom_field table.
Also, what if I add new fields to a project/tracker, should I put them at the end? If so I would have to mark they are ungrouped somehow, or else they would seem to be part of the last group.

> * Can you update the patch to apply to the (current) trunk?
Yes, if it doesn't already.

> * Can you confirm if the current test suite passes without failures/errors with your patch applied?
No, I can't. I use about a dozen plugins in production here, tests always fail. It may pass, I don't know if tests really care about the ordering of custom fields.

> * Can you provide (solid) test coverage for your changes (this would be required to get it integrated within the Redmine core)?
I don't know if I have the skill. Maybe, I can try.

--------------------------------------------------------------------------------
Frederico Camara wrote:
> Lúcia Rodrigues,
>
> Thanks for reporting. I think I fixed it in the code attached. Apply over previous patches.

Thank you Frederico for your quick support.
This fix works perfectly.
--------------------------------------------------------------------------------


related_issues

relates,New,35281,[Meta] (Issues) Custom (and Standard) Fields Grouping and Positioning

Admin Redmine さんがほぼ2年前に更新

  • カテゴリIssues_2 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0