Skip to content
Snippets Groups Projects
Commit dabbe180 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

fix errors on articles without definitions

parent 4e428046
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,12 @@ export default { ...@@ -87,7 +87,12 @@ export default {
computed: { computed: {
snippet: function() { snippet: function() {
return this.parse_definitions(this.article.body.definitions) if (this.article.body.definitions) {
return this.parse_definitions(this.article.body.definitions)
}
return null
}, },
collapsable: function() { collapsable: function() {
...@@ -136,6 +141,7 @@ export default { ...@@ -136,6 +141,7 @@ export default {
let definitionTexts = [] let definitionTexts = []
node.forEach((definition) => { node.forEach((definition) => {
if (definition.elements) {
if (definition.elements[0].content) { if (definition.elements[0].content) {
let new_string = "" let new_string = ""
let old_parts = definition.elements[0].content.split(/(\$)/) let old_parts = definition.elements[0].content.split(/(\$)/)
...@@ -171,6 +177,7 @@ export default { ...@@ -171,6 +177,7 @@ export default {
else if (definition.elements[0].elements) { else if (definition.elements[0].elements) {
definitionTexts.push(this.parse_definitions(definition.elements)) definitionTexts.push(this.parse_definitions(definition.elements))
} }
}
}) })
let definitions = definitionTexts.join(" | ") let definitions = definitionTexts.join(" | ")
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
</v-card> </v-card>
</v-menu>) </v-menu>)
</span> </span>
<span v-if="$parent.collapsed && $parent.has_content" class="definition_snippet"> <span v-if="$parent.collapsed && $parent.snippet && $parent.has_content" class="definition_snippet">
| {{$parent.snippet}} {{group_list.length? "| ":""}}{{$parent.snippet}}
</span> <span v-if="$parent.collapsable" > </span> <span v-if="$parent.collapsable" >
<v-btn class="expand_icon" <v-btn class="expand_icon"
:title="$parent.collapsed? 'Vis mer' : 'Kollaps'" :title="$parent.collapsed? 'Vis mer' : 'Kollaps'"
......
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