mirror of
https://github.com/wekan/wekan.git
synced 2025-12-29 21:58:49 +01:00
Add support for clicking label names and board titles
This commit is contained in:
parent
52f920db12
commit
61c691a267
4 changed files with 82 additions and 11 deletions
|
|
@ -32,15 +32,28 @@ template(name="globalSearch")
|
||||||
+resultCard(card)
|
+resultCard(card)
|
||||||
else
|
else
|
||||||
.global-search-instructions
|
.global-search-instructions
|
||||||
h2 Label Colors
|
h2 Boards
|
||||||
.palette-colors: each label in labelColors
|
.lists-wrapper
|
||||||
span.card-label.palette-color.js-palette-color(class="card-label-{{label.color}}")
|
each title in myBoardNames.get
|
||||||
= label.name
|
span.card-label.list-title.js-board-title
|
||||||
|
= title
|
||||||
h2 Lists
|
h2 Lists
|
||||||
.lists-wrapper
|
.lists-wrapper
|
||||||
each title in myLists.get
|
each title in myLists.get
|
||||||
span.card-label.list-title.js-list-title
|
span.card-label.list-title.js-list-title
|
||||||
= title
|
= title
|
||||||
|
h2 Label Colors
|
||||||
|
.palette-colors: each label in labelColors
|
||||||
|
span.card-label.palette-color.js-label-color(class="card-label-{{label.color}}")
|
||||||
|
= label.name
|
||||||
|
if myLabelNames.get.length
|
||||||
|
h2 Label Names
|
||||||
|
.lists-wrapper
|
||||||
|
each name in myLabelNames.get
|
||||||
|
span.card-label.list-title.js-label-name
|
||||||
|
= name
|
||||||
|
+viewer
|
||||||
|
= searchInstructions
|
||||||
|
|
||||||
template(name="globalSearchViewChangePopup")
|
template(name="globalSearchViewChangePopup")
|
||||||
if currentUser
|
if currentUser
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ BlazeComponent.extendComponent({
|
||||||
this.resultsHeading = new ReactiveVar('');
|
this.resultsHeading = new ReactiveVar('');
|
||||||
this.searchLink = new ReactiveVar(null);
|
this.searchLink = new ReactiveVar(null);
|
||||||
this.myLists = new ReactiveVar([]);
|
this.myLists = new ReactiveVar([]);
|
||||||
|
this.myLabelNames = new ReactiveVar([]);
|
||||||
|
this.myBoardNames = new ReactiveVar([]);
|
||||||
this.queryParams = null;
|
this.queryParams = null;
|
||||||
this.parsingErrors = [];
|
this.parsingErrors = [];
|
||||||
this.resultsCount = 0;
|
this.resultsCount = 0;
|
||||||
|
|
@ -63,6 +65,18 @@ BlazeComponent.extendComponent({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Meteor.call('myLabelNames', (err, data) => {
|
||||||
|
if (!err) {
|
||||||
|
this.myLabelNames.set(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.call('myBoardNames', (err, data) => {
|
||||||
|
if (!err) {
|
||||||
|
this.myBoardNames.set(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Meteor.subscribe('setting');
|
Meteor.subscribe('setting');
|
||||||
if (Session.get('globalQuery')) {
|
if (Session.get('globalQuery')) {
|
||||||
this.searchAllBoards(Session.get('globalQuery'));
|
this.searchAllBoards(Session.get('globalQuery'));
|
||||||
|
|
@ -119,11 +133,13 @@ BlazeComponent.extendComponent({
|
||||||
messages.push({ tag: 'list-title-not-found', value: list });
|
messages.push({ tag: 'list-title-not-found', value: list });
|
||||||
});
|
});
|
||||||
this.queryErrors.notFound.labels.forEach(label => {
|
this.queryErrors.notFound.labels.forEach(label => {
|
||||||
const color = TAPi18n.__(`color-${label}`);
|
const color = Object.entries(this.colorMap)
|
||||||
if (color) {
|
.filter(value => value[1] === label)
|
||||||
|
.map(value => value[0]);
|
||||||
|
if (color.length) {
|
||||||
messages.push({
|
messages.push({
|
||||||
tag: 'label-color-not-found',
|
tag: 'label-color-not-found',
|
||||||
value: color,
|
value: color[0],
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
messages.push({ tag: 'label-not-found', value: label });
|
messages.push({ tag: 'label-not-found', value: label });
|
||||||
|
|
@ -378,14 +394,36 @@ BlazeComponent.extendComponent({
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
this.searchAllBoards(evt.target.searchQuery.value);
|
this.searchAllBoards(evt.target.searchQuery.value);
|
||||||
},
|
},
|
||||||
'click .js-palette-color'(evt) {
|
'click .js-label-color'(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
this.query.set(
|
this.query.set(
|
||||||
`${this.query.get()} label:"${evt.currentTarget.textContent}"`,
|
`${this.query.get()} ${TAPi18n.__('operator-label')}:"${
|
||||||
|
evt.currentTarget.textContent
|
||||||
|
}"`,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
'click .js-board-title'(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.query.set(
|
||||||
|
`${this.query.get()} ${TAPi18n.__('operator-board')}:"${
|
||||||
|
evt.currentTarget.textContent
|
||||||
|
}"`,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'click .js-list-title'(evt) {
|
'click .js-list-title'(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
this.query.set(
|
this.query.set(
|
||||||
`${this.query.get()} list:"${evt.currentTarget.textContent}"`,
|
`${this.query.get()} ${TAPi18n.__('operator-list')}:"${
|
||||||
|
evt.currentTarget.textContent
|
||||||
|
}"`,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
'click .js-label-name'(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.query.set(
|
||||||
|
`${this.query.get()} ${TAPi18n.__('operator-label')}:"${
|
||||||
|
evt.currentTarget.textContent
|
||||||
|
}"`,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1324,6 +1324,26 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
myLabelNames() {
|
||||||
|
let names = [];
|
||||||
|
Boards.userBoards(Meteor.userId()).forEach(board => {
|
||||||
|
names = names.concat(
|
||||||
|
board.labels
|
||||||
|
.filter(label => !!label.name)
|
||||||
|
.map(label => {
|
||||||
|
return label.name;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return _.uniq(names).sort();
|
||||||
|
},
|
||||||
|
myBoardNames() {
|
||||||
|
return _.uniq(
|
||||||
|
Boards.userBoards(Meteor.userId()).map(board => {
|
||||||
|
return board.title;
|
||||||
|
}),
|
||||||
|
).sort();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ Meteor.methods({
|
||||||
.map(list => {
|
.map(list => {
|
||||||
return list.title;
|
return list.title;
|
||||||
}),
|
}),
|
||||||
);
|
).sort();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue