Commit a3e52ef9 authored by Phil Hughes's avatar Phil Hughes

Pulls down issues for lists

parent 3e839b34
...@@ -4,16 +4,21 @@ class List { ...@@ -4,16 +4,21 @@ class List {
this.position = obj.position; this.position = obj.position;
this.title = obj.title; this.title = obj.title;
this.type = obj.list_type; this.type = obj.list_type;
this.issues = [];
if (obj.label) { if (obj.label) {
this.label = new Label(obj.label); this.label = new Label(obj.label);
} }
if (obj.issues) { if (this.type !== 'blank') {
this.issues = []; service.getIssuesForList(this.id)
obj.issues.forEach((issue) => { .then((resp) => {
this.issues.push(new Issue(issue)); const data = resp.json();
});
data.forEach((issue) => {
this.issues.push(new Issue(issue));
});
});
} }
} }
......
...@@ -4,6 +4,7 @@ class BoardService { ...@@ -4,6 +4,7 @@ class BoardService {
this.lists = Vue.resource(`${root}{/id}.json`, {}); this.lists = Vue.resource(`${root}{/id}.json`, {});
this.list = Vue.resource(`${root}/lists{/id}.json`, {}); this.list = Vue.resource(`${root}/lists{/id}.json`, {});
this.issues = Vue.resource(`${root}/lists{/id}/issues.json`, {});
} }
setCSRF () { setCSRF () {
...@@ -40,4 +41,10 @@ class BoardService { ...@@ -40,4 +41,10 @@ class BoardService {
return this.list.delete({ id }); return this.list.delete({ id });
} }
getIssuesForList (id) {
this.setCSRF();
return this.issues.get({ id });
}
}; };
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
%span.card-number %span.card-number
= precede '#' do = precede '#' do
{{ issue.id }} {{ 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 }} {{ label.title }}
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