161925ab2b
* main: (100 commits) Fix notification broadcast test for turbo-rails 2.0.21 Update `turbo-rails` to get latest Turbo version Remove reference to removed controller Fix bad formatting on bridge page title attr Use private functions for bridge components Setup focus handling on touch target's connect callback Setup proper focus handling for mobile on the card perma's board picker Move dialog focus handling into the dialog controller Create popup initial alignment classes Fix class typo Hide the board selector button if card is closed Align board and tag picker dialogs without using math Add dialog manager to card perma Fix "M" hotkey using stale user from fragment cache Solve problem when Action Text raises on missing attachables Solve problem when Action Text raises on missing attachables Completing a step removes stalled status from UI Bump Bootsnap to v1.21.1 Add Enable all/Disable all buttons to webhook event selection Use correct class selectors to target cards with background images ...
33 lines
1.2 KiB
Ruby
33 lines
1.2 KiB
Ruby
module WebhooksHelper
|
|
ACTION_LABELS = {
|
|
card_published: "Card added",
|
|
card_title_changed: "Card title changed",
|
|
card_board_changed: "Card board changed",
|
|
comment_created: "Comment added",
|
|
card_assigned: "Card assigned",
|
|
card_unassigned: "Card unassigned",
|
|
card_triaged: "Card column changed",
|
|
card_closed: "Card moved to “Done”",
|
|
card_reopened: "Card reopened",
|
|
card_postponed: "Card moved to “Not Now”",
|
|
card_auto_postponed: "Card moved to “Not Now” due to inactivity",
|
|
card_sent_back_to_triage: "Card moved back to “Maybe?”"
|
|
}.with_indifferent_access.freeze
|
|
|
|
def webhook_action_options(actions = Webhook::PERMITTED_ACTIONS)
|
|
ACTION_LABELS.select { |key, _| actions.include?(key.to_s) }
|
|
end
|
|
|
|
def webhook_action_label(action)
|
|
ACTION_LABELS[action] || action.to_s.humanize
|
|
end
|
|
|
|
def link_to_webhooks(board, &)
|
|
link_to board_webhooks_path(board_id: board),
|
|
class: [ "btn btn--circle-mobile", { "btn--reversed": board.webhooks.any? } ],
|
|
data: { controller: "tooltip", bridge__overflow_menu_target: "item", bridge_title: "Webhooks" } do
|
|
icon_tag("world") + tag.span("Webhooks", class: "for-screen-reader")
|
|
end
|
|
end
|
|
end
|