Skip to content

Commit 86fdba1

Browse files
jolheisersilverwindtechknowlogick
authored
Add Octicon SVG spritemap (#10107)
* Add octicon SVG sprite Signed-off-by: jolheiser <[email protected]> * Static prefix Signed-off-by: jolheiser <[email protected]> * SVG for all repo icons Signed-off-by: jolheiser <[email protected]> * make vendor Signed-off-by: jolheiser <[email protected]> * Swap out octicons Signed-off-by: jolheiser <[email protected]> * Move octicons to top of less imports Signed-off-by: jolheiser <[email protected]> * Fix JS Signed-off-by: jolheiser <[email protected]> * Definitely not a search/replace Signed-off-by: jolheiser <[email protected]> * Missed regex Signed-off-by: jolheiser <[email protected]> * Move to more generic calls and webpack Signed-off-by: jolheiser <[email protected]> * make svg -> make webpack Signed-off-by: jolheiser <[email protected]> * Remove svg-sprite Signed-off-by: jolheiser <[email protected]> * Update tests Signed-off-by: jolheiser <[email protected]> * Missed a test Signed-off-by: jolheiser <[email protected]> * Remove svg from makefile Signed-off-by: jolheiser <[email protected]> * Suggestions Signed-off-by: jolheiser <[email protected]> * Attempt to fix test Signed-off-by: jolheiser <[email protected]> * Update tests Signed-off-by: jolheiser <[email protected]> * Revert timetracking test Signed-off-by: jolheiser <[email protected]> * Swap .octicon for .svg in less Signed-off-by: jolheiser <[email protected]> * Add aria-hidden Signed-off-by: jolheiser <[email protected]> * Replace mega-octicon Signed-off-by: jolheiser <[email protected]> * Fix webpack globbing on Windows Signed-off-by: jolheiser <[email protected]> * Revert Co-Authored-By: silverwind <[email protected]> * Fix octions from upstream Signed-off-by: jolheiser <[email protected]> * Fix Vue and missed JS function Signed-off-by: jolheiser <[email protected]> * Add JS helper and PWA Signed-off-by: jolheiser <[email protected]> * Preload SVG Signed-off-by: jolheiser <[email protected]> Co-authored-by: silverwind <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent e704f7f commit 86fdba1

File tree

112 files changed

+1387
-1122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1387
-1122
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ coverage.all
7373
/public/js
7474
/public/css
7575
/public/fomantic
76+
/public/img/svg
7677

7778
# Snapcraft
7879
snap/.snapcraft/

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ require (
9999
github.com/yuin/goldmark v1.1.19
100100
go.etcd.io/bbolt v1.3.3 // indirect
101101
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876
102-
golang.org/x/net v0.0.0-20191101175033-0deb6923b6d9
102+
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa
103103
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
104104
golang.org/x/sys v0.0.0-20191127021746-63cb32ae39b2
105105
golang.org/x/text v0.3.2

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
627627
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
628628
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
629629
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
630-
golang.org/x/net v0.0.0-20191101175033-0deb6923b6d9 h1:DPz9iiH3YoKiKhX/ijjoZvT0VFwK2c6CWYWQ7Zyr8TU=
631-
golang.org/x/net v0.0.0-20191101175033-0deb6923b6d9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
630+
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA=
631+
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
632632
golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
633633
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
634634
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

integrations/repo_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,16 @@ func TestViewRepoWithSymlinks(t *testing.T) {
149149
htmlDoc := NewHTMLParser(t, resp.Body)
150150
files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name > SPAN")
151151
items := files.Map(func(i int, s *goquery.Selection) string {
152-
cls, _ := s.Find("SPAN").Attr("class")
152+
cls, _ := s.Find("SVG").Attr("class")
153153
file := strings.Trim(s.Find("A").Text(), " \t\n")
154154
return fmt.Sprintf("%s: %s", file, cls)
155155
})
156156
assert.Equal(t, len(items), 5)
157-
assert.Equal(t, items[0], "a: octicon octicon-file-directory")
158-
assert.Equal(t, items[1], "link_b: octicon octicon-file-symlink-directory")
159-
assert.Equal(t, items[2], "link_d: octicon octicon-file-symlink-file")
160-
assert.Equal(t, items[3], "link_hi: octicon octicon-file-symlink-file")
161-
assert.Equal(t, items[4], "link_link: octicon octicon-file-symlink-file")
157+
assert.Equal(t, items[0], "a: svg octicon-file-directory")
158+
assert.Equal(t, items[1], "link_b: svg octicon-file-symlink-directory")
159+
assert.Equal(t, items[2], "link_d: svg octicon-file-symlink-file")
160+
assert.Equal(t, items[3], "link_hi: svg octicon-file-symlink-file")
161+
assert.Equal(t, items[4], "link_link: svg octicon-file-symlink-file")
162162
}
163163

164164
// TestViewAsRepoAdmin tests PR #2167

modules/base/tool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func EntryIcon(entry *git.TreeEntry) string {
389389
return "file-submodule"
390390
}
391391

392-
return "file-text"
392+
return "file"
393393
}
394394

395395
// SetupGiteaRoot Sets GITEA_ROOT if it is not already set and returns the value

modules/templates/helper.go

+3
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ func NewFuncMap() []template.FuncMap {
286286
}
287287
return false
288288
},
289+
"svg": func(icon string, size int) template.HTML {
290+
return template.HTML(fmt.Sprintf(`<svg class="svg %s" width="%d" height="%d" aria-hidden="true"><use xlink:href="%s/img/svg/icons.svg#%s" /></svg>`, icon, size, size, setting.StaticURLPrefix, icon))
291+
},
289292
}}
290293
}
291294

0 commit comments

Comments
 (0)