mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04: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'),
|
||||
};
|
||||
|
||||
let text = `# ${TAPi18n.__('globalSearch-instructions-heading')}`;
|
||||
text += `\n${TAPi18n.__('globalSearch-instructions-description', tags)}`;
|
||||
text += `\n\n${TAPi18n.__('globalSearch-instructions-operators', tags)}`;
|
||||
|
||||
let text = '';
|
||||
[
|
||||
'globalSearch-instructions-operator-board',
|
||||
'globalSearch-instructions-operator-list',
|
||||
'globalSearch-instructions-operator-swimlane',
|
||||
'globalSearch-instructions-operator-comment',
|
||||
'globalSearch-instructions-operator-label',
|
||||
'globalSearch-instructions-operator-hash',
|
||||
'globalSearch-instructions-operator-user',
|
||||
'globalSearch-instructions-operator-at',
|
||||
'globalSearch-instructions-operator-member',
|
||||
'globalSearch-instructions-operator-assignee',
|
||||
'globalSearch-instructions-operator-due',
|
||||
'globalSearch-instructions-operator-created',
|
||||
'globalSearch-instructions-operator-modified',
|
||||
'globalSearch-instructions-operator-status',
|
||||
].forEach(instruction => {
|
||||
text += `\n* ${TAPi18n.__(instruction, tags)}`;
|
||||
});
|
||||
|
||||
[
|
||||
'globalSearch-instructions-status-archived',
|
||||
'globalSearch-instructions-status-public',
|
||||
'globalSearch-instructions-status-private',
|
||||
'globalSearch-instructions-status-all',
|
||||
'globalSearch-instructions-status-ended',
|
||||
].forEach(instruction => {
|
||||
text += `\n * ${TAPi18n.__(instruction, tags)}`;
|
||||
});
|
||||
|
||||
[
|
||||
'globalSearch-instructions-operator-has',
|
||||
'globalSearch-instructions-operator-sort',
|
||||
'globalSearch-instructions-operator-limit',
|
||||
].forEach(instruction => {
|
||||
text += `\n* ${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)}`;
|
||||
['# ', 'globalSearch-instructions-heading'],
|
||||
['\n', 'globalSearch-instructions-description'],
|
||||
['\n\n', 'globalSearch-instructions-operators'],
|
||||
['\n* ', 'globalSearch-instructions-operator-board'],
|
||||
['\n* ', 'globalSearch-instructions-operator-list'],
|
||||
['\n* ', 'globalSearch-instructions-operator-swimlane'],
|
||||
['\n* ', 'globalSearch-instructions-operator-comment'],
|
||||
['\n* ', 'globalSearch-instructions-operator-label'],
|
||||
['\n* ', 'globalSearch-instructions-operator-hash'],
|
||||
['\n* ', 'globalSearch-instructions-operator-user'],
|
||||
['\n* ', 'globalSearch-instructions-operator-at'],
|
||||
['\n* ', 'globalSearch-instructions-operator-member'],
|
||||
['\n* ', 'globalSearch-instructions-operator-assignee'],
|
||||
['\n* ', 'globalSearch-instructions-operator-due'],
|
||||
['\n* ', 'globalSearch-instructions-operator-created'],
|
||||
['\n* ', 'globalSearch-instructions-operator-modified'],
|
||||
['\n* ', 'globalSearch-instructions-operator-status'],
|
||||
['\n * ', 'globalSearch-instructions-status-archived'],
|
||||
['\n * ', 'globalSearch-instructions-status-public'],
|
||||
['\n * ', 'globalSearch-instructions-status-private'],
|
||||
['\n * ', 'globalSearch-instructions-status-all'],
|
||||
['\n * ', 'globalSearch-instructions-status-ended'],
|
||||
['\n* ', 'globalSearch-instructions-operator-has'],
|
||||
['\n* ', 'globalSearch-instructions-operator-sort'],
|
||||
['\n* ', 'globalSearch-instructions-operator-limit'],
|
||||
['\n## ', 'heading-notes'],
|
||||
['\n* ', 'globalSearch-instructions-notes-1'],
|
||||
['\n* ', 'globalSearch-instructions-notes-2'],
|
||||
['\n* ', 'globalSearch-instructions-notes-3'],
|
||||
['\n* ', 'globalSearch-instructions-notes-3-2'],
|
||||
['\n* ', 'globalSearch-instructions-notes-4'],
|
||||
['\n* ', 'globalSearch-instructions-notes-5'],
|
||||
].forEach(([prefix, instruction]) => {
|
||||
text += `${prefix}${TAPi18n.__(instruction, tags)}`;
|
||||
});
|
||||
|
||||
return text;
|
||||
|
|
|
@ -946,7 +946,7 @@
|
|||
"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-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-at": "`__operator_user_abbrev__username` - shorthand for `user:<username>`",
|
||||
"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 => {
|
||||
messages.push({
|
||||
tag: 'label-not-found',
|
||||
value: label,
|
||||
color: Boards.labelColors().includes(label),
|
||||
});
|
||||
if (Boards.labelColors().includes(label)) {
|
||||
messages.push({
|
||||
tag: 'label-color-not-found',
|
||||
value: label,
|
||||
color: true,
|
||||
});
|
||||
} else {
|
||||
messages.push({
|
||||
tag: 'label-not-found',
|
||||
value: label,
|
||||
color: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
this.notFound.users.forEach(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);
|
||||
});
|
||||
|
||||
function findCards(sessionId, selector, projection, errors = null) {
|
||||
function findCards(sessionId, selector, projection, errors = []) {
|
||||
const userId = Meteor.userId();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
|
@ -666,11 +674,12 @@ function findCards(sessionId, selector, projection, errors = null) {
|
|||
cards: [],
|
||||
selector: SessionData.pickle(selector),
|
||||
projection: SessionData.pickle(projection),
|
||||
errors: errors.errorMessages(),
|
||||
},
|
||||
};
|
||||
if (errors) {
|
||||
update.$set.errors = errors.errorMessages();
|
||||
}
|
||||
// if (errors) {
|
||||
// update.$set.errors = errors.errorMessages();
|
||||
// }
|
||||
|
||||
if (cards) {
|
||||
update.$set.totalHits = cards.count();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue