Module: Decidim::WidgetUrlsHelper

Defined in:
app/helpers/decidim/widget_urls_helper.rb

Instance Method Summary collapse

Instance Method Details

#embed_modal_for(url, options = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'app/helpers/decidim/widget_urls_helper.rb', line 5

def embed_modal_for(url, options = {})
  extra_locals = options[:locals] || {}

  js_embed_code = String.new((:script, "", src: url))
  embed_code = String.new((:noscript, (:iframe, "", src: url.gsub(".js", ".html"), frameborder: 0, scrolling: "vertical")))
  render partial: "decidim/shared/embed_modal", locals: { js_embed_code: js_embed_code, embed_code: embed_code }.merge(extra_locals)
end