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|
|
|
|
|
begin
|
|
|
|
illustration = {
|
|
|
|
image: ActionController::Base.helpers.image_path(status.illustration[:image])
|
|
|
|
}
|
|
|
|
illustration = status.illustration.merge(illustration)
|
|
|
|
|
|
|
|
illustration
|
|
|
|
rescue NotImplementedError
|
|
|
|
# ignored
|
|
|
|
end
|
|
|
|
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
|