Module: Webgit::GitHelper
- Defined in:
- app/helpers/webgit/git_helper.rb
Instance Method Summary collapse
- #git_blob_path(item) ⇒ Object
- #git_tree_path(item) ⇒ Object
- #navigation ⇒ Object
- #upper_path ⇒ Object
Instance Method Details
#git_blob_path(item) ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/helpers/webgit/git_helper.rb', line 27 def git_blob_path(item) if params[:path] webgit_blob_path(params[:branch], "#{params[:path]}/#{item}") else webgit_blob_path(params[:branch], item) end end |
#git_tree_path(item) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/webgit/git_helper.rb', line 19 def git_tree_path(item) if params[:path] webgit_tree_path(params[:branch], "#{params[:path]}/#{item}") else webgit_tree_path(params[:branch], item) end end |
#navigation ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/webgit/git_helper.rb', line 4 def ps = (params[:path] || "").split("/") i = -1 nav = ps.map do|p| i += 1 if i < ps.length - 1 link_to p, webgit_tree_path(params[:branch], ps[0..i].join('/')) else p end end.join(" / ") raw nav end |
#upper_path ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/helpers/webgit/git_helper.rb', line 35 def upper_path() paths = params[:path].try(:split, "/") if paths path_url = paths.tap{|ps|ps.pop}.join("/") end webgit_tree_path(params[:branch], path_url) end |