Tree ajax log. progress bar & refactoring
This commit is contained in:
parent
1a2bacfb4b
commit
f88a2617e6
8 changed files with 53 additions and 18 deletions
|
@ -134,4 +134,8 @@ module ApplicationHelper
|
|||
end
|
||||
active ? "current" : nil
|
||||
end
|
||||
|
||||
def hexdigest(string)
|
||||
Digest::SHA1.hexdigest string
|
||||
end
|
||||
end
|
||||
|
|
27
app/helpers/tree_helper.rb
Normal file
27
app/helpers/tree_helper.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
module TreeHelper
|
||||
def tree_icon(content)
|
||||
if content.is_a?(Grit::Blob)
|
||||
if content.text?
|
||||
image_tag "file_txt.png"
|
||||
elsif content.image?
|
||||
image_tag "file_img.png"
|
||||
else
|
||||
image_tag "file_bin.png"
|
||||
end
|
||||
else
|
||||
image_tag "file_dir.png"
|
||||
end
|
||||
end
|
||||
|
||||
def tree_hex_class(content)
|
||||
"file_#{hexdigest(content.name)}"
|
||||
end
|
||||
|
||||
def tree_full_path(content)
|
||||
if params[:path]
|
||||
File.join(params[:path], content.name)
|
||||
else
|
||||
content.name
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue