Module: Decidim::ExternalDomainHelper

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

Instance Method Summary collapse

Instance Method Details

#highlight_domainObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/decidim/external_domain_helper.rb', line 5

def highlight_domain
  highlighted_domain = [
    external_url.host,
    (external_url.port && [80, 443].include?(external_url.port) ? "" : ":#{external_url.port}")
  ].join

  path = [
    external_url.path,
    (external_url.query ? "?#{external_url.query}" : ""),
    (external_url.fragment ? "##{external_url.fragment}" : "")
  ].join

  tag.div do
    (:span, "#{external_url.scheme}://") +
      (:span, highlighted_domain, class: "text-alert") +
      (:span, path)
  end
end