Tree ajax log. progress bar & refactoring

This commit is contained in:
Dmitriy Zaporozhets 2012-07-10 23:12:38 +03:00
parent 1a2bacfb4b
commit f88a2617e6
8 changed files with 53 additions and 18 deletions

View file

@ -134,4 +134,8 @@ module ApplicationHelper
end
active ? "current" : nil
end
def hexdigest(string)
Digest::SHA1.hexdigest string
end
end

View 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