Commit 3ea611e7 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds counter for number of children in each folder

parent 070165f0
......@@ -37,10 +37,10 @@
* Folder items have different behaviours - it is possible to toggle
* them and show their children.
*
* @returns {Number} The length of the children array
* @returns {Boolean}
*/
isFolder () {
return this.model.children && this.model.children.length
return this.model.children && this.model.children.length ? true : false;
},
/**
......@@ -51,6 +51,17 @@
*/
isChildren () {
return this.model['vue-isChildren'];
},
/**
* Counts the number of environments in each folder.
* Used to show a badge with the counter.
*
* @returns {Boolean} The number of environments for the current folder
*/
childrenCounter () {
return this.model.children && this.model.children.length;
}
},
......
......@@ -64,7 +64,7 @@
}
}
.children-row .environment-name{
.children-row .environment-name {
margin-left: 17px;
margin-right: -17px;
}
......@@ -75,6 +75,13 @@
.folder-name {
cursor: pointer;
.badge {
font-weight: normal;
background-color: $gray-darker;
color: $gl-placeholder-color;
vertical-align: baseline;
}
}
}
......
......@@ -15,6 +15,9 @@
{{model.name}}
%span.badge
{{childrenCounter}}
%td.deployment-column
%span{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.iid"}
= precede "#" do
......
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