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