Sha256: 8700541348849df3f03da52e81cb4c85b8c31f23b91cc97e99795e03304ab6e1

Contents?: true

Size: 643 Bytes

Versions: 9

Compression:

Stored size: 643 Bytes

Contents

view(:summary) do |*args|
  params = args.extract_options!
  briefcase = args.first

  briefcase.present(:default, params).tap do |hash|
    if summary = briefcase.pages.find {|p| p.title == "Summary" }
      hash[:summary] = summary.to_model.as_json(params)
    end

    if briefcase.has_table_of_contents?
      hash[:table_of_contents] = table_of_contents.as_json(params)
    end
  end
end

class Brief::Briefcase
  def has_table_of_contents?
    docs_path.join('index.md').exist?
  end

  def table_of_contents
    doc = Brief::Document.new(briefcase.docs_path.join("index.md"), document_type: "outline")
    doc && doc.to_model
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
brief-1.9.9 apps/blueprint/config.rb
brief-1.9.8 apps/blueprint/config.rb
brief-1.9.7 apps/blueprint/config.rb
brief-1.9.6 apps/blueprint/config.rb
brief-1.9.4 apps/blueprint/config.rb
brief-1.9.3 apps/blueprint/config.rb
brief-1.9.2 apps/blueprint/config.rb
brief-1.9.1 apps/blueprint/config.rb
brief-1.9.0 apps/blueprint/config.rb