File tree 3 files changed +31
-30
lines changed
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>
11
11
12
12
< %= yield %>
13
13
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
+
23
16
</ div >
24
17
25
18
< %= render 'sidebar' %>
Original file line number Diff line number Diff line change 1
1
<!-- sidebar -->
2
2
< 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 ">
8
8
< % chapters = [
9
9
"getting-started",
10
10
"javascript-101",
@@ -19,21 +19,20 @@ <h2>Categories</h2>
19
19
"custom-events",
20
20
"how-to"
21
21
] %>
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
+
38
37
</ aside >
39
38
<!-- sidebar -->
You can’t perform that action at this time.
0 commit comments