gitlabhq/app/views/refs/_tree.html.haml

61 lines
2.3 KiB
Plaintext
Raw Normal View History

2011-11-01 21:11:24 +01:00
-#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project
%a.right.button.blue{:href => "#"} EDIT
#tree-breadcrumbs
%h2.icon
%span
%d
2011-11-16 06:38:53 +01:00
= link_to tree_project_ref_path(@project, @ref, :path => nil), :remote => true do
2011-11-03 17:28:33 +01:00
= @project.name
2011-11-01 21:11:24 +01:00
- if params[:path]
- part_path = ""
- params[:path].split("\/").each do |part|
- part_path = File.join(part_path, part) unless part_path.empty?
- if part_path.empty?
- part_path = part
\/
2011-11-16 06:38:53 +01:00
= link_to truncate(part, :length => 40), tree_file_project_ref_path(@project, @ref, :path => part_path), :remote => :true
2011-11-03 17:28:33 +01:00
 
2011-11-16 18:19:18 +01:00
.right= render :partial => "projects/refs", :locals => { :destination => :tree }
2011-11-01 21:11:24 +01:00
.clear
2011-10-08 23:36:38 +02:00
#tree-content-holder
- if tree.is_a?(Grit::Blob)
2011-11-16 06:38:53 +01:00
= render :partial => "refs/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree }
2011-10-08 23:36:38 +02:00
- else
- contents = tree.contents
%table#tree-slider.round-borders
2011-11-01 21:11:24 +01:00
%thead
2011-10-08 23:36:38 +02:00
%th Name
%th Last Update
%th
Last commit
2011-11-16 06:38:53 +01:00
= link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "right"
2011-10-08 23:36:38 +02:00
- if params[:path]
- file = File.join(params[:path], "..")
2011-11-16 06:38:53 +01:00
%tr{ :class => "tree-item", :url => tree_file_project_ref_path(@project, @ref, file) }
2011-10-08 23:36:38 +02:00
%td.tree-item-file-name
= image_tag "dir.png"
2011-11-16 06:38:53 +01:00
= link_to "..", tree_file_project_ref_path(@project, @ref, file), :remote => :true
%td
%td
2011-10-08 23:36:38 +02:00
- contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content|
2011-11-16 06:38:53 +01:00
= render :partial => "refs/tree_item", :locals => { :content => content }
2011-10-08 23:36:38 +02:00
- contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
2011-11-16 06:38:53 +01:00
= render :partial => "refs/tree_item", :locals => { :content => content }
2011-10-08 23:36:38 +02:00
:javascript
$(function(){
$('select#branch').selectmenu({style:'popup', width:200});
$('select#tag').selectmenu({style:'popup', width:200});
});
- if params[:path] && request.xhr?
:javascript
2011-10-08 23:36:38 +02:00
$(window).unbind('popstate');
$(window).bind('popstate', function() {
if(location.pathname.search("tree") != -1) {
$.ajax({type: "GET", url: location.pathname, dataType: "script"})}
else { location.href = location.pathname;}});