官术网_书友最值得收藏!

Customizing the layout of the project entry page

If built-in customizations don't fit your needs and you need to edit Redmine's views manually for some reason, this recipe will show you how to make New project private in Redmine, and how to remove the Homepage field on the New project creation form.

Getting ready

Make sure that you have access to your working Redmine installation.

How to do it…

To accomplish the goal of making the project private by default by having the checkbox at the project creation form unchecked by default in Redmine, you need to navigate to Administration | Settings | Projects. Untick the New projects are public by default checkbox, and click Save.

To hide the Homepage textbox and label, use your favorite code editor with Ruby highlight, navigate with the file browser or via the command line to your Redmine installation folder, open redmine/app/views/projects/_form.html.erb, find the line containing <p><%= f.text_field :homepage, :size => 60 %></p>, and delete it. Restart Redmine and make sure that the creation of new projects change is reflected, as in the following screenshot:

How it works…

What we did here is deliberately combine built-in Redmine feature customization with code editing customization so that you learn to seek for built-in customizations before reaching out for the code editor. Therefore, first, we navigate to the Settings menu and disable the active checkbox for projects to be public. So, from now on, without restarting Redmine on a new project entry form, the Public checkbox will be unchecked by default. After this, we used a code editor and edited the app/views/projects/_form.html.erb file by removing the line that displays the Homepage field, and restarted Redmine to reflect this update.

There's more…

If you need to change the Issue entry form or any other form, you can use this same principle. Just find the view files that you need to edit, make the customization, restart Redmine, and view your change.

See also

Refer to the Starting and Restarting Redmine recipe from Chapter 5, Regular and Planned Maintenance.

主站蜘蛛池模板: 大石桥市| 永州市| 北川| 广西| 屏东县| 阿尔山市| 铜川市| 剑川县| 沐川县| 儋州市| 安庆市| 鲜城| 东莞市| 怀仁县| 河源市| 新民市| 天镇县| 黄陵县| 永新县| 云南省| 平山县| 铁力市| 中宁县| 佳木斯市| 夏邑县| 新竹县| 江西省| 桂平市| 金昌市| 徐水县| 依兰县| 同江市| 融水| 曲松县| 五原县| 岢岚县| 红原县| 宁津县| 绵阳市| 化州市| 漯河市|