Class: WithStudentPathNavigation::Navigation
- Inherits:
-
Object
- Object
- WithStudentPathNavigation::Navigation
show all
- Defined in:
- app/helpers/concerns/with_student_path_navigation/navigation.rb
Instance Method Summary
collapse
Constructor Details
#initialize(template) ⇒ Navigation
Returns a new instance of Navigation.
3
4
5
|
# File 'app/helpers/concerns/with_student_path_navigation/navigation.rb', line 3
def initialize(template)
@template = template
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
32
33
34
|
# File 'app/helpers/concerns/with_student_path_navigation/navigation.rb', line 32
def method_missing(name, *args, &block)
@template.send(name, *args, &block)
end
|
Instance Method Details
7
8
9
10
11
12
|
# File 'app/helpers/concerns/with_student_path_navigation/navigation.rb', line 7
def button(navigable)
sibling = sibling_for(navigable)
link_to link_icon(sibling),
sibling,
merge_confirmation_classes(navigable, class: clazz) if sibling && sibling != navigable
end
|
#link_icon(sibling) ⇒ Object
14
15
16
|
# File 'app/helpers/concerns/with_student_path_navigation/navigation.rb', line 14
def link_icon(sibling)
fa_icon(icon, text: I18n.t(key, sibling: sibling.name, kind: I18n.t(sibling.class.model_name.name.downcase)), right: right)
end
|
#merge_confirmation_classes(navigable, base_classes) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'app/helpers/concerns/with_student_path_navigation/navigation.rb', line 22
def merge_confirmation_classes(navigable, base_classes)
if navigable.is_a? Reading
base_classes.merge class: "btn-confirmation #{base_classes[:class]}",
'data-confirmation-url': exercise_confirmations_path(navigable)
else
base_classes
end
.merge role: "button"
end
|
#right ⇒ Object
18
19
20
|
# File 'app/helpers/concerns/with_student_path_navigation/navigation.rb', line 18
def right
false
end
|