Module: ApprovalEngine::ApplicationHelper
- Defined in:
- app/helpers/approval_engine/application_helper.rb
Constant Summary collapse
- STATUS_TONES =
{ "pending" => "is-pending", "waiting" => "is-waiting", "approved" => "is-approved", "rejected" => "is-rejected", "changes_requested" => "is-changes-requested", "cancelled" => "is-cancelled", "quarantined" => "is-quarantined" }.freeze
Instance Method Summary collapse
Instance Method Details
#actor_label(actor) ⇒ Object
14 15 16 17 18 19 |
# File 'app/helpers/approval_engine/application_helper.rb', line 14 def actor_label(actor) return "—" if actor.nil? name = actor.try(:name) || actor.try(:email) || actor.try(:to_s) "#{actor.class.name}##{actor.id} (#{name})" end |
#status_badge(status) ⇒ Object
10 11 12 |
# File 'app/helpers/approval_engine/application_helper.rb', line 10 def status_badge(status) tag.span(status.to_s.tr("_", " "), class: "ae-badge #{STATUS_TONES.fetch(status.to_s, "is-pending")}") end |
#target_label(target) ⇒ Object
21 22 23 24 25 |
# File 'app/helpers/approval_engine/application_helper.rb', line 21 def target_label(target) return "—" if target.nil? "#{target.class.name}##{target.id}" end |