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