blob: 71d6835cb3142fd0f141c1693ba3fe11d1fa1f25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
class ProjectEntity < Grape::Entity
include ActionView::Helpers::NumberHelper
include RequestAwareEntity
expose :id, :name, :description, :visibility, :full_name, :full_path, :web_url,
:created_at, :updated_at, :star_count, :can_edit
def can_edit
return false unless request.respond_to?(:current_user)
can?(request.current_user, :edit_project, object)
end
expose :project_path do |project|
project_path(project)
end
expose :edit_path do |project|
edit_project_path(project)
end
expose :avatar_url do |project|
project.try(:avatar_url)
end
end
|