Support namespaced branches better in the commits/trees browser
[gitorious:gitorious-mrflip.git] / app / helpers / repositories_helper.rb
1 module RepositoriesHelper  
2   def log_path(objectish = "master", options = {})
3     if options.blank? # just to avoid the ? being tacked onto the url
4       project_repository_log_path(@project, @repository, objectish)
5     else
6       project_repository_log_path(@project, @repository, objectish, options)
7     end
8   end
9   
10   def commit_path(objectish = "master")
11     project_repository_commit_path(@project, @repository, objectish)
12   end
13   
14   def tree_path(treeish = "master", path=[])
15     if path.respond_to?(:to_str)
16       path = path.split("/")
17     end
18     project_repository_tree_path(@project, @repository, treeish, path)
19   end
20   
21   def archive_tree_path(treeish = "master")
22     project_repository_archive_tree_path(@project, @repository, treeish)
23   end
24   
25   def repository_path(action, sha1=nil)
26     project_repository_path(@project, @repository)+"/"+action+"/"+sha1.to_s
27   end
28   
29   def blob_path(sha1, path)
30     project_repository_blob_path(@project, @repository, sha1, path)
31   end
32   
33   def raw_blob_path(sha1, path)
34     project_repository_raw_blob_path(@project, @repository, sha1, path)
35   end
36   
37   def namespaced_branch?(branchname)
38     branchname.include?("/")
39   end
40 end