ribbon tests, ribbon positions, fixed ssr stuff, fied missing language things

This commit is contained in:
Ulf Gebhardt 2019-05-18 12:33:41 +02:00
parent 7095e38947
commit eda58c25e3
No known key found for this signature in database
GPG Key ID: 44C888923CC8E7F3
4 changed files with 80 additions and 51 deletions

View File

@ -1,39 +1,26 @@
<template> <template>
<ds-card <ds-card :image="post.image" :class="{'post-card': true, 'disabled-content': post.disabled}">
:image="post.image"
:class="{'post-card': true, 'disabled-content': post.disabled}"
>
<!-- Post Link Target --> <!-- Post Link Target -->
<nuxt-link <nuxt-link
class="post-link" class="post-link"
:to="{ name: 'post-id-slug', params: { id: post.id, slug: post.slug } }" :to="{ name: 'post-id-slug', params: { id: post.id, slug: post.slug } }"
> >{{ post.title }}</nuxt-link>
{{ post.title }} <ds-space margin-bottom="small"/>
</nuxt-link>
<ds-space margin-bottom="small" />
<!-- Username, Image & Date of Post --> <!-- Username, Image & Date of Post -->
<hc-user <div>
:user="post.author" <no-ssr>
:trunc="35" <hc-user :user="post.author" :trunc="35" :date-time="post.createdAt"/>
:date-time="post.createdAt" </no-ssr>
/> <hc-ribbon :text="$t('post.name')"/>
<hc-ribbon :text="$t('post.name')" /> </div>
<ds-space margin-bottom="small" /> <ds-space margin-bottom="small"/>
<!-- Post Title --> <!-- Post Title -->
<ds-heading <ds-heading tag="h3" no-margin>{{ post.title }}</ds-heading>
tag="h3" <ds-space margin-bottom="small"/>
no-margin
>
{{ post.title }}
</ds-heading>
<ds-space margin-bottom="small" />
<!-- Post Content Excerpt --> <!-- Post Content Excerpt -->
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<!-- TODO: replace editor content with tiptap render view --> <!-- TODO: replace editor content with tiptap render view -->
<div <div class="hc-editor-content" v-html="excerpt"/>
class="hc-editor-content"
v-html="excerpt"
/>
<!-- eslint-enable vue/no-v-html --> <!-- eslint-enable vue/no-v-html -->
<!-- Footer o the Post --> <!-- Footer o the Post -->
<template slot="footer"> <template slot="footer">
@ -46,27 +33,23 @@
:icon="category.icon" :icon="category.icon"
/> />
</div> </div>
<div style="display: inline-block; float: right"> <no-ssr>
<!-- Shouts Count --> <div style="display: inline-block; float: right">
<span :style="{ opacity: post.shoutedCount ? 1 : .5 }"> <!-- Shouts Count -->
<ds-icon name="bullhorn" /> <span :style="{ opacity: post.shoutedCount ? 1 : .5 }">
<small>{{ post.shoutedCount }}</small> <ds-icon name="bullhorn"/>
</span> <small>{{ post.shoutedCount }}</small>
&nbsp; </span>
<!-- Comments Count --> &nbsp;
<span :style="{ opacity: post.commentsCount ? 1 : .5 }"> <!-- Comments Count -->
<ds-icon name="comments" /> <span :style="{ opacity: post.commentsCount ? 1 : .5 }">
<small>{{ post.commentsCount }}</small> <ds-icon name="comments"/>
</span> <small>{{ post.commentsCount }}</small>
<!-- Menu --> </span>
<no-ssr> <!-- Menu -->
<content-menu <content-menu resource-type="contribution" :resource="post" :is-owner="isAuthor"/>
resource-type="contribution" </div>
:resource="post" </no-ssr>
:is-owner="isAuthor"
/>
</no-ssr>
</div>
</template> </template>
</ds-card> </ds-card>
</template> </template>
@ -98,7 +81,6 @@ export default {
user: 'auth/user' user: 'auth/user'
}), }),
excerpt() { excerpt() {
console.log(this.post)
return this.$filters.removeLinks(this.post.contentExcerpt) return this.$filters.removeLinks(this.post.contentExcerpt)
}, },
isAuthor() { isAuthor() {

View File

@ -0,0 +1,37 @@
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Ribbon from './index'
const localVue = createLocalVue()
describe('Ribbon', () => {
let text
let Wrapper = () => {
return shallowMount(Ribbon, {
localVue,
propsData: {
text
}
})
}
describe('given String for Text', () => {
beforeEach(() => {
text = 'Peter Pan'
})
it('shows Text', () => {
expect(Wrapper().text()).toContain('Peter Pan')
})
})
describe('given no String for Text', () => {
beforeEach(() => {
text = undefined
})
it('shows empty Text', () => {
expect(Wrapper().text()).toContain('')
})
})
})

View File

@ -19,14 +19,16 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.ribbon { .ribbon {
$card-shadow: 0px 12px 26px -4px rgba(0, 0, 0, 0.1); $card-shadow: 0px 12px 26px -4px rgba(0, 0, 0, 0.1);
position: absolute; //position: absolute;
position: relative;
right: -31px;
top: -31px;
font-size: 0.9em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
padding: 6px 6px; padding: 6px 6px;
color: #fff; color: #fff;
background-color: $background-color-secondary-active; background-color: $background-color-secondary-active;
right: -8px;
//top: -5px;
float: right; float: right;
border-radius: 2px 0 0 2px; border-radius: 2px 0 0 2px;
box-shadow: $card-shadow; box-shadow: $card-shadow;

View File

@ -135,6 +135,14 @@
"takeAction": { "takeAction": {
"name": "Aktiv werden" "name": "Aktiv werden"
}, },
"delete": {
"submit": "Löschen",
"cancel": "Abbrechen",
"success": "Beitrag erfolgreich gelöscht",
"title": "Beitrag löschen",
"type": "Beitrag",
"message": "Möchtest Du wirklich den Beitrag \"<b>{name}</b>\" löschen?"
},
"comment": { "comment": {
"submit": "Kommentiere", "submit": "Kommentiere",
"submitted": "Kommentar Gesendet" "submitted": "Kommentar Gesendet"