summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-25 19:34:16 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-25 19:34:16 -0800
commit1da71cc520dd09098d8f756de3f58b8e2f153fcd (patch)
tree4f78552d8e11d2e185f2c7e944f049459a507d90 /app/helpers
parentcd6baa141528f6d4e676715c2d3995fdc05e9544 (diff)
downloadgitlab-ce-1da71cc520dd09098d8f756de3f58b8e2f153fcd.tar.gz
Introduce shortcuts for routing helpers
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/gitlab_routing_helper.rb18
-rw-r--r--app/helpers/projects_helper.rb4
2 files changed, 20 insertions, 2 deletions
diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb
new file mode 100644
index 00000000000..932e0d29149
--- /dev/null
+++ b/app/helpers/gitlab_routing_helper.rb
@@ -0,0 +1,18 @@
+# Shorter routing method for project and project items
+module GitlabRoutingHelper
+ def project_path(project, *args)
+ namespace_project_path(project.namespace, project, *args)
+ end
+
+ def edit_project_path(project, *args)
+ edit_namespace_project_path(project.namespace, project, *args)
+ end
+
+ def issue_path(entity, *args)
+ namespace_project_issue_path(entity.project.namespace, entity.project, entity, *args)
+ end
+
+ def merge_request_path(entity, *args)
+ namespace_project_merge_request_path(entity.project.namespace, entity.project, entity, *args)
+ end
+end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index c85ad12634d..a5d7372bbe5 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -46,7 +46,7 @@ module ProjectsHelper
simple_sanitize(project.group.name), group_path(project.group)
) + ' / ' +
link_to(simple_sanitize(project.name),
- namespace_project_path(project.namespace, project))
+ project_path(project))
end
else
owner = project.namespace.owner
@@ -55,7 +55,7 @@ module ProjectsHelper
simple_sanitize(owner.name), user_path(owner)
) + ' / ' +
link_to(simple_sanitize(project.name),
- namespace_project_path(project.namespace, project))
+ project_path(project))
end
end
end