summaryrefslogtreecommitdiff
path: root/app/serializers/status_entity.rb
blob: 6862730d9d2e20a801aa94baba167ef1b42118bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class StatusEntity < Grape::Entity
  include RequestAwareEntity

  format_with(:status_favicon_path) do |favicon_name|
    ci_status_favicon_path(favicon_name)
  end

  expose :icon, :text, :label, :group

  expose :has_details?, as: :has_details
  expose :details_path

  expose :favicon do |status|
    ActionController::Base.helpers.image_path(File.join('ci_favicons', "#{status.favicon}.ico"))
  end
end