Sha256: 730b47abf70a2fe2f32178776e74d6b2eca7ad0f32fe50171992d4f0ba1c481b

Contents?: true

Size: 978 Bytes

Versions: 37

Compression:

Stored size: 978 Bytes

Contents

format do
  view :title, compact: true, perms: :none do
    standard_title
  end

  def standard_title
    name_variant title_in_context(voo.title)
  end
end

format :html do
  view :title do
    show_view?(:title_link, :hide) ? render_title_link : render_title_no_link
  end

  view :title_link, compact: true, perms: :none do
    link_to_card card.name, render_title_no_link
  end

  view :title_no_link, compact: true, perms: :none do
    wrapped_title standard_title
  end

  def title_with_link link_text
    link_to_card card.name, link_text
  end

  def safe_name
    h super
  end

  def title_in_context title=nil
    title = title&.html_safe
    # escape titles generated from card names, but not those set explicitly
    h super(title)
  end

  def wrapped_title title
    wrap_with :span, class: classy("card-title"), title: title do
      title.to_name.parts.join wrapped_joint
    end
  end

  def wrapped_joint
    wrap_with :span, "+", classy("joint")
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
card-mod-format-0.18.1 set/all/title.rb
card-mod-format-0.18.0 set/all/title.rb
card-mod-format-0.17.0 set/all/title.rb
card-mod-format-0.16.0 set/all/title.rb
card-mod-format-0.15.6 set/all/title.rb
card-mod-format-0.15.5 set/all/title.rb
card-mod-format-0.15.4 set/all/title.rb
card-mod-format-0.15.3 set/all/title.rb
card-mod-format-0.15.2.pre1 set/all/title.rb
card-mod-format-0.15.1.1 set/all/title.rb
card-mod-format-0.15.1 set/all/title.rb
card-mod-format-0.15.0 set/all/title.rb
card-mod-format-0.14.2 set/all/title.rb
card-mod-format-0.14.1 set/all/title.rb
card-mod-format-0.14.0 set/all/title.rb
card-mod-format-0.13.4 set/all/html_title.rb
card-mod-format-0.13.3 set/all/html_title.rb
card-mod-format-0.13.2 set/all/html_title.rb
card-mod-format-0.13.1 set/all/html_title.rb
card-mod-format-0.13.0 set/all/html_title.rb