Commit e51411ecc7c3dbb5b37af1f0d51b0a8118d6f8bd
1 parent
02448fce
Exists in
master
and in
4 other branches
Correct head titles for project pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
35 additions
and
1 deletions
Show diff stats
app/helpers/projects_helper.rb
@@ -143,4 +143,38 @@ module ProjectsHelper | @@ -143,4 +143,38 @@ module ProjectsHelper | ||
143 | # to calculate repo size - just show 'Unknown' | 143 | # to calculate repo size - just show 'Unknown' |
144 | 'unknown' | 144 | 'unknown' |
145 | end | 145 | end |
146 | + | ||
147 | + def project_head_title | ||
148 | + title = @project.name_with_namespace | ||
149 | + | ||
150 | + title = if current_controller?(:tree) | ||
151 | + "#{@project.path}\/#{@path} at #{@ref} - " + title | ||
152 | + elsif current_controller?(:issues) | ||
153 | + if current_action?(:show) | ||
154 | + "Issue ##{@issue.iid} - " + title | ||
155 | + else | ||
156 | + "Issues - " + title | ||
157 | + end | ||
158 | + elsif current_controller?(:blob) | ||
159 | + "#{@project.path}\/#{@blob.path} at #{@ref} - " + title | ||
160 | + elsif current_controller?(:commits) | ||
161 | + "Commits - " + title | ||
162 | + elsif current_controller?(:merge_requests) | ||
163 | + if current_action?(:show) | ||
164 | + "Merge request ##{@merge_request.iid} - " + title | ||
165 | + else | ||
166 | + "Merge requests - " + title | ||
167 | + end | ||
168 | + elsif current_controller?(:wikis) | ||
169 | + "Wiki - " + title | ||
170 | + elsif current_controller?(:network) | ||
171 | + "Network graph - " + title | ||
172 | + elsif current_controller?(:graphs) | ||
173 | + "Graphs - " + title | ||
174 | + else | ||
175 | + title | ||
176 | + end | ||
177 | + | ||
178 | + title | ||
179 | + end | ||
146 | end | 180 | end |
app/views/layouts/projects.html.haml
1 | !!! 5 | 1 | !!! 5 |
2 | %html{ lang: "en"} | 2 | %html{ lang: "en"} |
3 | - = render "layouts/head", title: @project.name_with_namespace | 3 | + = render "layouts/head", title: project_head_title |
4 | %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } | 4 | %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } |
5 | = render "layouts/broadcast" | 5 | = render "layouts/broadcast" |
6 | = render "layouts/head_panel", title: project_title(@project) | 6 | = render "layouts/head_panel", title: project_title(@project) |