Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-15 23:40:35 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-15 23:40:35 +0300
commite21deaee8ee0d453bf899c1b3fb46262cc60dab9 (patch)
tree59b04c9cb1c8ce6c510a78ee787fb31817619835 /app/helpers
parent7e2dbcbe0915cfd75e91d78e943c153f284df37d (diff)
parent0ad669bb5ba08d012d3daa50b51a3a6b069e3e83 (diff)
Merge remote-tracking branch 'origin/master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g
# Conflicts: # Gemfile.lock
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/gitlab_routing_helper.rb8
-rw-r--r--app/helpers/projects_helper.rb71
3 files changed, 63 insertions, 18 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a803b66c502..c3da54fd554 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -201,7 +201,7 @@ module ApplicationHelper
class: "#{html_class} js-timeago",
datetime: time.getutc.iso8601,
title: time.in_time_zone.stamp('Aug 21, 2011 9:23pm'),
- data: { toggle: 'tooltip', placement: placement }
+ data: { toggle: 'tooltip', placement: placement, container: 'body' }
element += javascript_tag "$('.js-timeago').timeago()" unless skip_js
diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb
index d0fae255a04..e0816f4e714 100644
--- a/app/helpers/gitlab_routing_helper.rb
+++ b/app/helpers/gitlab_routing_helper.rb
@@ -17,6 +17,14 @@ module GitlabRoutingHelper
namespace_project_path(project.namespace, project, *args)
end
+ def project_files_path(project, *args)
+ namespace_project_tree_path(project.namespace, project, @ref || project.repository.root_ref)
+ end
+
+ def project_commits_path(project, *args)
+ namespace_project_commits_path(project.namespace, project, @ref || project.repository.root_ref)
+ end
+
def activity_project_path(project, *args)
activity_namespace_project_path(project.namespace, project, *args)
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index ab9b068de05..6a2de0de77c 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -43,24 +43,22 @@ module ProjectsHelper
end
end
- def project_title(project)
- if project.group
- content_tag :span do
- link_to(
- simple_sanitize(project.group.name), group_path(project.group)
- ) + ' / ' +
- link_to(simple_sanitize(project.name),
- project_path(project))
- end
- else
- owner = project.namespace.owner
- content_tag :span do
- link_to(
- simple_sanitize(owner.name), user_path(owner)
- ) + ' / ' +
- link_to(simple_sanitize(project.name),
- project_path(project))
+ def project_title(project, name = nil, url = nil)
+ namespace_link =
+ if project.group
+ link_to(simple_sanitize(project.group.name), group_path(project.group))
+ else
+ owner = project.namespace.owner
+ link_to(simple_sanitize(owner.name), user_path(owner))
end
+
+ project_link = link_to(simple_sanitize(project.name), project_path(project))
+
+ full_title = namespace_link + ' / ' + project_link
+ full_title += ' &middot; '.html_safe + link_to(simple_sanitize(name), url) if name
+
+ content_tag :span do
+ full_title
end
end
@@ -315,6 +313,45 @@ module ProjectsHelper
end
end
+ def current_ref
+ @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)