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