tree_entity.rb 338 Bytes
Newer Older
1 2
# frozen_string_literal: true

3 4 5 6 7 8 9 10 11 12
class TreeEntity < Grape::Entity
  include RequestAwareEntity

  expose :id, :path, :name, :mode

  expose :icon do |tree|
    IconsHelper.file_type_icon_class('folder', tree.mode, tree.name)
  end

  expose :url do |tree|
13
    project_tree_path(request.project, File.join(request.ref, tree.path))
14 15
  end
end