Class: Madness::Navigation
- Inherits:
-
Object
- Object
- Madness::Navigation
show all
- Includes:
- ServerHelper
- Defined in:
- lib/madness/navigation.rb
Overview
Handle the navigation links for a given directory
Instance Attribute Summary collapse
Instance Method Summary
collapse
#disallowed_static?, #docroot, #find_static_file, #log, #theme
Constructor Details
Returns a new instance of Navigation.
11
12
13
|
# File 'lib/madness/navigation.rb', line 11
def initialize(dir)
@dir = dir
end
|
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
9
10
11
|
# File 'lib/madness/navigation.rb', line 9
def dir
@dir
end
|
Instance Method Details
#caption ⇒ Object
35
36
37
|
# File 'lib/madness/navigation.rb', line 35
def caption
@caption ||= (dir == docroot ? 'Index' : File.basename(dir).to_label)
end
|
#current_path ⇒ Object
31
32
33
|
# File 'lib/madness/navigation.rb', line 31
def current_path
dir
end
|
#links ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/madness/navigation.rb', line 15
def links
@links ||= if config.sort_order == 'mixed'
directory.list.nat_sort(by: :href)
else
directory.list
end
end
|
#tree ⇒ Object
27
28
29
|
# File 'lib/madness/navigation.rb', line 27
def tree
@tree ||= sort_tree(root_directory.tree)
end
|
#tree? ⇒ Boolean
23
24
25
|
# File 'lib/madness/navigation.rb', line 23
def tree?
config.nav_tree
end
|
#with_search? ⇒ Boolean
39
40
41
|
# File 'lib/madness/navigation.rb', line 39
def with_search?
true
end
|