mirror of
https://github.com/wekan/wekan.git
synced 2025-12-23 19:00:12 +01:00
Make search instructions code more uniform
This commit is contained in:
parent
e0b544fc7e
commit
28aebaa06b
3 changed files with 54 additions and 60 deletions
|
|
@ -477,57 +477,42 @@ class GlobalSearchComponent extends CardSearchPagedComponent {
|
||||||
predicate_member: TAPi18n.__('predicate-member'),
|
predicate_member: TAPi18n.__('predicate-member'),
|
||||||
};
|
};
|
||||||
|
|
||||||
let text = `# ${TAPi18n.__('globalSearch-instructions-heading')}`;
|
let text = '';
|
||||||
text += `\n${TAPi18n.__('globalSearch-instructions-description', tags)}`;
|
|
||||||
text += `\n\n${TAPi18n.__('globalSearch-instructions-operators', tags)}`;
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'globalSearch-instructions-operator-board',
|
['# ', 'globalSearch-instructions-heading'],
|
||||||
'globalSearch-instructions-operator-list',
|
['\n', 'globalSearch-instructions-description'],
|
||||||
'globalSearch-instructions-operator-swimlane',
|
['\n\n', 'globalSearch-instructions-operators'],
|
||||||
'globalSearch-instructions-operator-comment',
|
['\n* ', 'globalSearch-instructions-operator-board'],
|
||||||
'globalSearch-instructions-operator-label',
|
['\n* ', 'globalSearch-instructions-operator-list'],
|
||||||
'globalSearch-instructions-operator-hash',
|
['\n* ', 'globalSearch-instructions-operator-swimlane'],
|
||||||
'globalSearch-instructions-operator-user',
|
['\n* ', 'globalSearch-instructions-operator-comment'],
|
||||||
'globalSearch-instructions-operator-at',
|
['\n* ', 'globalSearch-instructions-operator-label'],
|
||||||
'globalSearch-instructions-operator-member',
|
['\n* ', 'globalSearch-instructions-operator-hash'],
|
||||||
'globalSearch-instructions-operator-assignee',
|
['\n* ', 'globalSearch-instructions-operator-user'],
|
||||||
'globalSearch-instructions-operator-due',
|
['\n* ', 'globalSearch-instructions-operator-at'],
|
||||||
'globalSearch-instructions-operator-created',
|
['\n* ', 'globalSearch-instructions-operator-member'],
|
||||||
'globalSearch-instructions-operator-modified',
|
['\n* ', 'globalSearch-instructions-operator-assignee'],
|
||||||
'globalSearch-instructions-operator-status',
|
['\n* ', 'globalSearch-instructions-operator-due'],
|
||||||
].forEach(instruction => {
|
['\n* ', 'globalSearch-instructions-operator-created'],
|
||||||
text += `\n* ${TAPi18n.__(instruction, tags)}`;
|
['\n* ', 'globalSearch-instructions-operator-modified'],
|
||||||
});
|
['\n* ', 'globalSearch-instructions-operator-status'],
|
||||||
|
['\n * ', 'globalSearch-instructions-status-archived'],
|
||||||
[
|
['\n * ', 'globalSearch-instructions-status-public'],
|
||||||
'globalSearch-instructions-status-archived',
|
['\n * ', 'globalSearch-instructions-status-private'],
|
||||||
'globalSearch-instructions-status-public',
|
['\n * ', 'globalSearch-instructions-status-all'],
|
||||||
'globalSearch-instructions-status-private',
|
['\n * ', 'globalSearch-instructions-status-ended'],
|
||||||
'globalSearch-instructions-status-all',
|
['\n* ', 'globalSearch-instructions-operator-has'],
|
||||||
'globalSearch-instructions-status-ended',
|
['\n* ', 'globalSearch-instructions-operator-sort'],
|
||||||
].forEach(instruction => {
|
['\n* ', 'globalSearch-instructions-operator-limit'],
|
||||||
text += `\n * ${TAPi18n.__(instruction, tags)}`;
|
['\n## ', 'heading-notes'],
|
||||||
});
|
['\n* ', 'globalSearch-instructions-notes-1'],
|
||||||
|
['\n* ', 'globalSearch-instructions-notes-2'],
|
||||||
[
|
['\n* ', 'globalSearch-instructions-notes-3'],
|
||||||
'globalSearch-instructions-operator-has',
|
['\n* ', 'globalSearch-instructions-notes-3-2'],
|
||||||
'globalSearch-instructions-operator-sort',
|
['\n* ', 'globalSearch-instructions-notes-4'],
|
||||||
'globalSearch-instructions-operator-limit',
|
['\n* ', 'globalSearch-instructions-notes-5'],
|
||||||
].forEach(instruction => {
|
].forEach(([prefix, instruction]) => {
|
||||||
text += `\n* ${TAPi18n.__(instruction, tags)}`;
|
text += `${prefix}${TAPi18n.__(instruction, tags)}`;
|
||||||
});
|
|
||||||
|
|
||||||
text += `\n## ${TAPi18n.__('heading-notes')}`;
|
|
||||||
[
|
|
||||||
'globalSearch-instructions-notes-1',
|
|
||||||
'globalSearch-instructions-notes-2',
|
|
||||||
'globalSearch-instructions-notes-3',
|
|
||||||
'globalSearch-instructions-notes-3-2',
|
|
||||||
'globalSearch-instructions-notes-4',
|
|
||||||
'globalSearch-instructions-notes-5',
|
|
||||||
].forEach(instruction => {
|
|
||||||
text += `\n* ${TAPi18n.__(instruction, tags)}`;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|
|
||||||
|
|
@ -946,7 +946,7 @@
|
||||||
"globalSearch-instructions-operator-swimlane": "`__operator_swimlane__:<title>` - cards in swimlanes matching the specified *<title>*",
|
"globalSearch-instructions-operator-swimlane": "`__operator_swimlane__:<title>` - cards in swimlanes matching the specified *<title>*",
|
||||||
"globalSearch-instructions-operator-comment": "`__operator_comment__:<text>` - cards with a comment containing *<text>*.",
|
"globalSearch-instructions-operator-comment": "`__operator_comment__:<text>` - cards with a comment containing *<text>*.",
|
||||||
"globalSearch-instructions-operator-label": "`__operator_label__:<color>` `__operator_label__:<name>` - cards that have a label matching *<color>* or *<name>",
|
"globalSearch-instructions-operator-label": "`__operator_label__:<color>` `__operator_label__:<name>` - cards that have a label matching *<color>* or *<name>",
|
||||||
"globalSearch-instructions-operator-hash": "`__operator_label_abbrev__<name | color>` - shorthand for `__operator_label__:<color>` or `__operator_label__:<name>`",
|
"globalSearch-instructions-operator-hash": "`__operator_label_abbrev__<name|color>` - shorthand for `__operator_label__:<color>` or `__operator_label__:<name>`",
|
||||||
"globalSearch-instructions-operator-user": "`__operator_user__:<username>` - cards where *<username>* is a *member* or *assignee*",
|
"globalSearch-instructions-operator-user": "`__operator_user__:<username>` - cards where *<username>* is a *member* or *assignee*",
|
||||||
"globalSearch-instructions-operator-at": "`__operator_user_abbrev__username` - shorthand for `user:<username>`",
|
"globalSearch-instructions-operator-at": "`__operator_user_abbrev__username` - shorthand for `user:<username>`",
|
||||||
"globalSearch-instructions-operator-member": "`__operator_member__:<username>` - cards where *<username>* is a *member*",
|
"globalSearch-instructions-operator-member": "`__operator_member__:<username>` - cards where *<username>* is a *member*",
|
||||||
|
|
|
||||||
|
|
@ -94,11 +94,19 @@ function buildQuery(sessionId, queryParams) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.notFound.labels.forEach(label => {
|
this.notFound.labels.forEach(label => {
|
||||||
|
if (Boards.labelColors().includes(label)) {
|
||||||
|
messages.push({
|
||||||
|
tag: 'label-color-not-found',
|
||||||
|
value: label,
|
||||||
|
color: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
messages.push({
|
messages.push({
|
||||||
tag: 'label-not-found',
|
tag: 'label-not-found',
|
||||||
value: label,
|
value: label,
|
||||||
color: Boards.labelColors().includes(label),
|
color: false,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.notFound.users.forEach(user => {
|
this.notFound.users.forEach(user => {
|
||||||
messages.push({ tag: 'user-username-not-found', value: user });
|
messages.push({ tag: 'user-username-not-found', value: user });
|
||||||
|
|
@ -643,7 +651,7 @@ Meteor.publish('previousPage', function(sessionId) {
|
||||||
return findCards(sessionId, session.getSelector(), projection);
|
return findCards(sessionId, session.getSelector(), projection);
|
||||||
});
|
});
|
||||||
|
|
||||||
function findCards(sessionId, selector, projection, errors = null) {
|
function findCards(sessionId, selector, projection, errors = []) {
|
||||||
const userId = Meteor.userId();
|
const userId = Meteor.userId();
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
@ -666,11 +674,12 @@ function findCards(sessionId, selector, projection, errors = null) {
|
||||||
cards: [],
|
cards: [],
|
||||||
selector: SessionData.pickle(selector),
|
selector: SessionData.pickle(selector),
|
||||||
projection: SessionData.pickle(projection),
|
projection: SessionData.pickle(projection),
|
||||||
|
errors: errors.errorMessages(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (errors) {
|
// if (errors) {
|
||||||
update.$set.errors = errors.errorMessages();
|
// update.$set.errors = errors.errorMessages();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (cards) {
|
if (cards) {
|
||||||
update.$set.totalHits = cards.count();
|
update.$set.totalHits = cards.count();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue