Skip to content

Commit

Permalink
Merge pull request #183 from sketchysocks/search-by-type
Browse files Browse the repository at this point in the history
Search Pokemon Filter by Type
  • Loading branch information
versx authored Sep 13, 2020
2 parents e1bca0d + 33680da commit 276f7be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ const getData = async (perms, filter) => {
'image': `IV-${andOrString}`,
'filter': filter,
'size': size,
'type': globalFiltersString
'type': globalFiltersString,
'types': null
});
}
}
Expand Down Expand Up @@ -294,7 +295,8 @@ const getData = async (perms, filter) => {
'image': `PVP-${andOrString}`,
'filter': filter,
'size': size,
'type': globalFiltersString
'type': globalFiltersString,
'types': null
});
}
}
Expand All @@ -318,7 +320,8 @@ const getData = async (perms, filter) => {
},
'filter': filter,
'size': size,
'type': globalFiltersString
'type': globalFiltersString,
'types': null
});
}

Expand All @@ -328,6 +331,7 @@ const getData = async (perms, filter) => {
const forms = Object.keys(pkmn.forms);
for (let j = 0; j < forms.length; j++) {
const formId = forms[j];
const types = JSON.stringify(pkmn.types);
//const form = pkmn.forms[formId];
let formName = pkmn.forms[formId].name;//i18n.__('form_' + formId);
if (skipForms.includes(formName.toLowerCase())) {
Expand Down Expand Up @@ -361,7 +365,8 @@ const getData = async (perms, filter) => {
},
'filter': filter,
'size': size,
'type': pokemonTypeString
'type': pokemonTypeString,
'types': types
});
}
}
Expand Down
6 changes: 4 additions & 2 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5591,7 +5591,9 @@ function loadPokemonFilter () {
width: '5%'
},
{ data: 'filter' },
{ data: 'size' }
{ data: 'size' },
{ data: 'types',
visible: false}
],
ajax: {
url: '/api/get_data?show_pokemon_filter=true',
Expand All @@ -5602,7 +5604,7 @@ function loadPokemonFilter () {
order: [[2, 'asc']],
'search.caseInsensitive': true,
columnDefs: [{
targets: [0, 3, 4],
targets: [0, 3, 4, 5],
orderable: false
}, {
type: 'num',
Expand Down

0 comments on commit 276f7be

Please sign in to comment.