Pulls down issues for lists

This commit is contained in:
Phil Hughes 2016-08-04 17:24:53 +01:00
parent 3e839b3468
commit a3e52ef917
3 changed files with 18 additions and 6 deletions

View file

@ -4,16 +4,21 @@ class List {
this.position = obj.position;
this.title = obj.title;
this.type = obj.list_type;
this.issues = [];
if (obj.label) {
this.label = new Label(obj.label);
}
if (obj.issues) {
this.issues = [];
obj.issues.forEach((issue) => {
this.issues.push(new Issue(issue));
});
if (this.type !== 'blank') {
service.getIssuesForList(this.id)
.then((resp) => {
const data = resp.json();
data.forEach((issue) => {
this.issues.push(new Issue(issue));
});
});
}
}

View file

@ -4,6 +4,7 @@ class BoardService {
this.lists = Vue.resource(`${root}{/id}.json`, {});
this.list = Vue.resource(`${root}/lists{/id}.json`, {});
this.issues = Vue.resource(`${root}/lists{/id}/issues.json`, {});
}
setCSRF () {
@ -40,4 +41,10 @@ class BoardService {
return this.list.delete({ id });
}
getIssuesForList (id) {
this.setCSRF();
return this.issues.get({ id });
}
};

View file

@ -6,5 +6,5 @@
%span.card-number
= precede '#' do
{{ issue.id }}
%span.label.color-label{ "v-for" => "label in issue.labels", ":style" => "{ backgroundColor: label.backgroundColor, color: label.textColor }" }
%span.label.color-label{ "v-for" => "label in issue.labels", ":style" => "{ backgroundColor: label.color, color: label.textColor }" }
{{ label.title }}