Module: Renalware::SnippetsHelper

Defined in:
app/helpers/renalware/snippets_helper.rb

Instance Method Summary collapse

Instance Method Details

Adds to the page:

  • the snippets modal dialog container (which will be ajax-populated)

  • the link to invoke the snippets dialog (loading content via ajax)

Note that the data-target on the modal container determines which textarea is populated with when a snippet is selected.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/renalware/snippets_helper.rb', line 10

def snippets_modal_and_link_to_open_it(target_input_for_seleted_snippet:)
  capture do
    concat tag.div(nil,
                   id: "snippets-modal",
                   class: "reveal-modal",
                   data: {
                     reveal: "data-reveal",
                     controller: "snippets",
                     "snippets-target-input" => target_input_for_seleted_snippet,
                     target: target_input_for_seleted_snippet
                   })
    concat link_to t("snippets.insert"),
                   snippets_path(format: :js),
                   class: "button alternative right insert-snippet-button",
                   remote: true
  end
end