-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy path_nav_openshift.html.erb
133 lines (93 loc) · 5.44 KB
/
_nav_openshift.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<ul class="nav nav-sidebar">
<%- navigation.each.with_index do |topic_group, groupidx| -%>
<!-- the top level groupings start here -->
<%# group_id %>
<%# topic_group[:id] %>
<%# topic_id %>
<!-- group_id is the one that is user selected. topic_group[id] is what we are parsing via navigation -->
<%- current_group = topic_group[:id] == group_id -%>
<li class="nav-header">
<%# current_group %>
<%# topic_group[:id] %>
<%# group_id %>
<a class="" href="javascript:void(0);" data-toggle="collapse" data-target="#topicGroup<%= groupidx %>">
<span id="tgSpan<%= groupidx %>" class="fa <%= current_group ? 'fa-angle-down' : 'fa-angle-right' %>"></span>
<%= topic_group[:name] %>
<!-- prints out the names of the top level books with arrow down or to right
So in this case: Welcome 1 and Another Book -->
</a>
<!-- this then goes through all the topics within the top level groups
depending on whether it itself contains further topics or is a single file -->
<ul id="topicGroup<%= groupidx %>" class="collapse <%= current_group ? 'in' : '' %> list-unstyled">
<%- topic_group[:topics].each.with_index do |topic, topicidx| -%>
<!-- for each topic in this topic_group, for example in Welcome 1, what topics exist?
Welcome 2 and Welcome 1 More -->
<%- if not topic.has_key?(:topics) -%>
<!-- is this is a single page? That is, does this topic have more topics?
Welcome 1 More -->
<%- current_topic = current_group && (topic[:id] == topic_id) -%>
<!-- ^ this establishs whether we are reading this current page -->
<li><a class="<%= current_topic ? ' active' : '' %>" href="<%= subtopic_shim %><%= topic[:path] %>"><%= topic[:name] %></a></li>
<!-- if active, then highlight it, otherwise nothing to do -->
<%- else -%>
<!-- this topic contains subtopics - Welcome 2 -->
<%- current_subgroup = topic[:id] == subgroup_id -%>
<!-- start a new heading area -->
<li class="nav-header">
<a class="" href="javascript:void(0);" data-toggle="collapse" data-target="#topicSubGroup-<%= groupidx %>-<%= topicidx %>">
<span id="sgSpan-<%= groupidx %>-<%= topicidx %>" class="fa <%= current_subgroup ? 'fa-caret-down' : 'fa-caret-right' %>"></span>
<%= topic[:name] %>
<!-- prints out the names of the second level books with arrow down or to right
So in this case: Welcome 2 -->
</a>
<ul id="topicSubGroup-<%= groupidx %>-<%= topicidx %>" class="nav-tertiary list-unstyled collapse<%= current_subgroup ? ' in' : '' %>">
<%- topic[:topics].each.with_index do |subtopic, subtopicidx| -%>
<!-- for each topic in this topic_group, in Welcome 2, what topics exist?
Welcome 2 Index Page, Welcome 3 and Welcome 2 More - we list them all.. -->
<%# subtopic[:path] %>
<%# subgroup_id %>
<%# current_group %>
<%# current_subgroup %>
<%# topic_id %>
<%- if not subtopic.has_key?(:topics) -%>
<!-- is this is a single page? That is, does this topic have more topics?
Welcome 2 Index Page and Welcome 2 More -->
<%- current_subtopic = current_group && current_subgroup && (subtopic[:id] == topic_id) %>
<li>
<a class="<%= current_subtopic ? ' active' : '' %>" href="<%= subtopic_shim %><%= subtopic[:path] %>">
<%= subtopic[:name] %>
</a>
</li>
<% else %>
<!-- Welcome 3 -->
<%- current_subsubgroup = subtopic[:id] == subsubgroup_id -%>
<%# subsubgroup_id %>
<%# subtopic[:id] %>
<%# current_subsubgroup %>
<li class="nav-header">
<a class="" href="javascript:void(0);" data-toggle="collapse" data-target="#topicSubSubGroup-<%= groupidx %>-<%= topicidx %>-<%= subtopicidx %>">
<span id="ssgSpan-<%= groupidx %>-<%= topicidx %>-<%= subtopicidx %>" class="fa <%= current_subsubgroup ? 'fa-caret-down' : 'fa-caret-right' %>"></span>
<%= subtopic[:name] %>
</a>
<ul id="topicSubSubGroup-<%= groupidx %>-<%= topicidx %>-<%= subtopicidx %>" class="nav-tertiary list-unstyled collapse<%= current_subsubgroup ? ' in' : '' %>">
<%- subtopic[:topics].each do |subsubtopic| -%>
<!-- list all topics within Welcome 3 here. Note that we are not coding this for more subtopics here -->
<%- current_subsubtopic = current_group && current_subgroup && current_subsubgroup && (subsubtopic[:id] == topic_id) %>
<li>
<a class="<%= current_subsubtopic ? ' active' : '' %>" href="<%= subtopic_shim %><%= subsubtopic[:path] %>" style="padding-left: 70px;">
<%= subsubtopic[:name] %>
</a>
</li>
<%- end -%>
</ul>
</li>
<%- end -%>
<%- end -%>
</ul>
</li>
<%- end -%>
<%- end -%>
</ul>
</li>
<%- end -%>
</ul>