File tree Expand file tree Collapse file tree 3 files changed +31
-30
lines changed
Expand file tree Collapse file tree 3 files changed +31
-30
lines changed Original file line number Diff line number Diff line change 1+ < % myFolder = @item[:filename].split('/')[1] %>
2+ < % folderItems = @items.group_by {|item| item[:filename].split('/')[1] } %>
3+ < ul >
4+ < % folderItems[ myFolder ].sort_by {|i| i[:section] || 0 }. each do |i| %>
5+ < % if i[:title] && !(i[:filename] =~ /\/dex\.md$/) %>
6+ < li < % if item[:filename] == i[:filename] %> class="active"< % end %> > < a href ="<%= i.path %> "> < %= i[:title] %> </ a > </ li >
7+ < % end %>
8+ < % end %>
9+ </ ul >
Original file line number Diff line number Diff line change @@ -11,15 +11,8 @@ <h2 class="title"><%= @item[:title] %></h2>
1111
1212 < %= yield %>
1313
14- < % myFolder = @item[:filename].split('/')[1] %>
15- < % folderItems = @items.group_by {|item| item[:filename].split('/')[1] } %>
16- < ul >
17- < % folderItems[ myFolder ].sort_by {|item| item[:section] || 0 }. each do |item| %>
18- < % if item[:title] && !(item[:filename] =~ /\/dex\.md$/) %>
19- < li > < a href ="<%= item.path %> "> < %= item[:title] %> </ a > </ li >
20- < % end %>
21- < % end %>
22- </ ul >
14+ < %= render 'chapter_contents' %>
15+
2316 </ div >
2417
2518 < %= render 'sidebar' %>
Original file line number Diff line number Diff line change 11<!-- sidebar -->
22< aside id ="sidebar " class ="clearfix autoHeight ">
3-
4- < h2 > Categories</ h2 >
5- < hr >
6-
7- < ul class ="nav ">
3+
4+ < h2 > Categories</ h2 >
5+ < hr >
6+
7+ < ul class ="nav ">
88 < % chapters = [
99 "getting-started",
1010 "javascript-101",
@@ -19,21 +19,20 @@ <h2>Categories</h2>
1919 "custom-events",
2020 "how-to"
2121 ] %>
22- < % folders = @items.group_by {|item| item[:filename].split('/')[1] } %>
23- < % chapters.each do |section| %>
24- < li > < a href ="/<%= section %> "> < %= section.gsub(/-/, " ").upcase %> </ a > </ li >
25- < % end %>
26- </ ul >
27-
28- < div class ="paper subnav ">
29- < div class ="shadow "> </ div >
30- < a href ="# " class ="paper_edges "> Open</ a >
31- < div class ="inner ">
32- < ul >
33- < li > </ li >
34- </ ul >
35- </ div >
36- </ div >
37-
22+ < % currentChapter = @item[:filename].split('/')[1] %>
23+ < % folders = @items.group_by {|item| item[:filename].split('/')[1] } %>
24+ < % chapters.each do |chapter| %>
25+ < li < % if chapter == currentChapter %> class="active"< % end %> > < a href ="/<%= chapter %> "> < %= chapter.gsub(/-/, " ").upcase %> </ a > </ li >
26+ < % end %>
27+ </ ul >
28+
29+ < div class ="paper subnav ">
30+ < div class ="shadow "> </ div >
31+ < a href ="# " class ="paper_edges "> Open</ a >
32+ < div class ="inner ">
33+ < %= render 'chapter_contents' %>
34+ </ div >
35+ </ div >
36+
3837</ aside >
3938<!-- sidebar -->
You can’t perform that action at this time.
0 commit comments