mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-08-21 16:14:37 -05:00
search by subtype
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -166,6 +166,14 @@ export default class CollectionHome extends React.Component {
|
||||
baseResultset = baseResultset.find({'gsx$gender': {'$or': genderList} });
|
||||
}
|
||||
|
||||
let subtypesList = stones.subtypes.value.split(/[ ,]+/).filter(Boolean).map((item) => {
|
||||
return ({'$regex': new RegExp(item, 'i')});
|
||||
});
|
||||
console.log(subtypesList);
|
||||
if (subtypesList.length > 0) {
|
||||
baseResultset = baseResultset.find({'gsx$types': {'$or': subtypesList} });
|
||||
}
|
||||
|
||||
// Sort data descending alphabetically
|
||||
let results = baseResultset.simplesort('gsx$name').data();
|
||||
if (results.length > 0) this.content = results;
|
||||
@@ -183,6 +191,8 @@ export default class CollectionHome extends React.Component {
|
||||
<form onSubmit={search}>
|
||||
<label>Card Name:<input type="text" ref={(input) => stones.name = input} /></label>
|
||||
<br /><br />
|
||||
<label>Subtypes:<input type="text" ref={(input) => stones.subtypes = input} /></label>
|
||||
<br /><br />
|
||||
<div>
|
||||
<input type="checkbox" ref={(input) => tribes.danian = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/danian.png"} />
|
||||
<input type="checkbox" ref={(input) => tribes.mipedian = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/mipedian.png"} />
|
||||
|
||||
Reference in New Issue
Block a user