2016-08-11 04:51:52 -04:00
|
|
|
(() => {
|
2016-08-16 04:02:45 -04:00
|
|
|
const Store = gl.issueBoards.BoardsStore;
|
|
|
|
|
2016-08-15 05:07:53 -04:00
|
|
|
window.gl = window.gl || {};
|
|
|
|
window.gl.issueBoards = window.gl.issueBoards || {};
|
|
|
|
|
|
|
|
gl.issueBoards.BoardCard = Vue.extend({
|
2016-08-08 09:30:38 -04:00
|
|
|
props: {
|
2016-08-10 12:19:56 -04:00
|
|
|
list: Object,
|
2016-08-08 09:30:38 -04:00
|
|
|
issue: Object,
|
|
|
|
issueLinkBase: String,
|
2016-08-15 11:06:19 -04:00
|
|
|
disabled: Boolean,
|
|
|
|
index: Number
|
2016-08-08 09:30:38 -04:00
|
|
|
},
|
|
|
|
methods: {
|
2016-08-15 04:41:06 -04:00
|
|
|
filterByLabel (label, e) {
|
2016-08-10 09:35:14 -04:00
|
|
|
let labelToggleText = label.title;
|
2016-08-16 04:02:45 -04:00
|
|
|
const labelIndex = Store.state.filters['label_name'].indexOf(label.title);
|
2016-08-15 04:41:06 -04:00
|
|
|
$(e.target).tooltip('hide');
|
2016-08-08 09:30:38 -04:00
|
|
|
|
|
|
|
if (labelIndex === -1) {
|
2016-08-16 04:02:45 -04:00
|
|
|
Store.state.filters['label_name'].push(label.title);
|
2016-08-10 09:35:14 -04:00
|
|
|
$('.labels-filter').prepend(`<input type="hidden" name="label_name[]" value="${label.title}" />`);
|
2016-08-08 09:30:38 -04:00
|
|
|
} else {
|
2016-08-16 04:02:45 -04:00
|
|
|
Store.state.filters['label_name'].splice(labelIndex, 1);
|
|
|
|
labelToggleText = Store.state.filters['label_name'][0];
|
2016-08-10 09:35:14 -04:00
|
|
|
$(`.labels-filter input[name="label_name[]"][value="${label.title}"]`).remove();
|
2016-08-08 09:30:38 -04:00
|
|
|
}
|
|
|
|
|
2016-08-16 04:02:45 -04:00
|
|
|
const selectedLabels = Store.state.filters['label_name'];
|
2016-08-10 09:35:14 -04:00
|
|
|
if (selectedLabels.length === 0) {
|
|
|
|
labelToggleText = 'Label';
|
|
|
|
} else if (selectedLabels.length > 1) {
|
|
|
|
labelToggleText = `${selectedLabels[0]} + ${selectedLabels.length - 1} more`;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('.labels-filter .dropdown-toggle-text').text(labelToggleText);
|
|
|
|
|
2016-08-16 04:02:45 -04:00
|
|
|
Store.updateFiltersUrl();
|
2016-10-04 10:27:02 -04:00
|
|
|
},
|
|
|
|
showIssue () {
|
2016-10-05 03:49:40 -04:00
|
|
|
Store.detail.issue = this.issue;
|
2016-08-08 09:30:38 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|