gitlab-org--gitlab-foss/app/views/refs/_tree.html.haml

70 lines
2.4 KiB
Text
Raw Normal View History

2012-01-26 17:13:19 -05:00
%ul.breadcrumb
2012-01-29 14:30:03 -05:00
%li
%span.arrow
2012-01-11 02:35:21 -05:00
= link_to tree_project_ref_path(@project, @ref, :path => nil), :remote => true do
= @project.name
2012-01-26 17:13:19 -05:00
- tree.breadcrumbs(6) do |link|
\/
%li= link
2011-11-01 16:11:24 -04:00
.clear
2012-01-29 14:30:03 -05:00
%div.tree_progress
2011-10-08 17:36:38 -04:00
#tree-content-holder
2011-11-20 15:32:12 -05:00
- if tree.is_blob?
2011-11-16 00:38:53 -05:00
= render :partial => "refs/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree }
2011-10-08 17:36:38 -04:00
- else
- contents = tree.contents
2012-04-10 13:06:17 -04:00
%table#tree-slider.bordered-table.table
2011-11-01 16:11:24 -04:00
%thead
2011-10-08 17:36:38 -04:00
%th Name
%th Last Update
%th
Last commit
= link_to "History", tree.history_path, :class => "right"
2011-12-12 11:42:07 -05:00
2011-11-20 15:32:12 -05:00
- if tree.up_dir?
%tr{ :class => "tree-item", :url => tree.up_dir_path }
2011-10-08 17:36:38 -04:00
%td.tree-item-file-name
2012-03-12 17:52:10 -04:00
= image_tag "file_empty.png"
2011-11-20 15:32:12 -05:00
= link_to "..", tree.up_dir_path, :remote => :true
%td
%td
2011-10-08 17:36:38 -04:00
- contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content|
2011-11-16 00:38:53 -05:00
= render :partial => "refs/tree_item", :locals => { :content => content }
2011-10-08 17:36:38 -04:00
- contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
2011-11-16 00:38:53 -05:00
= render :partial => "refs/tree_item", :locals => { :content => content }
2012-02-14 16:48:42 -05:00
- contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content|
= render :partial => "refs/submodule_item", :locals => { :content => content }
2011-10-08 17:36:38 -04:00
- if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first
2011-12-12 11:42:07 -05:00
#tree-readme-holder
%h3= content.name
.readme
- if content.name =~ /\.(md|markdown)$/i
= preserve do
= markdown(content.data)
- else
2011-12-30 08:41:39 -05:00
= simple_format(content.data)
2011-12-12 11:42:07 -05:00
2012-01-29 14:30:03 -05:00
- if params[:path]
- history_path = tree_file_project_ref_path(@project, @ref, params[:path])
- else
- history_path = tree_project_ref_path(@project, @ref)
2011-10-08 17:36:38 -04:00
:javascript
$(function(){
$('select#branch').selectmenu({style:'popup', width:200});
$('select#tag').selectmenu({style:'popup', width:200});
2012-01-29 14:30:03 -05:00
$('.project-refs-select').chosen();
history.pushState({ path: this.path }, '', "#{history_path}")
2011-10-08 17:36:38 -04:00
});
2012-01-29 14:30:03 -05:00
- if params[:path] && request.xhr?
:javascript
$(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;}});