diff --git a/app/helpers/template_helper.rb b/app/helpers/template_helper.rb index 3ed80ea..fdaee95 100644 --- a/app/helpers/template_helper.rb +++ b/app/helpers/template_helper.rb @@ -6,12 +6,17 @@ a.join(separator) end - def direct_link(template, hidden = false, text = nil) + # Generate a direct plan creation link with based on provided template + # @param template [Template] template used for plan creation + # @param hidden [Boolean] should the link be hidden ? + # @param text [String] text for the link + # @param id [String] HTML id for the link element + def direct_link(template, hidden = false, text = nil, id = nil) params = { org_id: template.org.id, funder_id: '-1', template_id: template.id } cls = text.nil? ? 'direct-link' : 'direct-link btn btn-default' style = hidden ? 'display: none' : '' - link_to(plans_url(plan: params), method: :post, title: _('Create plan'), class: cls, style: style) do + link_to(plans_url(plan: params), method: :post, title: _('Create plan'), class: cls, id: id, style: style) do if text.nil? ''.html_safe else