Add render_tree helper; simplify (speed up) tree_icon
This commit is contained in:
parent
a8fad4ff9c
commit
388d72e6bf
6 changed files with 44 additions and 41 deletions
|
@ -14,7 +14,6 @@
|
|||
- if tree.is_blob?
|
||||
= render partial: "tree/tree_file", object: tree
|
||||
- else
|
||||
- contents = tree.contents
|
||||
%table#tree-slider{class: "table_#{@hex_path} tree-table" }
|
||||
%thead
|
||||
%th Name
|
||||
|
@ -24,22 +23,16 @@
|
|||
= link_to "History", tree.history_path, class: "right"
|
||||
|
||||
- if tree.up_dir?
|
||||
%tr{ class: "tree-item", url: tree.up_dir_path }
|
||||
%tr.tree-item
|
||||
%td.tree-item-file-name
|
||||
= image_tag "file_empty.png"
|
||||
= link_to "..", tree.up_dir_path, remote: :true
|
||||
= image_tag "file_empty.png", size: '16x16'
|
||||
= link_to "..", tree.up_dir_path, remote: true
|
||||
%td
|
||||
%td
|
||||
|
||||
- index = 0
|
||||
- contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content|
|
||||
= render partial: "tree/tree_item", locals: { content: content, index: (index += 1) }
|
||||
- contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
|
||||
= render partial: "tree/tree_item", locals: { content: content, index: (index += 1) }
|
||||
- contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content|
|
||||
= render partial: "tree/submodule_item", locals: { content: content, index: (index += 1) }
|
||||
= render_tree(tree.contents)
|
||||
|
||||
- if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first
|
||||
- if content = tree.contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }
|
||||
.file_holder#README
|
||||
.file_title
|
||||
%i.icon-file
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
- file = tree_full_path(content)
|
||||
%tr{ class: "tree-item #{tree_hex_class(content)}", url: project_tree_path(@project, tree_join(@id, file)) }
|
||||
%tr{ class: "tree-item #{tree_hex_class(tree_item)}" }
|
||||
%td.tree-item-file-name
|
||||
= tree_icon(content)
|
||||
%strong= link_to truncate(content.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, file)), remote: :true
|
||||
= tree_icon(type)
|
||||
%strong= link_to truncate(tree_item.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name)), remote: true
|
||||
%td.tree_time_ago.cgray
|
||||
- if index == 1
|
||||
%span.log_loading
|
||||
Loading commit data..
|
||||
= image_tag "ajax_loader_tree.gif", width: 14
|
||||
%span.log_loading.hide
|
||||
Loading commit data...
|
||||
= image_tag "ajax_loader_tree.gif", width: 14
|
||||
%td.tree_commit
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
:plain
|
||||
// Load Files list
|
||||
$("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {commit: @commit, tree: @tree}))}");
|
||||
$("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {tree: @tree}))}");
|
||||
$("#tree-content-holder").show("slide", { direction: "right" }, 150);
|
||||
$('.project-refs-form #path').val("#{@path}");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue