Class: Willamette::Strategies::Sidebar
- Defined in:
- lib/willamette/strategies/sidebar.rb
Overview
Contain logic for sidebar rendering
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
- #default_link_icon(folder: false) ⇒ Object
- #description? ⇒ Boolean
- #explore? ⇒ Boolean
- #explore_links ⇒ Object
- #follow? ⇒ Boolean
- #follow_links ⇒ Object
-
#initialize(component, description:, explore_links:, follow_links:, subscribe:, see_also_links:) ⇒ Sidebar
constructor
Use the ‘sidebar` module method on `Willamette`.
- #see_also? ⇒ Boolean
- #see_also_links ⇒ Object
- #subscribe? ⇒ Boolean
Constructor Details
#initialize(component, description:, explore_links:, follow_links:, subscribe:, see_also_links:) ⇒ Sidebar
Use the ‘sidebar` module method on `Willamette`
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/willamette/strategies/sidebar.rb', line 9 def initialize( component, description:, explore_links:, follow_links:, subscribe:, see_also_links: ) @component = component @description = description @explore_links = explore_links || [] @follow_links = follow_links || [] @subscribe = subscribe @see_also_links = see_also_links || [] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/willamette/strategies/sidebar.rb', line 6 def description @description end |
Instance Method Details
#default_link_icon(folder: false) ⇒ Object
36 37 38 |
# File 'lib/willamette/strategies/sidebar.rb', line 36 def default_link_icon(folder: false) folder ? "folder-open" : "file-lines" end |
#description? ⇒ Boolean
24 |
# File 'lib/willamette/strategies/sidebar.rb', line 24 def description? = @description && !explore? |
#explore? ⇒ Boolean
20 |
# File 'lib/willamette/strategies/sidebar.rb', line 20 def explore? = !@explore_links.empty? |
#explore_links ⇒ Object
22 |
# File 'lib/willamette/strategies/sidebar.rb', line 22 def explore_links = links_html(@explore_links) |
#follow? ⇒ Boolean
26 |
# File 'lib/willamette/strategies/sidebar.rb', line 26 def follow? = !@follow_links.empty? |
#follow_links ⇒ Object
28 |
# File 'lib/willamette/strategies/sidebar.rb', line 28 def follow_links = links_html(@follow_links) |
#see_also? ⇒ Boolean
32 |
# File 'lib/willamette/strategies/sidebar.rb', line 32 def see_also? = !@see_also_links.empty? |
#see_also_links ⇒ Object
34 |
# File 'lib/willamette/strategies/sidebar.rb', line 34 def see_also_links = links_html(@see_also_links) |
#subscribe? ⇒ Boolean
30 |
# File 'lib/willamette/strategies/sidebar.rb', line 30 def subscribe? = @subscribe |