Pulls down issues for lists
This commit is contained in:
parent
3e839b3468
commit
a3e52ef917
3 changed files with 18 additions and 6 deletions
|
@ -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));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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 }}
|
||||
|
|
Loading…
Reference in a new issue