summaryrefslogtreecommitdiff
path: root/app/helpers/tree_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r--app/helpers/tree_helper.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
new file mode 100644
index 00000000000..ed3053d8af5
--- /dev/null
+++ b/app/helpers/tree_helper.rb
@@ -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