summaryrefslogtreecommitdiff
path: root/app/helpers/tree_helper.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-07-10 23:12:38 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-07-10 23:12:38 +0300
commitf88a2617e65ecc037d3f885965efcee39745163d (patch)
tree135d118cb7a5d9020ad411b0ce7d645aa88220c1 /app/helpers/tree_helper.rb
parent1a2bacfb4b4b8f4d79df0335b4daf1d2cfa16d88 (diff)
downloadgitlab-ce-f88a2617e65ecc037d3f885965efcee39745163d.tar.gz
Tree ajax log. progress bar & refactoring
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