diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-12-07 15:03:50 +0100 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-12-07 15:03:50 +0100 |
commit | e53b350cb6db7438c1a50c500b324fd87afc41c4 (patch) | |
tree | 61626047bbb7c248e1e245dc9dde291a9ae65b5a /app/helpers | |
parent | b2c4675cb0e681027334e5bd046451d3116924c8 (diff) | |
download | gitlab-ce-e53b350cb6db7438c1a50c500b324fd87afc41c4.tar.gz |
Add specs for showing lfs object in UI.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/blob_helper.rb | 14 | ||||
-rw-r--r-- | app/helpers/tree_helper.rb | 4 |
2 files changed, 17 insertions, 1 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index df5f5fae23c..fa1b2522051 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -30,7 +30,7 @@ module BlobHelper nil end - if blob && blob.text? + if blob && blob.text? && !blob.lfs_pointer? text = 'Edit' after = options[:after] || '' from_mr = options[:from_merge_request_id] @@ -71,4 +71,16 @@ module BlobHelper def blob_icon(mode, name) icon("#{file_type_icon_class('file', mode, name)} fw") end + + def viewable?(blob) + blob.text? && !blob.lfs_pointer? + end + + def blob_size(blob) + if blob.lfs_pointer? + blob.lfs_size + else + blob.size + end + end end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 03a49e119b8..6afa1aacc5b 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -54,6 +54,10 @@ module TreeHelper ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) end + def can_delete_or_replace?(blob) + allowed_tree_edit? && !blob.lfs_pointer? + end + def tree_breadcrumbs(tree, max_links = 2) if @path.present? part_path = "" |