diff options
author | silverwind <me@silverwind.io> | 2020-07-13 01:48:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 02:48:48 +0300 |
commit | 48ad76c25e6ff103901f347c3b53f80b483498c4 (patch) | |
tree | 5d81592453f75b5b5b2b9a8a41137151600efb06 /web_src/js/index.js | |
parent | a60f506dd7217b6a6c7ea6934e308c91cd9dabac (diff) | |
download | gitea-48ad76c25e6ff103901f347c3b53f80b483498c4.tar.gz gitea-48ad76c25e6ff103901f347c3b53f80b483498c4.zip |
Fix repolist icons (#12228)
Fixes: https://github.com/go-gitea/gitea/issues/12226
Diffstat (limited to 'web_src/js/index.js')
-rw-r--r-- | web_src/js/index.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js index 8064e59507..de3522983a 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -19,6 +19,7 @@ import initTableSort from './features/tablesort.js'; import ActivityTopAuthors from './components/ActivityTopAuthors.vue'; import {initNotificationsTable, initNotificationCount} from './features/notification.js'; import {createCodeEditor} from './features/codeeditor.js'; +import {svgs} from './svg.js'; const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; @@ -2625,6 +2626,15 @@ function linkEmailAction(e) { } function initVueComponents() { + // register svg icon vue components, e.g. <octicon-repo size="16"/> + for (const [name, htmlString] of Object.entries(svgs)) { + const template = htmlString + .replace(/height="[0-9]+"/, 'v-bind:height="size"') + .replace(/width="[0-9]+"/, 'v-bind:width="size"'); + + Vue.component(name, {props: ['size'], template}); + } + const vueDelimeters = ['${', '}']; Vue.component('repo-search', { @@ -2950,7 +2960,7 @@ function initVueComponents() { }); }, - repoClass(repo) { + repoIcon(repo) { if (repo.fork) { return 'octicon-repo-forked'; } else if (repo.mirror) { |