Howto add a logo to your Redmine banner » History » Version 37

Toshi MARUYAMA, 2017-06-20 16:23
code highlight and command prompt

1 6 Mischa The Evil
h1. HowTo add a logo to your Redmine banner
2 6 Mischa The Evil
3 35 Mischa The Evil
You can very easily add a logo to your Redmine banner by modifying your base.html.erb file.
4 6 Mischa The Evil
Big thanks to "Chris Miller":/users/758 for showing me how to accomplish this :)
5 6 Mischa The Evil
6 6 Mischa The Evil
Note: This has been tested using the Squeejee Theme and the Classic Theme.
7 9 Vojtěch Horký
Note2: if you used apache2 passenger module to install redmine,the location of redmine should be @/usr/share/redmine@ instead of @/opt/redmine@
8 1 Aaron Johnson
9 35 Mischa The Evil
h2. Edit your @base.html.erb@ file
10 6 Mischa The Evil
11 37 Toshi MARUYAMA
Example:
12 37 Toshi MARUYAMA
<pre>
13 37 Toshi MARUYAMA
# nano /opt/redmine/app/views/layouts/base.html.erb
14 37 Toshi MARUYAMA
</pre>
15 1 Aaron Johnson
16 37 Toshi MARUYAMA
Find this line:
17 37 Toshi MARUYAMA
<pre><code class="erb">
18 37 Toshi MARUYAMA
    <h1><%= page_header_title %></h1>
19 37 Toshi MARUYAMA
</code></pre>
20 10 Peter Englmaier
21 37 Toshi MARUYAMA
Add this line directly above:
22 37 Toshi MARUYAMA
<pre><code class="erb">
23 37 Toshi MARUYAMA
     <img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/></code></pre>
24 10 Peter Englmaier
25 6 Mischa The Evil
The ruby statement @<%= Redmine::Utils.relative_url_root %>@ will produce the relative URI for your redmine installation.
26 36 user 42
27 1 Aaron Johnson
28 37 Toshi MARUYAMA
Now it should look like this:
29 37 Toshi MARUYAMA
<pre><code class="erb">
30 1 Aaron Johnson
    </div>
31 1 Aaron Johnson
32 1 Aaron Johnson
     <img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/>
33 1 Aaron Johnson
     <h1><%= page_header_title %></h1>
34 1 Aaron Johnson
35 37 Toshi MARUYAMA
    <% if display_main_menu?(@project) %>
36 37 Toshi MARUYAMA
</code></pre>
37 6 Mischa The Evil
38 35 Mischa The Evil
h2. Upload your logo
39 1 Aaron Johnson
40 37 Toshi MARUYAMA
Example using the scp command:
41 37 Toshi MARUYAMA
<pre>
42 37 Toshi MARUYAMA
# scp logo.png root@example.com:/opt/redmine/public/images
43 37 Toshi MARUYAMA
</pre>
44 1 Aaron Johnson
45 37 Toshi MARUYAMA
You probably should chown the uploaded logo:
46 37 Toshi MARUYAMA
<pre>
47 37 Toshi MARUYAMA
# chown redmine:redmine /opt/redmine/public/images/logo.png
48 37 Toshi MARUYAMA
</pre>
49 6 Mischa The Evil
50 6 Mischa The Evil
h2. Restart your web server
51 6 Mischa The Evil
52 37 Toshi MARUYAMA
Examples:
53 37 Toshi MARUYAMA
<pre>
54 37 Toshi MARUYAMA
# /etc/init.d/apache2 restart
55 37 Toshi MARUYAMA
# /etc/init.d/httpd restart
56 37 Toshi MARUYAMA
# /etc/init.d/nginx restart
57 37 Toshi MARUYAMA
</pre>