diff --git a/app/helpers/webhooks_helper.rb b/app/helpers/webhooks_helper.rb new file mode 100644 index 000000000..7fe91d8c0 --- /dev/null +++ b/app/helpers/webhooks_helper.rb @@ -0,0 +1,27 @@ +module WebhooksHelper + ACTION_LABELS = { + card_assigned: "Card assigned", + card_closed: "Card closed", + card_collection_changed: "Card collection changed", + card_due_date_added: "Card due date added", + card_due_date_changed: "Card due date changed", + card_due_date_removed: "Card due date removed", + card_published: "Card published", + card_reopened: "Card reopened", + card_staged: "Card staged", + card_title_changed: "Card title changed", + card_unassigned: "Card unassigned", + card_unstaged: "Card unstaged", + comment_created: "Comment created" + }.with_indifferent_access.freeze + + def webhook_action_options(actions = Webhook::PERMITTED_ACTIONS) + actions.each_with_object({}) do |action, hash| + hash[action.to_s] = webhook_action_label(action) + end + end + + def webhook_action_label(action) + ACTION_LABELS[action] || action.to_s.humanize + end +end diff --git a/app/views/webhooks/form/_actions.html.erb b/app/views/webhooks/form/_actions.html.erb index cd75e2dd6..a887fa644 100644 --- a/app/views/webhooks/form/_actions.html.erb +++ b/app/views/webhooks/form/_actions.html.erb @@ -1,16 +1,16 @@ diff --git a/app/views/webhooks/show.html.erb b/app/views/webhooks/show.html.erb index f4edfa392..07e5f849f 100644 --- a/app/views/webhooks/show.html.erb +++ b/app/views/webhooks/show.html.erb @@ -47,7 +47,7 @@ <% else %> <% end %>