+
+
+ #{{ issue.id }}
+
+
+
+
+
+ `,
+};
diff --git a/app/assets/javascripts/boards/components/issue_card_labels.js b/app/assets/javascripts/boards/components/issue_card_labels.js
new file mode 100644
index 0000000000000000000000000000000000000000..9055963a1ef81b09c27d896842856beac12dfca5
--- /dev/null
+++ b/app/assets/javascripts/boards/components/issue_card_labels.js
@@ -0,0 +1,67 @@
+import eventHub from '../eventhub';
+
+const Store = gl.issueBoards.BoardsStore;
+
+window.gl = window.gl || {};
+window.gl.issueBoards = window.gl.issueBoards || {};
+
+export default {
+ name: 'IssueCardLabels',
+ props: {
+ issue: { type: Object, required: true },
+ issueLinkBase: { type: String, required: true },
+ list: { type: Object, required: false },
+ rootPath: { type: String, required: true },
+ updateFilters: { type: Boolean, required: false, default: false },
+ },
+ methods: {
+ showLabel(label) {
+ if (!this.list) return true;
+
+ return !this.list.label || label.id !== this.list.label.id;
+ },
+ filterByLabel(label, e) {
+ if (!this.updateFilters) return;
+
+ const filterPath = gl.issueBoards.BoardsStore.filter.path.split('&');
+ const labelTitle = encodeURIComponent(label.title);
+ const param = `label_name[]=${labelTitle}`;
+ const labelIndex = filterPath.indexOf(param);
+ $(e.currentTarget).tooltip('hide');
+
+ if (labelIndex === -1) {
+ filterPath.push(param);
+ } else {
+ filterPath.splice(labelIndex, 1);
+ }
+
+ gl.issueBoards.BoardsStore.filter.path = filterPath.join('&');
+
+ Store.updateFiltersUrl();
+
+ eventHub.$emit('updateTokens');
+ },
+ labelStyle(label) {
+ return {
+ backgroundColor: label.color,
+ color: label.textColor,
+ };
+ },
+ },
+ template: `
+
+
+
+ `,
+};