class Locomotive::Steam::Liquid::Tags::LinkTo

Public Instance Methods

render(context) click to toggle source
Calls superclass method
# File lib/locomotive/steam/liquid/tags/link_to.rb, line 11
def render(context)
  render_path(context) do |page, path|
    label = label_from_page(page)

    if render_as_block?
      context.stack do
        context.scopes.last['target'] = page
        label = super.html_safe
      end
    end

    tag_href  = %(href="#{path}")
    tag_class = %( class="#{css}") if css.present?

    %{<a #{tag_href}#{tag_class}>#{label}</a>}
  end
end
wrong_syntax!() click to toggle source
# File lib/locomotive/steam/liquid/tags/link_to.rb, line 29
def wrong_syntax!
  raise SyntaxError.new("Syntax Error in 'link_to' - Valid syntax: link_to page_handle, locale es (locale is optional)")
end

Protected Instance Methods

css() click to toggle source
# File lib/locomotive/steam/liquid/tags/link_to.rb, line 43
def css
  attributes[:class]
end
label_from_page(page) click to toggle source
# File lib/locomotive/steam/liquid/tags/link_to.rb, line 35
def label_from_page(page)
  if page.templatized?
    page.send(:_source).content_entry._label
  else
    page.title
  end
end