diff options
-rw-r--r-- | app/assets/javascripts/releases/components/release_block.vue | 26 | ||||
-rw-r--r-- | changelogs/unreleased/38105-pre-release-tag.yml | 5 | ||||
-rw-r--r-- | locale/gitlab.pot | 3 | ||||
-rw-r--r-- | spec/javascripts/releases/components/release_block_spec.js | 14 |
4 files changed, 39 insertions, 9 deletions
diff --git a/app/assets/javascripts/releases/components/release_block.vue b/app/assets/javascripts/releases/components/release_block.vue index 0958b9fa926..f510b905a2e 100644 --- a/app/assets/javascripts/releases/components/release_block.vue +++ b/app/assets/javascripts/releases/components/release_block.vue @@ -1,6 +1,6 @@ <script> import _ from 'underscore'; -import { GlTooltipDirective, GlLink } from '@gitlab/ui'; +import { GlTooltipDirective, GlLink, GlBadge } from '@gitlab/ui'; import Icon from '~/vue_shared/components/icon.vue'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import timeagoMixin from '~/vue_shared/mixins/timeago'; @@ -10,6 +10,7 @@ export default { name: 'ReleaseBlock', components: { GlLink, + GlBadge, Icon, UserAvatarLink, }, @@ -53,7 +54,12 @@ export default { <template> <div class="card"> <div class="card-body"> - <h2 class="card-title mt-0">{{ release.name }}</h2> + <h2 class="card-title mt-0"> + {{ release.name }} + <gl-badge v-if="release.pre_release" variant="warning" class="align-middle">{{ + __('Pre-release') + }}</gl-badge> + </h2> <div class="card-subtitle d-flex flex-wrap text-secondary"> <div class="append-right-8"> @@ -68,9 +74,9 @@ export default { <div class="append-right-4"> • - <span v-gl-tooltip.bottom :title="tooltipTitle(release.created_at)">{{ - releasedTimeAgo - }}</span> + <span v-gl-tooltip.bottom :title="tooltipTitle(release.created_at)"> + {{ releasedTimeAgo }} + </span> </div> <div v-if="hasAuthor" class="d-flex"> @@ -98,7 +104,8 @@ export default { <li v-for="link in assets.links" :key="link.name" class="append-bottom-8"> <gl-link v-gl-tooltip.bottom :title="__('Download asset')" :href="link.url"> <icon name="package" class="align-middle append-right-4 align-text-bottom" /> - {{ link.name }} <span v-if="link.external"> {{ __('(external source)') }}</span> + {{ link.name }} + <span v-if="link.external">{{ __('(external source)') }}</span> </gl-link> </li> </ul> @@ -111,7 +118,8 @@ export default { aria-haspopup="true" aria-expanded="false" > - <icon name="doc-code" class="align-top append-right-4" /> {{ __('Source code') }} + <icon name="doc-code" class="align-top append-right-4" /> + {{ __('Source code') }} <icon name="arrow-down" /> </button> @@ -123,7 +131,9 @@ export default { </div> </div> - <div class="card-text prepend-top-default"><div v-html="release.description_html"></div></div> + <div class="card-text prepend-top-default"> + <div v-html="release.description_html"></div> + </div> </div> </div> </template> diff --git a/changelogs/unreleased/38105-pre-release-tag.yml b/changelogs/unreleased/38105-pre-release-tag.yml new file mode 100644 index 00000000000..d4c5dcacd19 --- /dev/null +++ b/changelogs/unreleased/38105-pre-release-tag.yml @@ -0,0 +1,5 @@ +--- +title: Renders a pre-release tag for releases +merge_request: 29797 +author: +type: changed diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 0cabaeabb9a..0cab68e2824 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -7330,6 +7330,9 @@ msgstr "" msgid "Please wait while we import the repository for you. Refresh at will." msgstr "" +msgid "Pre-release" +msgstr "" + msgid "Preferences" msgstr "" diff --git a/spec/javascripts/releases/components/release_block_spec.js b/spec/javascripts/releases/components/release_block_spec.js index 36b181f24ef..e98c665f99d 100644 --- a/spec/javascripts/releases/components/release_block_spec.js +++ b/spec/javascripts/releases/components/release_block_spec.js @@ -78,8 +78,10 @@ describe('Release block', () => { }; let vm; + const factory = props => mountComponent(Component, { release: props }); + beforeEach(() => { - vm = mountComponent(Component, { release }); + vm = factory(release); }); afterEach(() => { @@ -149,4 +151,14 @@ describe('Release block', () => { ); }); }); + + describe('with pre_release flag', () => { + beforeEach(() => { + vm = factory(Object.assign({}, release, { pre_release: true })); + }); + + it('renders pre-release badge', () => { + expect(vm.$el.textContent).toContain('Pre-release'); + }); + }); }); |