debian-mirror-gitlab/app/serializers/detailed_status_entity.rb

34 lines
879 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2018-12-05 23:21:45 +05:30
class DetailedStatusEntity < Grape::Entity
2017-08-17 22:00:37 +05:30
include RequestAwareEntity
expose :icon, :text, :label, :group
2018-05-09 12:01:36 +05:30
expose :status_tooltip, as: :tooltip
2017-08-17 22:00:37 +05:30
expose :has_details?, as: :has_details
expose :details_path
2018-12-05 23:21:45 +05:30
expose :illustration do |status|
2019-05-18 00:54:41 +05:30
illustration = {
image: ActionController::Base.helpers.image_path(status.illustration[:image])
}
illustration = status.illustration.merge(illustration)
2018-12-05 23:21:45 +05:30
2019-05-18 00:54:41 +05:30
illustration
rescue NotImplementedError
# ignored
2018-12-05 23:21:45 +05:30
end
2017-08-17 22:00:37 +05:30
expose :favicon do |status|
2018-11-08 19:23:39 +05:30
Gitlab::Favicon.status_overlay(status.favicon)
2017-08-17 22:00:37 +05:30
end
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
2018-12-05 23:21:45 +05:30
expose :action_button_title, as: :button_title
2017-08-17 22:00:37 +05:30
end
end