gitlab-org--gitlab-foss/app/serializers/detailed_status_entity.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
879 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class DetailedStatusEntity < Grape::Entity
include RequestAwareEntity
2017-04-13 06:09:20 -04:00
expose :icon, :text, :label, :group
expose :status_tooltip, as: :tooltip
expose :has_details?, as: :has_details
expose :details_path
2017-04-13 06:09:20 -04:00
expose :illustration do |status|
2019-03-13 09:42:43 -04:00
illustration = {
image: ActionController::Base.helpers.image_path(status.illustration[:image])
}
illustration = status.illustration.merge(illustration)
2019-03-13 09:42:43 -04:00
illustration
rescue NotImplementedError
# ignored
end
2017-04-13 07:14:31 -04:00
expose :favicon do |status|
Gitlab::Favicon.status_overlay(status.favicon)
2017-04-13 07:14:31 -04:00
end
2017-05-06 12:45:46 -04:00
expose :action, if: -> (status, _) { status.has_action? } do
expose :action_icon, as: :icon
expose :action_title, as: :title
expose :action_path, as: :path
expose :action_method, as: :method
expose :action_button_title, as: :button_title
2017-05-06 12:45:46 -04:00
end
end