Commit 6686bcdd authored by Markus Opolka's avatar Markus Opolka
Browse files

Fix capitalization in Feature component

parent 08864f42
<template> <template>
<ul style="list-style-type:none; padding:8px;"> <ul style="list-style-type:none; padding:8px;">
<template v-for="(child, name) in root"> <template v-for="(child, name) in root">
<li><v-chip label outline small color="blue darken-4">{{underscore(capitalize(name))}}</v-chip> <li><v-chip label outline small color="blue darken-4">{{header(name)}}</v-chip>
<span v-if="isText(child)"> {{child._text}}</span> <span v-if="isText(child)"> {{child._text}}</span>
<ul v-if="isFeature(child)" style="list-style-type:none; padding:5px;"> <ul v-if="isFeature(child)" style="list-style-type:none; padding:5px;">
<li v-for="attr in child.feature"> <li v-for="attr in child.feature">
<span v-if="attr._attributes"> <span v-if="attr._attributes">
<v-tooltip right> <v-tooltip right>
<v-chip label small v-on:click.native="mark(attr.ref)" slot="activator"> <v-chip label small v-on:click.native="mark(attr.ref)" slot="activator" :color="background">
<span v-if="attr._attributes.category">Category: {{(attr._attributes.category)}}</span> <span v-if="attr._attributes.category">Category: {{(attr._attributes.category)}}</span>
<span v-if="attr._attributes.type">, Type: {{(attr._attributes.type)}}</span> <span v-if="attr._attributes.type">, Type: {{(attr._attributes.type)}}</span>
<span v-if="attr._attributes.subtype">, Subtype: {{(attr._attributes.subtype)}}</span> <span v-if="attr._attributes.subtype">, Subtype: {{(attr._attributes.subtype)}}</span>
...@@ -17,16 +17,16 @@ ...@@ -17,16 +17,16 @@
</span> </span>
<span v-else-if="attr.category"> <span v-else-if="attr.category">
<v-tooltip right> <v-tooltip right>
<v-chip label small v-on:click.native="mark(attr.ref)" slot="activator"> <v-chip label small v-on:click.native="mark(attr.ref)" slot="activator" :color="background">
<span v-if="attr.category">Category: {{(attr.category)}}</span> <span v-if="attr.category">Category: {{(attr.category)}}</span>
<span v-if="attr.type">, Type: {{(attr.type)}}</span> <span v-if="attr.type">, Type: {{(attr.type)}}</span>
<span v-if="attr.subtype">, Subtype: {{(attr.subtype)}}</span> <span v-if="attr.subtype">, Subtype: {{(attr.subtype)}}</span>
</v-chip> </v-chip>
<span v-if="attr.ref">Lines: {{attr.ref}}</span> <span>Lines: {{attr.ref}}</span>
</v-tooltip> </v-tooltip>
</span> </span>
<span v-else> <span v-else>
<v-chip label small> <v-chip label small :color="background">
{{cutoff(attr)}} {{cutoff(attr)}}
</v-chip> </v-chip>
</span> </span>
...@@ -43,16 +43,15 @@ export default { ...@@ -43,16 +43,15 @@ export default {
// Recursive Component for Features in a Letter // Recursive Component for Features in a Letter
data () { data () {
return { return {
data: null data: null,
background: 'white'
} }
}, },
methods: { methods: {
mark (ref) {
// console.log(ref)
},
capitalize (str) { capitalize (str) {
str = String(str) str = String(str)
return str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase() }) str = str.replace(/\b\w/g, l => l.toUpperCase())
return str
}, },
underscore (str) { underscore (str) {
str = String(str) str = String(str)
...@@ -62,6 +61,20 @@ export default { ...@@ -62,6 +61,20 @@ export default {
str = String(str) str = String(str)
return str.substr(0, 100) return str.substr(0, 100)
}, },
umlaut (str) {
str = String(str)
str = str.replace(/ue/g, 'ü')
str = str.replace(/ae/g, 'ä')
str = str.replace(/Ae/g, 'Ä')
str = str.replace(/oe/g, 'ö')
return str
},
header (str) {
str = this.underscore(str)
str = this.capitalize(str)
str = this.umlaut(str)
return str
},
isAttribute (obj) { isAttribute (obj) {
return Object.keys(obj)[0] === '_attributes' return Object.keys(obj)[0] === '_attributes'
}, },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment