Commit d89ae7df authored by Douwe Maan's avatar Douwe Maan

Move project header title definition to view in question.

parent f4816372
...@@ -31,12 +31,12 @@ module GroupsHelper ...@@ -31,12 +31,12 @@ module GroupsHelper
end end
end end
def group_title(group, name, url) def group_title(group, name = nil, url = nil)
full_title = link_to(simple_sanitize(group.name), group_path(group))
full_title += ' · '.html_safe + link_to(simple_sanitize(name), url) if name
content_tag :span do content_tag :span do
link_to( full_title
simple_sanitize(group.name), group_path(group)
) + ' · '.html_safe +
link_to(simple_sanitize(name), url)
end end
end end
end end
...@@ -317,41 +317,6 @@ module ProjectsHelper ...@@ -317,41 +317,6 @@ module ProjectsHelper
@ref || @repository.try(:root_ref) @ref || @repository.try(:root_ref)
end end
def detect_project_title(project)
name, url =
if current_controller? 'wikis'
['Wiki', get_project_wiki_path(project)]
elsif current_controller? 'project_members'
['Members', namespace_project_project_members_path(project.namespace, project)]
elsif current_controller? 'labels'
['Labels', namespace_project_labels_path(project.namespace, project)]
elsif current_controller? 'members'
['Members', project_files_path(project)]
elsif current_controller? 'commits'
['Commits', project_commits_path(project)]
elsif current_controller? 'graphs'
['Graphs', namespace_project_graph_path(project.namespace, project, current_ref)]
elsif current_controller? 'network'
['Network', namespace_project_network_path(project.namespace, project, current_ref)]
elsif current_controller? 'milestones'
['Milestones', namespace_project_milestones_path(project.namespace, project)]
elsif current_controller? 'snippets'
['Snippets', namespace_project_snippets_path(project.namespace, project)]
elsif current_controller? 'issues'
['Issues', namespace_project_issues_path(project.namespace, project)]
elsif current_controller? 'merge_requests'
['Merge Requests', namespace_project_merge_requests_path(project.namespace, project)]
elsif current_controller? 'tree', 'blob'
['Files', project_files_path(project)]
elsif current_path? 'projects#activity'
['Activity', activity_project_path(project)]
else
[nil, nil]
end
project_title(project, name, url)
end
private private
def filename_path(project, filename) def filename_path(project, filename)
......
- header_title group_title(@group, "Milestones", group_milestones_path(@group))
- page_title @group_milestone.title, "Milestones" - page_title @group_milestone.title, "Milestones"
= render "header_title"
%h4.page-title %h4.page-title
.issue-box{ class: "issue-box-#{@group_milestone.closed? ? 'closed' : 'open'}" } .issue-box{ class: "issue-box-#{@group_milestone.closed? ? 'closed' : 'open'}" }
- if @group_milestone.closed? - if @group_milestone.closed?
......
- page_title "Dashboard" - page_title "Dashboard"
- unless @header_title - header_title "Dashboard", root_path unless header_title
- header_title "Dashboard", root_path
- sidebar "dashboard" - sidebar "dashboard"
= render template: "layouts/application" = render template: "layouts/application"
- page_title @group.name - page_title @group.name
- unless @header_title - header_title group_title(@group) unless header_title
- header_title @group.name, group_path(@group) - sidebar "group" unless sidebar
- sidebar "group" unless sidebar
= render template: "layouts/application" = render template: "layouts/application"
- page_title "Settings" - page_title "Settings"
- header_title group_title(@group, "Settings", edit_group_path(@group))
- sidebar "group_settings" - sidebar "group_settings"
= render template: "layouts/group" = render template: "layouts/group"
- page_title "Profile Settings" - page_title "Profile Settings"
- unless @header_title - header_title "Profile Settings", profile_path unless header_title
- header_title "Profile Settings", profile_path
- sidebar "profile" - sidebar "profile"
= render template: "layouts/application" = render template: "layouts/application"
- page_title @project.name_with_namespace - page_title @project.name_with_namespace
- header_title detect_project_title(@project) - header_title project_title(@project) unless header_title
- sidebar "project" unless sidebar - sidebar "project" unless sidebar
- content_for :scripts_body_top do - content_for :scripts_body_top do
- if current_user - if current_user
......
- page_title "Settings" - page_title "Settings"
- header_title project_title(@project, "Settings", edit_project_path(@project))
- sidebar "project_settings" - sidebar "project_settings"
= render template: "layouts/project" = render template: "layouts/project"
- page_title "Activity" - page_title "Activity"
- header_title project_title(@project, "Activity", activity_project_path(@project))
= render 'projects/activity' = render 'projects/activity'
- page_title "Blame", @blob.path, @ref - page_title "Blame", @blob.path, @ref
- header_title project_title(@project, "Files", project_files_path(@project))
%h3.page-title Blame view %h3.page-title Blame view
#tree-holder.tree-holder #tree-holder.tree-holder
......
- header_title project_title(@project, "Files", project_files_path(@project))
- page_title "Edit", @blob.path, @ref - page_title "Edit", @blob.path, @ref
= render "header_title"
.file-editor .file-editor
%ul.center-top-menu.no-bottom.js-edit-mode %ul.center-top-menu.no-bottom.js-edit-mode
%li.active %li.active
......
- page_title "New File", @path.presence, @ref
= render "header_title"
.gray-content-block.top-block .gray-content-block.top-block
Create a new file or Create a new file or
= link_to 'upload', '#modal-upload-blob', = link_to 'upload', '#modal-upload-blob',
......
- page_title @blob.path, @ref - page_title @blob.path, @ref
= render "header_title"
= render 'projects/last_push' = render 'projects/last_push'
......
- page_title "Branches" - page_title "Branches"
= render "projects/commits/header_title"
= render "projects/commits/head" = render "projects/commits/head"
.gray-content-block .gray-content-block
.pull-right .pull-right
......
- page_title "New Branch" - page_title "New Branch"
= render "projects/commits/header_title"
- if @error - if @error
.alert.alert-danger .alert.alert-danger
%button{ type: "button", class: "close", "data-dismiss" => "alert"} × %button{ type: "button", class: "close", "data-dismiss" => "alert"} ×
......
- page_title "#{@commit.title} (#{@commit.short_id})", "Commits" - page_title "#{@commit.title} (#{@commit.short_id})", "Commits"
= render "projects/commits/header_title"
= render "commit_box" = render "commit_box"
= render "projects/diffs/diffs", diffs: @diffs, project: @project = render "projects/diffs/diffs", diffs: @diffs, project: @project
= render "projects/notes/notes_with_form", view: params[:view] = render "projects/notes/notes_with_form", view: params[:view]
- header_title project_title(@project, "Commits", project_commits_path(@project))
- page_title "Commits", @ref - page_title "Commits", @ref
= render "header_title"
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits") = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits")
......
- page_title "Compare" - page_title "Compare"
= render "projects/commits/header_title"
= render "projects/commits/head" = render "projects/commits/head"
.gray-content-block .gray-content-block
......
- page_title "#{params[:from]}...#{params[:to]}" - page_title "#{params[:from]}...#{params[:to]}"
= render "projects/commits/header_title"
= render "projects/commits/head" = render "projects/commits/head"
......
- header_title project_title(@project, "Graphs", namespace_project_graph_path(@project.namespace, @project, current_ref))
- page_title "Commit statistics" - page_title "Commits", "Graphs"
= render "header_title"
.tree-ref-holder .tree-ref-holder
= render 'shared/ref_switcher', destination: 'graphs_commits' = render 'shared/ref_switcher', destination: 'graphs_commits'
= render 'head' = render 'head'
......
- page_title "Contributor statistics" - page_title "Contributors", "Graphs"
= render "header_title"
.tree-ref-holder .tree-ref-holder
= render 'shared/ref_switcher', destination: 'graphs' = render 'shared/ref_switcher', destination: 'graphs'
= render 'head' = render 'head'
......
- header_title project_title(@project, "Issues", namespace_project_issues_path(@project.namespace, @project))
- page_title "Issues" - page_title "Issues"
= render "header_title"
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") = auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
......
- page_title "New Issue" - page_title "New Issue"
= render "header_title"
= render "form" = render "form"
- page_title "#{@issue.title} (##{@issue.iid})", "Issues" - page_title "#{@issue.title} (##{@issue.iid})", "Issues"
= render "header_title"
.issue .issue
.issue-details.issuable-details .issue-details.issuable-details
.page-title .page-title
......
- header_title project_title(@project, "Labels", namespace_project_labels_path(@project.namespace, @project))
- page_title "Edit", @label.name, "Labels" - page_title "Edit", @label.name, "Labels"
= render "header_title"
%h3 %h3
Edit label Edit label
%span.light #{@label.name} %span.light #{@label.name}
......
- page_title "Labels" - page_title "Labels"
= render "header_title"
.gray-content-block.top-block .gray-content-block.top-block
- if can? current_user, :admin_label, @project - if can? current_user, :admin_label, @project
......
- page_title "New Label" - page_title "New Label"
= render "header_title"
%h3 New label %h3 New label
.back-link .back-link
= link_to namespace_project_labels_path(@project.namespace, @project) do = link_to namespace_project_labels_path(@project.namespace, @project) do
......
- header_title project_title(@project, "Merge Requests", namespace_project_merge_requests_path(@project.namespace, @project))
- page_title "#{@merge_request.title} (##{@merge_request.iid})", "Merge Requests" - page_title "#{@merge_request.title} (##{@merge_request.iid})", "Merge Requests"
= render "header_title"
- if params[:view] == 'parallel' - if params[:view] == 'parallel'
- fluid_layout true - fluid_layout true
......
- page_title "Edit", "#{@merge_request.title} (##{@merge_request.iid})", "Merge Requests" - page_title "Edit", "#{@merge_request.title} (##{@merge_request.iid})", "Merge Requests"
= render "header_title"
%h3.page-title %h3.page-title
= "Edit merge request ##{@merge_request.iid}" = "Edit merge request ##{@merge_request.iid}"
%hr %hr
......
- page_title "Merge Requests" - page_title "Merge Requests"
= render "header_title"
= render 'projects/last_push' = render 'projects/last_push'
.project-issuable-filter .project-issuable-filter
.controls .controls
......
- page_title "#{@merge_request.title} (##{@merge_request.iid})", "Merge Requests" - page_title "#{@merge_request.title} (##{@merge_request.iid})", "Merge Requests"
= render "header_title"
.merge-request .merge-request
= render "projects/merge_requests/show/mr_title" = render "projects/merge_requests/show/mr_title"
= render "projects/merge_requests/show/mr_box" = render "projects/merge_requests/show/mr_box"
......
- page_title "New Merge Request" - page_title "New Merge Request"
= render "header_title"
- if @merge_request.can_be_created - if @merge_request.can_be_created
= render 'new_submit' = render 'new_submit'
- else - else
......
- header_title project_title(@project, "Milestones", namespace_project_milestones_path(@project.namespace, @project))
- page_title "Edit", @milestone.title, "Milestones" - page_title "Edit", @milestone.title, "Milestones"
= render "header_title"
= render "form" = render "form"
- page_title "Milestones" - page_title "Milestones"
= render "header_title"
= render 'shared/milestones_filter' = render 'shared/milestones_filter'
.gray-content-block .gray-content-block
......
- page_title "New Milestone" - page_title "New Milestone"
= render "header_title"
= render "form" = render "form"
- page_title @milestone.title, "Milestones" - page_title @milestone.title, "Milestones"
= render "header_title"
%h4.page-title %h4.page-title
.issue-box{ class: issue_box_class(@milestone) } .issue-box{ class: issue_box_class(@milestone) }
- if @milestone.closed? - if @milestone.closed?
......
- page_title "Network", @ref - page_title "Network", @ref
= header_title project_title(@project, "Network", namespace_project_network_path(@project.namespace, @project, current_ref))
= render "head" = render "head"
.project-network .project-network
.controls .controls
......
- header_title project_title(@project, "Members", namespace_project_project_members_path(@project.namespace, @project))
- page_title "Import members" - page_title "Import members"
= render "header_title"
%h3.page-title %h3.page-title
Import members from another project Import members from another project
%p.light %p.light
......
- page_title "Members" - page_title "Members"
= render "header_title"
.gray-content-block.top-block .gray-content-block.top-block
.clearfix.js-toggle-container .clearfix.js-toggle-container
......
- header_title project_title(@project, "Snippets", namespace_project_snippets_path(@project.namespace, @project))
- page_title "Edit", @snippet.title, "Snippets" - page_title "Edit", @snippet.title, "Snippets"
= render "header_title"
%h3.page-title %h3.page-title
Edit snippet Edit snippet
%hr %hr
......
- page_title "Snippets" - page_title "Snippets"
= render "header_title"
%h3.page-title %h3.page-title
Snippets Snippets
- if can? current_user, :create_project_snippet, @project - if can? current_user, :create_project_snippet, @project
......
- page_title "New Snippets" - page_title "New Snippets"
= render "header_title"
%h3.page-title %h3.page-title
New snippet New snippet
%hr %hr
......
- page_title @snippet.title, "Snippets" - page_title @snippet.title, "Snippets"
= render "header_title"
%h3.page-title %h3.page-title
= @snippet.title = @snippet.title
......
- page_title "Tags" - page_title "Tags"
= render "projects/commits/header_title"
= render "projects/commits/head" = render "projects/commits/head"
.gray-content-block .gray-content-block
......
- page_title "New Tag" - page_title "New Tag"
= render "projects/commits/header_title"
- if @error - if @error
.alert.alert-danger .alert.alert-danger
%button{ type: "button", class: "close", "data-dismiss" => "alert"} × %button{ type: "button", class: "close", "data-dismiss" => "alert"} ×
......
- page_title @path.presence || "Files", @ref - page_title @path.presence || "Files", @ref
- header_title project_title(@project, "Files", project_files_path(@project))
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits") = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits")
......
- header_title project_title(@project, 'Wiki', get_project_wiki_path(@project))
- page_title "Edit", @page.title, "Wiki" - page_title "Edit", @page.title, "Wiki"
= render "header_title"
= render 'nav' = render 'nav'
.pull-right .pull-right
= render 'main_links' = render 'main_links'
......
- page_title "Wiki" - page_title "Wiki"
= render "header_title"
%h3.page-title Empty page %h3.page-title Empty page
%hr %hr
.error_message .error_message
......
- page_title "Git Access", "Wiki" - page_title "Git Access", "Wiki"
= render "header_title"
= render 'nav' = render 'nav'
.gray-content-block .gray-content-block
.row .row
......
- page_title "History", @page.title, "Wiki" - page_title "History", @page.title.capitalize, "Wiki"
= render "header_title"
= render 'nav' = render 'nav'
.gray-content-block .gray-content-block
%h3.page-title %h3.page-title
......
- page_title "All Pages", "Wiki" - page_title "All Pages", "Wiki"
= render "header_title"
= render 'nav' = render 'nav'
.gray-content-block .gray-content-block
%h3.page-title %h3.page-title
......
- page_title @page.title, "Wiki" - page_title @page.title.capitalize, "Wiki"
= render "header_title"
= render 'nav' = render 'nav'
.gray-content-block .gray-content-block
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment