History

Use an SVG icon for "dir" and "path" icons

Thibaut Courouble committed 9 years ago

Commit bda32901 parent 68c030817 files · +31 −35Browse files

Showing the changes to assets/javascripts (3 of 17 files). Show all

Unified · Split

3 files
  1. assets/javascripts/templates/path_tmpl.coffee +4 −2
  2. assets/javascripts/templates/sidebar_tmpl.coffee +7 −5
  3. assets/javascripts/views/list/list_fold.coffee +1 −0
assets/javascripts/templates/path_tmpl.coffee+4−2
@@ -1,5 +1,7 @@
1+arrow = """<svg class="_path-arrow"><use xlink:href="#dir"/></svg>"""
2+
13 app.templates.path = (doc, type, entry) ->
24 html = """<a href="#{doc.fullPath()}" class="_path-item _icon-#{doc.icon}">#{doc.fullName}</a>"""
3− html += """<a href="#{type.fullPath()}" class="_path-item">#{type.name}</a>""" if type
4− html += """<span class="_path-item">#{$.escape entry.name}</span>""" if entry
5+ html += """#{arrow}<a href="#{type.fullPath()}" class="_path-item">#{type.name}</a>""" if type
6+ html += """#{arrow}<span class="_path-item">#{$.escape entry.name}</span>""" if entry
57 html
assets/javascripts/templates/sidebar_tmpl.coffee+7−5
@@ -1,5 +1,7 @@
11 templates = app.templates
22
3+arrow = """<svg class="_list-arrow"><use xlink:href="#dir"/></svg>"""
4+
35 templates.sidebarDoc = (doc, options = {}) ->
46 link = """<a href="#{doc.fullPath()}" class="_list-item _icon-#{doc.icon} """
57 link += if options.disabled then '_list-disabled' else '_list-dir'
@@ -7,14 +9,14 @@ templates.sidebarDoc = (doc, options = {}) -> · 1 unmodified line
79 if options.disabled
810 link += """<span class="_list-enable" data-enable="#{doc.slug}">Enable</span>"""
911 else
10− link += """<span class="_list-arrow"></span>"""
12+ link += arrow
1113 link += """<span class="_list-count">#{doc.release}</span>""" if doc.release
1214 link += """<span class="_list-text">#{doc.name}"""
1315 link += " #{doc.version}" if options.fullName or options.disabled and doc.version
1416 link + "</span></a>"
1517
1618 templates.sidebarType = (type) ->
17− """<a href="#{type.fullPath()}" class="_list-item _list-dir" data-slug="#{type.slug}" tabindex="-1"><span class="_list-arrow"></span><span class="_list-count">#{type.count}</span><span class="_list-text">#{$.escape type.name}</span></a>"""
19+ """<a href="#{type.fullPath()}" class="_list-item _list-dir" data-slug="#{type.slug}" tabindex="-1">#{arrow}<span class="_list-count">#{type.count}</span><span class="_list-text">#{$.escape type.name}</span></a>"""
1820
1921 templates.sidebarEntry = (entry) ->
2022 """<a href="#{entry.fullPath()}" class="_list-item _list-hover" tabindex="-1">#{$.escape entry.name}</a>"""
@@ -47,16 +49,16 @@ templates.sidebarLabel = (doc, options = {}) -> · 26 unmodified lines
4749 templates.sidebarVersionedDoc = (doc, versions, options = {}) ->
4850 html = """<div class="_list-item _list-dir _list-rdir _icon-#{doc.icon}"""
4951 html += " open" if options.open
50− html + """" tabindex="0"><span class="_list-arrow"></span>#{doc.name}</div><div class="_list _list-sub">#{versions}</div>"""
52+ html + """" tabindex="0">#{arrow}#{doc.name}</div><div class="_list _list-sub">#{versions}</div>"""
5153
5254 templates.sidebarDisabled = (options) ->
53− """<h6 class="_list-title"><span class="_list-arrow"></span>Disabled (#{options.count})</h6>"""
55+ """<h6 class="_list-title">#{arrow}Disabled (#{options.count})</h6>"""
5456
5557 templates.sidebarDisabledList = (html) ->
5658 """<div class="_disabled-list">#{html}</div>"""
5759
5860 templates.sidebarDisabledVersionedDoc = (doc, versions) ->
59− """<a class="_list-item _list-dir _icon-#{doc.icon} _list-disabled" data-slug="#{doc.slug_without_version}" tabindex="-1"><span class="_list-arrow"></span>#{doc.name}</a><div class="_list _list-sub">#{versions}</div>"""
61+ """<a class="_list-item _list-dir _icon-#{doc.icon} _list-disabled" data-slug="#{doc.slug_without_version}" tabindex="-1">#{arrow}#{doc.name}</a><div class="_list _list-sub">#{versions}</div>"""
6062
6163 templates.docPickerNote = """
6264 <div class="_list-note">Tip: for faster and better search results, select only the docs you need.</div>
assets/javascripts/views/list/list_fold.coffee+1−0
@@ -55,6 +55,7 @@ class app.views.ListFold extends app.View · 54 unmodified lines
5555 return if event.which isnt 1 or event.metaKey or event.ctrlKey
5656 return unless event.pageY # ignore fabricated clicks
5757 el = event.target
58+ el = el.parentElement if el.parentElement.tagName.toUpperCase() is 'SVG'
5859
5960 if el.classList.contains @constructor.handleClass
6061 $.stopEvent(event)