module ApplicationHelper
  def input_checked(key, value)
    if facet_has_any_selected_values?(key)
      if params[key].is_a?(Array) && params[key].include?(value)
        ' checked="checked"'
      elsif params[key] == value
        ' checked="checked"'
      end
    end
  end

  def facet_has_any_selected_values?(key)
    params.has_key?(key)
  end

  def absolute_url_for(path)
    URI.join(Plek.current.website_root, path)
  end
end

module ApplicationHelper
  def input_checked(key, value)
    if facet_has_any_selected_values?(key)
      if params[key].is_a?(Array) && params[key].include?(value)
        ' checked="checked"'
      elsif params[key] == value
        ' checked="checked"'
      end
    end
  end

  def facet_has_any_selected_values?(key)
    params.has_key?(key)
  end

  def absolute_url_for(path)
    URI.join(Plek.current.website_root, path)
  end

  def arr_to_links(arr)
    arr.map { |link|
      link_to(link.title, link.web_url)
    }
  end
end

Add a helper for links generation
Add a helper for links generation

The metadata component expects a link of arrays and as we now have
policies that can have more than one Organisation it made sense to
refactor this out to its own helper.
