-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: детали сайта на русском, SiteDetails component
- Loading branch information
Showing
3 changed files
with
123 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<template> | ||
<div class="site-details"> | ||
<a class="site-details__title" :href="site.url" target="_blank">{{ site.url }}</a> | ||
<div class="site-details__group" v-for="group in groups" :key="group.name"> | ||
<div class="site-details__group-name"></div> | ||
<ul class="site-details__group-fields"> | ||
<li v-for="field in group.fields" :key="field.name" :title="field.name"> | ||
<span class="site-details__label">{{ field.comment }}</span> | ||
<span class="site-details__value">{{ field.value }}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.VueTables__child-row { | ||
background: none !important; | ||
&-toggler { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
} | ||
} | ||
.site-details { | ||
padding: 15px; | ||
max-width: 100vw; | ||
overflow-x: auto; | ||
li { | ||
list-style: none; | ||
padding: 0; | ||
&:hover { | ||
background: #fbfbfb; | ||
} | ||
} | ||
&__title { | ||
font-size: 1.5rem; | ||
} | ||
&__group { | ||
margin-bottom: 15px; | ||
&-name { | ||
font-size: 1.2rem; | ||
font-weight: bold; | ||
} | ||
&-fields { | ||
padding: 0; | ||
} | ||
} | ||
&__label { | ||
display: inline-block; | ||
width: 290px; | ||
@media (max-width: 400px) { | ||
width: auto; | ||
margin-right: 0.5em; | ||
color: #999; | ||
&:after { | ||
content: ":"; | ||
} | ||
} | ||
} | ||
} | ||
</style> | ||
|
||
<script> | ||
export default { | ||
props: ["site"], | ||
computed: { | ||
tests() { | ||
return this.$store.state.tests; | ||
}, | ||
groups() { | ||
let groups = { unnamed: { name: "", fields: [] } }; | ||
for (let fieldName in this.site) { | ||
const fieldValue = this.site[fieldName]; | ||
if (typeof fieldValue === "object") continue; | ||
if (fieldValue === "") continue; | ||
const info = this.tests.find(test => test.name == fieldName); | ||
if (!info || !info.groups) { | ||
// groups.unnamed.fields.push(fieldValue); | ||
continue; | ||
} | ||
const groupsList = Array.isArray(info.groups) | ||
? info.groups | ||
: [info.groups]; | ||
for (let g in groupsList) { | ||
let groupName = groupsList[g]; | ||
if (!(groupName in groups)) { | ||
groups[groupName] = { name: groupName, fields: [] }; | ||
} | ||
info.value = fieldValue; | ||
groups[groupName].fields.push(info); | ||
} | ||
} | ||
return groups; | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters