Sha256: c94be59111221c7a291d19e4ad67e7f6bc76fce3abe2d586fa496034dbbc1e1f

Contents?: true

Size: 1.54 KB

Versions: 12

Compression:

Stored size: 1.54 KB

Contents

format :html do
  view :header, perms: :none do
    main_header
  end

  def main_header
    header_wrap _render_header_title
  end

  def header_wrap content=nil
    haml :header_wrap, content: (block_given? ? yield : output(content))
  end

  view :header_title, perms: :none do
    header_title_elements
  end

  def header_title_elements
    voo.hide :title_toggle if show_view?(:icon_toggle, :hide)
    title_view = show_view?(:title_toggle, :hide) ? :title_toggle : :title
    [_render_icon_toggle(optional: :hide), _render(title_view)]
  end

  def show_draft_link?
    card.drafts.present? && @slot_view == :edit
  end

  view :title_toggle, perms: :none do
    content_toggle(_render_title(hide: :title_link))
  end

  view :icon_toggle, perms: :none do
    direction = @toggle_mode == :close ? :expand : :collapse_down
    content_toggle icon_tag(direction)
  end

  view :toggle, :icon_toggle  # deprecated; use icon_toggle

  def content_toggle text=""
    return if text.nil?

    verb, adjective = toggle_verb_adjective
    link_to_view adjective, text, title: "#{verb} #{card.name}",   # LOCALIZE
                                  class: "toggle-#{adjective} toggler nodblclick"
  end

  def toggle_view
    toggle_verb_adjective.last
  end

  TOGGLE_MAP = { close: %w[open open], open: %w[close closed] }  # LOCALIZE first item

  def toggle_verb_adjective
    TOGGLE_MAP[@toggle_mode || :open] ||
      raise(Card::Error, "invalid toggle mode: #{@toggle_mode}")
  end

  def structure_editable?
    card.structure && card.template.ok?(:update)
  end
end


Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-1.100.0 mod/standard/set/all/rich_html/header.rb
card-1.99.6 mod/standard/set/all/rich_html/header.rb
card-1.99.5 mod/standard/set/all/rich_html/header.rb
card-1.99.4 mod/standard/set/all/rich_html/header.rb
card-1.99.3 mod/standard/set/all/rich_html/header.rb
card-1.99.2 mod/standard/set/all/rich_html/header.rb
card-1.99.1 mod/standard/set/all/rich_html/header.rb
card-1.99.0 mod/standard/set/all/rich_html/header.rb
card-1.98.3 mod/standard/set/all/rich_html/header.rb
card-1.98.2 mod/standard/set/all/rich_html/header.rb
card-1.98.1 mod/standard/set/all/rich_html/header.rb
card-1.98.0 mod/standard/set/all/rich_html/header.rb