class Dedalus::PatternLibrary::ApplicationTemplate

Attributes

current_entry_name[RW]
library_items[RW]
library_name[RW]
library_section_tabs[RW]
library_sections[RW]

Public Class Methods

description() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 37
def self.description
  "pattern library template"
end
example_data() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 21
def self.example_data
  {
    library_name: "Ipsum Librarum",
    library_sections: [ {
      title: "Welcome",
      subtitle: "Fake section",
      color: 'blue',
      show_table: false,
      items: []
    } ], #, LibraryEntry.example_data ],
    library_section_tabs: [ LibrarySectionTab.example_data ],
    library_items: [], # LibraryItemExample.example_data ],
    current_entry_name: 'Welcome'
  }
end

Public Instance Methods

layout() { |], app_footer| ... } click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 13
def layout
  [
    app_header,
    [ sidebar, yield ],
    app_footer
  ]
end
show() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 7
def show
  layout do
    library_page
  end
end

Private Instance Methods

app_header() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 60
def app_header
  ApplicationHeader.new(
    title: library_name,
    subtitle: 'A Visual Pattern Library for Joyce',
    height_percent: 0.16,
    background_color: Palette.blue
  )
end
current_item() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 56
def current_item
  library_items.detect { |item| item[:name] == current_entry_name }
end
current_section() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 52
def current_section
  library_sections.detect { |section| section[:title] == current_entry_name }
end
library_page() click to toggle source
# File lib/dedalus/pattern_library/templates/app_template.rb, line 42
def library_page
  if current_section
    LibraryEntry.new(current_section)
  elsif current_item
    LibraryEntry.from_item(current_item)
  else
    Elements::Paragraph.new(text: "no page selected")
  end
end
sidebar() click to toggle source