Class: Gretel::Renderer::NonSemanticRenderer

Inherits:
Base
  • Object
show all
Defined in:
lib/gretel/renderer.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #render_current_fragment, #render_fragment, #render_posttext, #render_pretext

Constructor Details

This class inherits a constructor from Gretel::Renderer::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gretel::Renderer::Base

Instance Method Details

#render_container(html) ⇒ Object



308
309
310
# File 'lib/gretel/renderer.rb', line 308

def render_container(html)
  (options[:container_tag], html, id: options[:id], class: options[:class])
end

#render_fragment_tag(fragment_tag, text, url, position, options = {}) ⇒ Object



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/gretel/renderer.rb', line 289

def render_fragment_tag(fragment_tag, text, url, position, options = {})
  fragment_class = join_classes(options[:fragment_class], options[:class])

  if fragment_tag
    if url.present?
      text = breadcrumb_link_to(text, url, "aria-current": options[:aria_current], data: options[:link_data])
      (fragment_tag, text, class: fragment_class)
    else
      (fragment_tag, text, class: fragment_class, "aria-current": options[:aria_current], data: options[:link_data])
    end
  elsif url.present?
    breadcrumb_link_to(text, url, class: join_classes(fragment_class, options[:link_class]), "aria-current": options[:aria_current], data: options[:link_data])
  elsif options[:class].present?
    (:span, text, class: fragment_class, "aria-current": options[:aria_current])
  else
    text
  end
end