Skip to content

Commit

Permalink
feat: hide duplicated fields in ItemDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Aug 27, 2020
1 parent 3409e77 commit 6005cbd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
38 changes: 23 additions & 15 deletions components/ItemDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,37 @@ export default {
? field.groups
: [field.groups];
for (let g in groupsList) {
let groupName = groupsList[g];
if (!(groupName in groups)) {
groups[groupName] = { name: groupName, fields: [] };
}
field.validateClass = this.getColumnValidateClass(field.value, field.validate);
field.validateClass = this.getColumnValidateClass(field.value, field.validate);
// console.log(fieldName + ' validateClass: ', field.validateClass);
// console.log(fieldName + ' validateClass: ', field.validateClass);
let valueText;
let valueText;
if (field.type == "boolean") {
valueText = parseInt(field.value) ? "yes" : "no"; // tolang
}
if (field.type == "boolean") {
valueText = parseInt(field.value) ? "yes" : "no"; // tolang
}
if (typeof val === 'string' && (field.type === 'image' || val.match(/^http.*\.(jpg|jpeg|png|gif)$/)) && val) {
valueText = `<img alt="error loading image" style="width: 150px; height: auto;" src="${val}" title="${val}"/>`;
}
if (typeof val === 'string' && (field.type === 'image' || val.match(/^http.*\.(jpg|jpeg|png|gif)$/)) && val) {
valueText = `<img alt="error loading image" style="width: 150px; height: auto;" src="${val}" title="${val}"/>`;
field.valueText = valueText;
// add to groups
for (let g in groupsList) {
console.log('g: ', g);
let groupName = groupsList[g];
if (!(groupName in groups)) {
groups[groupName] = { name: groupName, fields: [] };
}
field.valueText = valueText;
groups[groupName].fields.push(field);
const f = {...field};
// hide field duplicates
if (g != 0) f.validateClass += ' secondary group-'+ groupName;
groups[groupName].fields.push(f);
}
}
// console.log('groups: ', groups);
Expand Down
7 changes: 7 additions & 0 deletions pages/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@
vertical-align: top;
}

&.secondary {
opacity: 0.3;
&:hover {
opacity: 1;
}
}

.item-details__value {
min-width: 75px;
display: inline-block;
Expand Down

0 comments on commit 6005cbd

Please sign in to comment.