From 8d6573a5f178fb115e3ba9458de946bc7b067af2 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Fri, 14 Oct 2022 20:50:01 +0300 Subject: [PATCH] Refactor badge generation page, add HTML option (#1251) * Adds HTML badge generation * Allows to generate badge for specific branch * Remembers last used option for badge syntax for current browser * Fixes base URL when custom port is used Screenshot: ![attels](https://user-images.githubusercontent.com/165205/195311734-6db0e85e-f659-486f-824f-4cabb659b81a.png) Co-authored-by: 6543 <6543@obermui.de> --- web/src/assets/locales/en.json | 7 +- web/src/components/repo/settings/BadgeTab.vue | 120 +++++++++++++++--- 2 files changed, 104 insertions(+), 23 deletions(-) diff --git a/web/src/assets/locales/en.json b/web/src/assets/locales/en.json index a0fb3acab..4870f0a05 100644 --- a/web/src/assets/locales/en.json +++ b/web/src/assets/locales/en.json @@ -170,8 +170,11 @@ }, "badge": { "badge": "Badge", - "url_branch": "URL for specific branch", - "markdown": "Markdown" + "type": "Syntax", + "type_url": "URL", + "type_markdown": "Markdown", + "type_html": "HTML", + "branch": "Branch" }, "actions": { "actions": "Actions", diff --git a/web/src/components/repo/settings/BadgeTab.vue b/web/src/components/repo/settings/BadgeTab.vue index 640c19c88..2da081ca9 100644 --- a/web/src/components/repo/settings/BadgeTab.vue +++ b/web/src/components/repo/settings/BadgeTab.vue @@ -7,55 +7,133 @@ -
-
-

{{ $t('url') }}

-
{{ baseUrl }}{{ badgeUrl }}
-
+ + + + + + +
-

{{ $t('repo.settings.badge.url_branch') }}

-
{{ baseUrl }}{{ badgeUrl }}?branch=<branch>
-
- -
-

{{ $t('repo.settings.badge.markdown') }}

-
[![status-badge]({{ baseUrl }}{{ badgeUrl }})]({{ baseUrl }}{{ repoUrl }})
+
{{ badgeContent }}