Skip to content
Snippets Groups Projects
Commit 06ddd283 authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

re meta#311

parent df5a0ecd
No related branches found
No related tags found
No related merge requests found
...@@ -8,18 +8,18 @@ ...@@ -8,18 +8,18 @@
<DefElement v-for="(element, index) in article.body.pronunciation" :dictionary="dictionary" :key="index" :body='element' @article-click="article_link_click" /> <DefElement v-for="(element, index) in article.body.pronunciation" :dictionary="dictionary" :key="index" :body='element' @article-click="article_link_click" />
</ul> </ul>
</section> </section>
<section v-if="article.body.etymology && article.body.etymology.length" class="etymology">
<h3>Etymologi</h3>
<ul>
<DefElement v-for="(element, index) in article.body.etymology" :dictionary="dictionary" :key="index" :body='element' @article-click="article_link_click" />
</ul>
</section>
<section class="definitions"> <section class="definitions">
<h3>{{def_label}}</h3> <h3>{{def_label}}</h3>
<ol> <ol>
<Definition v-for="definition in article.body.definitions" :dictionary="dictionary" :level="1" :key="definition.id" :body='definition' @article-click="article_link_click" /> <Definition v-for="definition in article.body.definitions" :dictionary="dictionary" :level="1" :key="definition.id" :body='definition' @article-click="article_link_click" />
</ol> </ol>
</section> </section>
<section v-if="article.body.etymology && article.body.etymology.length" class="etymology">
<h3>Etymologi</h3>
<ul>
<DefElement v-for="(element, index) in article.body.etymology" :dictionary="dictionary" :key="index" :body='element' @article-click="article_link_click" />
</ul>
</section>
<section v-if="sub_articles.length" class="expressions"> <section v-if="sub_articles.length" class="expressions">
<h3>Faste uttrykk</h3> <h3>Faste uttrykk</h3>
<ul> <ul>
...@@ -71,7 +71,10 @@ export default { ...@@ -71,7 +71,10 @@ export default {
return this.article.dictionary return this.article.dictionary
}, },
def_label: function() { def_label: function() {
return this.dictionary == 'bob' ? 'Betydning' : 'Tyding' return this.dictionary == 'bob' ? 'Betydning og bruk' : 'Tyding og bruk'
},
example_label: function() {
return this.dictionary == 'bob' ? 'Eksempel' : 'Døme'
}, },
sub_articles: function() { sub_articles: function() {
return this.article.body.definitions.reduce((acc, val) => acc.concat(find_sub_articles(val)), []).sort((s1, s2) => s1.lemmas[0].localeCompare(s2.lemmas[0])) return this.article.body.definitions.reduce((acc, val) => acc.concat(find_sub_articles(val)), []).sort((s1, s2) => s1.lemmas[0].localeCompare(s2.lemmas[0]))
...@@ -118,6 +121,7 @@ section { ...@@ -118,6 +121,7 @@ section {
h3 { h3 {
color: #560027; color: #560027;
font-variant: small-caps;
} }
li { li {
......
<template> <template>
<li :class="['definition', 'level'+level]" :ref="'def' + body.id" :id="'def' + body.id"> <li :class="['definition', 'level'+level]" :ref="'def' + body.id" :id="'def' + body.id">
<ul class="explanation"> <ul class="explanations">
<li :is="element_wrapper.template" :body="element_wrapper.element" :dictionary="element_wrapper.dictionary" v-for="(element_wrapper, index) in template_name_added" :key="index" @article-click="article_link_click">{{element_wrapper.element}}</li> <DefElement :body="explanation" :dictionary="dictionary" v-for="(explanation, index) in explanations" :key="index" @article-click="article_link_click" />
</ul>
<div v-if="examples.length">
<h4>{{example_header}}</h4>
<ul class="examples">
<Example :body="example" :dictionary="dictionary" v-for="(example, index) in examples" :key="index" @article-click="article_link_click" />
</ul>
</div>
<ul class="compound_lists">
<CompoundList :body="compound_list" :dictionary="dictionary" v-for="(compound_list, index) in compund_lists" :key="index" @article-click="article_link_click" />
</ul> </ul>
<div :is="level < 3 ? 'ol' : 'ul'" class="sub_definitions" v-if="subdefs.length"> <div :is="level < 3 ? 'ol' : 'ul'" class="sub_definitions" v-if="subdefs.length">
<Definition :level="level+1" :body="subdef" v-for="(subdef, index) in subdefs" :dictionary="dictionary" :key="index" @article-click="article_link_click" /> <Definition :level="level+1" :body="subdef" v-for="(subdef, index) in subdefs" :dictionary="dictionary" :key="index" @article-click="article_link_click" />
...@@ -28,20 +37,17 @@ var Definition = { ...@@ -28,20 +37,17 @@ var Definition = {
CompoundList CompoundList
}, },
computed: { computed: {
template_name_added: function(){ explanations: function() {
let dictionary = this.dictionary return this.body.elements.filter(el => el.type_ == 'explanation')
return this.body.elements.filter(el => ! ['definition', 'sub_article'].includes(el.type_)).map( },
function(element){ examples: function() {
return { return this.body.elements.filter(el => el.type_ == 'example')
'template': { },
'explanation': 'DefElement', compund_lists: function() {
'example': 'Example', return this.body.elements.filter(el => el.type_ == 'compound_list')
'compound_list': 'CompoundList' },
}[element.type_] || 'li', example_header: function() {
'element': element, return this.dictionary == 'bob' ? 'Eksempel' : 'Døme'
'dictionary': dictionary
}
})
}, },
subdefs: function() { subdefs: function() {
// filtrerer bort definisjoner som bare inneholder underartikler // filtrerer bort definisjoner som bare inneholder underartikler
...@@ -83,4 +89,11 @@ q { ...@@ -83,4 +89,11 @@ q {
background-color: var(--v-tertiary-darken1); background-color: var(--v-tertiary-darken1);
border-radius: 5px; border-radius: 5px;
} }
h4 {
color: var(--v-primary-base);
font-variant: small-caps;
padding-left: 12px;
padding-top: 6px;
}
</style> </style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment