Project

General

Profile

Actions

Patch #1746

closed

Patch for #1738; Add a "Hide on overview tab" flag to project custom fields

Added by Mischa The Evil over 15 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Custom fields
Target version:
-
Start date:
2008-08-05
Due date:
% Done:

0%

Estimated time:

Description

Here is a quick patch for adding a "Hide from Overview" flag to project custom fields. As it's name states it adds a new flag to project's custom fields which lets the user decide if the project's custom field is showned on the project's overview page.
This feature comes in handy combined with the use of several plugins which stores info/settings in project's custom fields (like redmine_tab, googlecalendar...). Now it is possible to hide the fields which are used for those plugins only.

This patch resolves feature-request #1738. It is created against r1715 of the trunk.

This patch includes a schema-change, 3 changes to some views and a change to the english language file. It doesn't provide translations for other languages than english. It also does not provide any (modified) (unit-)tests since afaics these are not affected.

Note: since this patch includes a schema-change it is required to migrate your database after applying this patch (using rake db:migrate RAILS_ENV="production").

Disclaimer: This patch is provided by a RoR-newbie with a basic structural-PHP background only!


Files

add_project-custom-field_hide.patch (3.21 KB) add_project-custom-field_hide.patch Mischa The Evil, 2008-08-05 04:53
add_project-custom-field_hide-r2641.patch (3.19 KB) add_project-custom-field_hide-r2641.patch Patch based on trunk @ r2641 Mischa The Evil, 2009-03-29 21:48

Related issues

Related to Redmine - Feature #4298: An "internal" option for custom fieldsClosed2009-11-27

Actions
Related to Redmine - Feature #1738: Add a "Visible" flag to project/user custom fieldsClosed2008-08-03

Actions
Actions #1

Updated by Eric Davis over 15 years ago

It also does not provide any (modified) (unit-)tests since afaics these are not affected.

Could you provide tests that verify a field is hidden in the view?

Actions #2

Updated by Mischa The Evil over 15 years ago

Eric Davis wrote:

It also does not provide any (modified) (unit-)tests since afaics these are not affected.

Could you provide tests that verify a field is hidden in the view?

Due to my lack of knowledge I'm afraid I can't provide any tests. The only 'verification' I can provide now are the words that it works on my internal test deployment. Are you maybe able to help me a hand to point me in the right direction? I'm on IRC rightnow.

Actions #3

Updated by Eric Davis over 15 years ago

  • Status changed from New to 7
  • Assignee set to Eric Davis
  • Target version deleted (0.8)

Mischa The Evil wrote:

Due to my lack of knowledge I'm afraid I can't provide any tests. The only 'verification' I can provide now are the words that it works on my internal test deployment. Are you maybe able to help me a hand to point me in the right direction? I'm on IRC rightnow.

I'll give you a hand with some tests for this.

Actions #4

Updated by Mischa The Evil about 15 years ago

Attached a rebased patch against Redmine trunk at r2641.

Actions #5

Updated by Michael Aye about 15 years ago

Trying to apply this to a 0.8-stable SVN checkout I find, that there is no index.rhtml in views/custom_fields.
Should I not mind or do I have to apply it somewhere else?

Actions #6

Updated by Mischa The Evil about 15 years ago

Michael Aye wrote:

Trying to apply this to a 0.8-stable SVN checkout I find, that there is no index.rhtml in views/custom_fields.
Should I not mind or do I have to apply it somewhere else?

This is due the changes between current trunk and the 0.8-stable branch. You probably could better start with the older version of the patch (add_project-custom-field_hide.patch) instead of the rebased patch against trunk at r2641 (add_project-custom-field_hide-r2641.patch) since that one is based on r1715 which is more close to 0.8-stable...

Let me know if you run into troubles... :)

Actions #7

Updated by Akiko Takano almost 15 years ago

Hello, everyone.

I do hope Redmine trunk takes in this feature(patch) and this will make users more easier to create various plugins.
How about?

Actions #8

Updated by hanjiang zheng over 14 years ago

i had chang my file as add_project-custom-field_hide.patch
but have this problems
1.i can not find file "096_add_custom_field_hide.rb" only find file "096_add_custom_field_hide.rb"
2. i change 096_add_custom_field_hide.rb like 096_add_custom_field_hide.rb
and view the project in web the redmine show :
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.

and the contorl show :

Processing ProjectsController#show (for 192.168.1.49 at 2009-08-10 13:35:23) [GET
]
Session ID: c473349008a49db6ac913ed43f55222e
Parameters: {"action"=>"show", "id"=>"test11", "controller"=>"projects"}
Rendering template within layouts/base
Rendering projects/show

ActionView::TemplateError (undefined method `hide?' for #<ProjectCustomField:0xa
8f12f4>) on line #14 of projects/show.rhtml:
11: <li><%=l(:field_parent)%>: <%= link_to h(@project.parent.name), :control
ler => 'projects', :action => 'show', :id => @project.parent ></li>
12: <
end >
13: <
@project.custom_values.each do |custom_value| >
14: <
if !custom_value.value.empty? && !custom_value.custom_field.hide? >
15: <li><
= custom_value.custom_field.name%>: <%=h show_value(custom_valu
e) ></li>
16: <
end >
17: <
end %>

vendor/rails/activerecord/lib/active_record/attribute_methods.rb:251:in `met
hod_missing'
vendor/rails/activerecord/lib/active_record/associations/association_proxy.r
b:173:in `send'
vendor/rails/activerecord/lib/active_record/associations/association_proxy.r
b:173:in `method_missing'
app/views/projects/show.rhtml:14:in `_run_erb_47app47views47projects47show46
rhtml'
vendor/rails/activerecord/lib/active_record/associations/association_collect
ion.rb:277:in `method_missing'
vendor/rails/activerecord/lib/active_record/associations/association_proxy.r
b:171:in `method_missing'
vendor/rails/activerecord/lib/active_record/associations/association_proxy.r
b:171:in `each'
vendor/rails/activerecord/lib/active_record/associations/association_proxy.r
b:171:in `send'
vendor/rails/activerecord/lib/active_record/associations/association_proxy.r
b:171:in `method_missing'
vendor/rails/activerecord/lib/active_record/associations/association_collect
ion.rb:277:in `method_missing'
app/views/projects/show.rhtml:13:in `_run_erb_47app47views47projects47show46
rhtml'
vendor/rails/actionpack/lib/action_view/base.rb:342:in `send'
vendor/rails/actionpack/lib/action_view/base.rb:342:in `execute'
vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb:29:i
n `send'
vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb:29:i
n `render'
vendor/rails/actionpack/lib/action_view/template.rb:35:in `render'
vendor/rails/actionpack/lib/action_view/template.rb:22:in `render_template'
vendor/rails/actionpack/lib/action_view/base.rb:248:in `render_file'
vendor/rails/actionpack/lib/action_controller/base.rb:1112:in `render_for_fi
le'
vendor/rails/actionpack/lib/action_controller/base.rb:845:in `render_with_no
_layout'
vendor/rails/actionpack/lib/action_controller/layout.rb:251:in `render_witho
ut_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in `re
altime'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
vendor/rails/actionpack/lib/action_controller/base.rb:1161:in `default_rende
r'
vendor/rails/actionpack/lib/action_controller/base.rb:1167:in `perform_actio
n_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filter
s'
vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_act
ion_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform
_action_without_rescue'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `meas
ure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform
_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_acti
on_without_caching'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `pe
rform_action'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/que
ry_cache.rb:33:in `cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `pe
rform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_withou
t_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_wit
hout_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `
process'
vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_r
equest'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch
'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchron
ize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch
'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch
_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/rails.rb:76:in `process'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/rails.rb:74:in `synchronize'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/rails.rb:74:in `process'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:159:in `process_client'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:158:in `each'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:158:in `process_client'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:285:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:285:in `initialize'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:285:in `new'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:285:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:268:in `initialize'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:268:in `new'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel.rb:268:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/configurator.rb:282:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/configurator.rb:281:in `each'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/configurator.rb:281:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/bin/mongrel_rails:128:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/lib/mongrel/command.rb:212:in `run'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x
86-mswin32-60/bin/mongrel_rails:281
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_co
nstants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load'
vendor/rails/railties/lib/commands/servers/mongrel.rb:64
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom
_require.rb:31:in `gem_original_require'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom
_require.rb:31:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `requir
e'
vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_co
nstants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `requir
e'
vendor/rails/railties/lib/commands/server.rb:39
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom
_require.rb:31:in `gem_original_require'
F:/backup/3_redmine/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom
_require.rb:31:in `require'
script/server:3

Rendering F:/backup/3_redmine/InstantRails/rails_apps/redmine084/public/500.html
(500 Internal Server Error)

what am i forgot ??
Thanks

Actions #9

Updated by hanjiang zheng over 14 years ago

sorry my Redmine Version is 0.8.4

Actions #10

Updated by Mischa The Evil over 14 years ago

hanjiang zheng wrote:

1.i can not find file "096_add_custom_field_hide.rb" only find file "096_add_custom_field_hide.rb"

I think you meant to say that you've found the file: 096_add_commit_access_permission.rb ?? :)

hanjiang zheng wrote:

2. i change "096_add_custom_field_hide.rb" like "096_add_custom_field_hide.rb"

Change that to 102_add_custom_field_hide.rb, followed by a db-migration (by running the command "rake db:migrate RAILS_ENV="production"" under the Redmine root directory) and your problem will be solved I guess... Though maybe a restart of Redmine is required... :S

Kind regards,

Mischa.

Actions #11

Updated by Nanda P over 14 years ago

Any idea, when this patch will be updated into trunk?

Actions #12

Updated by Jan from Planio www.plan.io about 14 years ago

i've had the same issue and wasn't aware of this thread. here's my take on this (only concept, no implementation, though) #4298

Actions #13

Updated by Billy T almost 14 years ago

Please add this patch to the trunk

Thank you

Actions #14

Updated by Billy T almost 14 years ago

path for trunk is rejected by redmine

 patch -p0 < add_project-custom-field_hide-r2641.patch
(Stripping trailing CRs from patch.)
patching file app/views/custom_fields/_form.rhtml
Hunk #1 succeeded at 94 with fuzz 2 (offset 4 lines).
(Stripping trailing CRs from patch.)
patching file app/views/custom_fields/index.rhtml
Hunk #1 FAILED at 20.
Hunk #2 FAILED at 33.
2 out of 2 hunks FAILED -- saving rejects to file app/views/custom_fields/index.rhtml.rej
(Stripping trailing CRs from patch.)
patching file app/views/projects/show.rhtml
Hunk #1 FAILED at 9.
1 out of 1 hunk FAILED -- saving rejects to file app/views/projects/show.rhtml.rej
(Stripping trailing CRs from patch.)
patching file config/locales/en.yml
Hunk #1 FAILED at 242.
1 out of 1 hunk FAILED -- saving rejects to file config/locales/en.yml.rej
(Stripping trailing CRs from patch.)
patching file db/migrate/20090329181700_add_custom_field_hide.rb
Actions #15

Updated by Eric Davis over 13 years ago

  • Assignee deleted (Eric Davis)
Actions #16

Updated by Jean-Philippe Lang over 13 years ago

  • Status changed from 7 to Closed

Feature was added in r4382.

Actions #17

Updated by Mischa The Evil over 13 years ago

Jean-Philippe Lang wrote:

Feature was added in r4382.

Thanks alot!

Actions #18

Updated by Toshi MARUYAMA over 10 years ago

  • Related to Feature #1738: Add a "Visible" flag to project/user custom fields added
Actions

Also available in: Atom PDF