mirror of https://github.com/freeCodeCamp/devdocs
parent
f3cfcd0435
commit
06bdb77ab2
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@ -0,0 +1,5 @@
|
||||
app.templates.path = (doc, type, entry) ->
|
||||
html = """<a href="#{doc.fullPath()}" class="_path-item _icon-#{doc.slug}">#{doc.name}</a>"""
|
||||
html += """<a href="#{type.fullPath()}" class="_path-item">#{type.name}</a>""" if type
|
||||
html += """<span class="_path-item">#{entry.name}</span>""" if entry
|
||||
html
|
@ -0,0 +1,36 @@
|
||||
class app.views.Path extends app.View
|
||||
@className: '_path'
|
||||
|
||||
@events:
|
||||
click: 'onClick'
|
||||
|
||||
@routes:
|
||||
after: 'afterRoute'
|
||||
|
||||
render: (args...) ->
|
||||
@show()
|
||||
@html @tmpl 'path', args...
|
||||
|
||||
show: ->
|
||||
$.prepend $('._app'), @el unless @el.parentNode
|
||||
|
||||
hide: ->
|
||||
$.remove @el if @el.parentNode
|
||||
|
||||
onClick: (event) =>
|
||||
@clicked = true if link = $.closestLink event.target, @el
|
||||
|
||||
afterRoute: (route, context) =>
|
||||
if context.type
|
||||
@render context.doc, context.type
|
||||
else if context.entry
|
||||
if context.entry.isIndex()
|
||||
@render context.doc
|
||||
else
|
||||
@render context.doc, context.entry.getType(), context.entry
|
||||
else
|
||||
@hide()
|
||||
|
||||
if @clicked
|
||||
@clicked = null
|
||||
app.document.sidebar.reset()
|
@ -0,0 +1,50 @@
|
||||
._path {
|
||||
position: absolute;
|
||||
z-index: $noticeZ;
|
||||
bottom: 0;
|
||||
left: $sidebarWidth;
|
||||
right: 0;
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
padding: 0 .375rem;
|
||||
font-size: .875rem;
|
||||
text-shadow: 0 1px rgba(white, .5);
|
||||
background: #f5f5f7;
|
||||
box-shadow: inset 0 1px #d5d5da, // top border
|
||||
inset 0 2px rgba(white, .3), // top inner glow
|
||||
inset 1px 0 rgba(black, .03); // left inner shadow
|
||||
|
||||
@media #{$mediumScreen} { left: $sidebarMediumWidth; }
|
||||
|
||||
~ ._container { padding-bottom: 2rem; }
|
||||
}
|
||||
|
||||
._path-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 0 1rem 0 0;
|
||||
padding: 0 .375rem;
|
||||
color: $textColor;
|
||||
|
||||
&:first-child:before {
|
||||
content: '';
|
||||
float: left;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
margin: .5rem .375rem 0 0;
|
||||
@extend %icon;
|
||||
}
|
||||
|
||||
& + &:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 100%;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
margin: -.5rem 0 0 0;
|
||||
pointer-events: none;
|
||||
@extend %icon, %icon-path;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 137 B |
After Width: | Height: | Size: 218 B |
Loading…
Reference in new issue