Commit fa6d7094 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Decorate server response objects

Set property defaults and match JS variable naming conventions
parent 8b2eaa60
......@@ -10,7 +10,7 @@ export default {
},
methods: {
toggleSubGroups() {
if (!this.group.subGroups || (this.group.subGroups && !this.group.subGroups.length)) {
if (!this.group.hasSubgroups) {
return;
}
......@@ -22,7 +22,7 @@ export default {
<template>
<li @click="toggleSubGroups" class="list-group-item">
<span v-show="group.subGroups && group.subGroups.length">
<span v-show="group.hasSubgroups">
<i
v-show="group.isOpen"
class="fa fa-caret-down"
......@@ -33,7 +33,7 @@ export default {
aria-hidden="true"/>
</span>
<p><a :href="group.web_url">{{group.full_name}}</a></p>
<p><a :href="group.webUrl">{{group.fullName}}</a></p>
<p>{{group.description}}</p>
<group-folder v-if="group.subGroups && group.isOpen" :groups="group.subGroups" />
......
......@@ -18,9 +18,14 @@ export default class GroupsStore {
}
static decorateGroup(rawGroup) {
const group = rawGroup;
group.isOpen = false;
return group;
return {
fullName: rawGroup.name,
description: rawGroup.description,
webUrl: rawGroup.web_url,
parentId: rawGroup.parentId,
hasSubgroups: !!rawGroup.parent_id,
isOpen: false,
};
}
static toggleSubGroups(toggleGroup) {
......
Markdown is supported
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