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 @@
1arrow = """<svg class="_path-arrow"><use xlink:href="#dir"/></svg>"""
2
1app.templates.path = (doc, type, entry) ->3app.templates.path = (doc, type, entry) ->
2 html = """<a href="#{doc.fullPath()}" class="_path-item _icon-#{doc.icon}">#{doc.fullName}</a>"""4 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 type5 html += """#{arrow}<a href="#{type.fullPath()}" class="_path-item">#{type.name}</a>""" if type
4 html += """<span class="_path-item">#{$.escape entry.name}</span>""" if entry6 html += """#{arrow}<span class="_path-item">#{$.escape entry.name}</span>""" if entry
5 html7 html
assets/javascripts/templates/sidebar_tmpl.coffee+7−5
@@ -1,5 +1,7 @@
1templates = app.templates1templates = app.templates
2 2
3arrow = """<svg class="_list-arrow"><use xlink:href="#dir"/></svg>"""
4
3templates.sidebarDoc = (doc, options = {}) ->5templates.sidebarDoc = (doc, options = {}) ->
4 link = """<a href="#{doc.fullPath()}" class="_list-item _icon-#{doc.icon} """6 link = """<a href="#{doc.fullPath()}" class="_list-item _icon-#{doc.icon} """
5 link += if options.disabled then '_list-disabled' else '_list-dir'7 link += if options.disabled then '_list-disabled' else '_list-dir'
@@ -7,14 +9,14 @@ templates.sidebarDoc = (doc, options = {}) -> · 1 unmodified line
7 if options.disabled9 if options.disabled
8 link += """<span class="_list-enable" data-enable="#{doc.slug}">Enable</span>"""10 link += """<span class="_list-enable" data-enable="#{doc.slug}">Enable</span>"""
9 else11 else
10 link += """<span class="_list-arrow"></span>"""12 link += arrow
11 link += """<span class="_list-count">#{doc.release}</span>""" if doc.release13 link += """<span class="_list-count">#{doc.release}</span>""" if doc.release
12 link += """<span class="_list-text">#{doc.name}"""14 link += """<span class="_list-text">#{doc.name}"""
13 link += " #{doc.version}" if options.fullName or options.disabled and doc.version15 link += " #{doc.version}" if options.fullName or options.disabled and doc.version
14 link + "</span></a>"16 link + "</span></a>"
15 17
16templates.sidebarType = (type) ->18templates.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>"""
18 20
19templates.sidebarEntry = (entry) ->21templates.sidebarEntry = (entry) ->
20 """<a href="#{entry.fullPath()}" class="_list-item _list-hover" tabindex="-1">#{$.escape entry.name}</a>"""22 """<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
47templates.sidebarVersionedDoc = (doc, versions, options = {}) ->49templates.sidebarVersionedDoc = (doc, versions, options = {}) ->
48 html = """<div class="_list-item _list-dir _list-rdir _icon-#{doc.icon}"""50 html = """<div class="_list-item _list-dir _list-rdir _icon-#{doc.icon}"""
49 html += " open" if options.open51 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>"""
51 53
52templates.sidebarDisabled = (options) ->54templates.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>"""
54 56
55templates.sidebarDisabledList = (html) ->57templates.sidebarDisabledList = (html) ->
56 """<div class="_disabled-list">#{html}</div>"""58 """<div class="_disabled-list">#{html}</div>"""
57 59
58templates.sidebarDisabledVersionedDoc = (doc, versions) ->60templates.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>"""
60 62
61templates.docPickerNote = """63templates.docPickerNote = """
62 <div class="_list-note">Tip: for faster and better search results, select only the docs you need.</div>64 <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
55 return if event.which isnt 1 or event.metaKey or event.ctrlKey55 return if event.which isnt 1 or event.metaKey or event.ctrlKey
56 return unless event.pageY # ignore fabricated clicks56 return unless event.pageY # ignore fabricated clicks
57 el = event.target57 el = event.target
58 el = el.parentElement if el.parentElement.tagName.toUpperCase() is 'SVG'
58 59
59 if el.classList.contains @constructor.handleClass60 if el.classList.contains @constructor.handleClass
60 $.stopEvent(event)61 $.stopEvent(event)