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

73 lines
2.3 KiB
Plaintext
Raw Normal View History

2012-01-26 23:13:19 +01:00
%ul.breadcrumb
2012-01-29 20:30:03 +01:00
%li
%span.arrow
= link_to tree_project_ref_path(@project, @ref, path: nil), remote: true do
= @project.name
2012-01-26 23:13:19 +01:00
- tree.breadcrumbs(6) do |link|
\/
%li= link
2011-11-01 21:11:24 +01:00
.clear
2012-01-29 20:30:03 +01:00
%div.tree_progress
2011-10-08 23:36:38 +02:00
#tree-content-holder
2011-11-20 21:32:12 +01:00
- if tree.is_blob?
= 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.bordered-table.table{class: "table_#{@hex_path}" }
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
= link_to "History", tree.history_path, class: "right"
2011-12-12 17:42:07 +01:00
2011-11-20 21:32:12 +01:00
- if tree.up_dir?
%tr{ class: "tree-item", url: tree.up_dir_path }
2011-10-08 23:36:38 +02:00
%td.tree-item-file-name
2012-03-12 22:52:10 +01:00
= image_tag "file_empty.png"
= link_to "..", tree.up_dir_path, remote: :true
%td
%td
2011-10-08 23:36:38 +02:00
- index = 0
2011-10-08 23:36:38 +02:00
- contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content|
= render partial: "refs/tree_item", locals: { content: content, index: (index += 1) }
2011-10-08 23:36:38 +02:00
- contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
= render partial: "refs/tree_item", locals: { content: content, index: (index += 1) }
2012-02-14 22:48:42 +01:00
- contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content|
= render partial: "refs/submodule_item", locals: { content: content, index: (index += 1) }
2011-10-08 23:36:38 +02:00
- if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first
2012-07-10 19:15:33 +02:00
.file_holder#README
.file_title
%i.icon-file
= content.name
.file_content.wiki
- if content.name =~ /\.(md|markdown)$/i
= preserve do
= markdown(content.data)
- else
= simple_format(content.data)
2011-12-12 17:42:07 +01:00
2011-10-08 23:36:38 +02:00
:javascript
$(function(){
2012-01-29 20:30:03 +01:00
$('.project-refs-select').chosen();
2012-07-10 21:52:38 +02:00
history.pushState({ path: this.path }, '', "#{@history_path}");
});
// Load last commit log for each file in tree
2012-07-10 21:52:38 +02:00
$(window).load(function(){
ajaxGet('#{@logs_path}');
2011-10-08 23:36:38 +02:00
});
2012-01-29 20:30:03 +01: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;}});