Skip to content

Commit

Permalink
#141 complete
Browse files Browse the repository at this point in the history
collection: player already had something for this I think
so i'll mark as complete
  • Loading branch information
ebshimizu committed Apr 17, 2018
1 parent ecd7922 commit a622dc7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
31 changes: 23 additions & 8 deletions js/filter-popup-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ function initPopup(elem) {
});

//toggles
// elem.find('.filter-widget-hero-team').checkbox();
elem.find('.filter-widget-hero-team').checkbox();

// populate hero menu
addHeroMenuOptions(elem.find('.filter-widget-hero-search'));
elem.find('.filter-widget-hero-search').dropdown({
fullTextSearch: true
});

populateTagMenu(elem.find('.filter-widget-tags'));

Expand Down Expand Up @@ -137,6 +143,7 @@ function getPopupQuery(elem, callback) {
}
}
}
let heroes = elem.find('.filter-widget-hero-search').dropdown('get value').split(',');

// maps
let maps = elem.find('.filter-widget-map').dropdown('get value').split(',');
Expand All @@ -152,8 +159,7 @@ function getPopupQuery(elem, callback) {
let tags = elem.find('.filter-widget-tags').dropdown('get value').split(',');

// toggles;
let widgetHeroOnTeam = false;
//let widgetHeroOnTeam = elem.find('.filter-widget-hero-team').checkbox('is checked');
let widgetHeroOnTeam = elem.find('.filter-widget-hero-team').checkbox('is checked');

for (let p in patches) {
if (patches[p] !== "")
Expand Down Expand Up @@ -189,13 +195,13 @@ function getPopupQuery(elem, callback) {
let hero = Object.assign({}, query);

// heroes
let heroArr = [];
if (types[0] !== "") {
heroArr = []
for (let t in types) {
let heroes = Heroes.heroRole(types[t]);
for (let h in heroes) {
if (heroArr.indexOf(heroes[h]) === -1) {
heroArr.push(heroes[h]);
let heroest = Heroes.heroRole(types[t]);
for (let h in heroest) {
if (heroArr.indexOf(heroest[h]) === -1) {
heroArr.push(heroest[h]);
}
}
}
Expand All @@ -204,6 +210,15 @@ function getPopupQuery(elem, callback) {
map.heroes = { $elemMatch: { $in: heroArr } };
}

if (heroes[0] !== '') {
for (let h of heroes) {
heroArr.push(h);
}

hero.hero = { $in: heroArr };
map.heroes = { $elemMatch: { $in: heroArr } };
}

if (team === '') {
callback({ map, hero });
return;
Expand Down
14 changes: 12 additions & 2 deletions templates/filter-popup-widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,23 @@
</div>
</div>
</div>
<div class="three wide column filter-widget-hero">Hero</div>
<div class="thirteen wide column filter-widget-hero">
<div class="ui fluid multiple search selection dropdown filter-widget-hero-search">
<i class="dropdown icon"></i>
<span class="default text">All Heroes</span>
<div class="menu">

</div>
</div>
</div>
<!-- Waiting to activate this when individual heroes can be selected as filters -->
<!-- <div class="sixteen wide column filter-widget-hero">
<div class="sixteen wide column filter-widget-hero">
<div class="ui toggle checkbox filter-widget-hero-team">
<input type="checkbox" name="search-hero-on-team">
<label>Require Hero On Team</label>
</div>
</div> -->
</div>
<div class="three wide column filter-widget-team">Team</div>
<div class="ten wide column filter-widget-team">
<div class="ui fluid search selection dropdown team-menu filter-widget-team-menu">
Expand Down

0 comments on commit a622dc7

Please sign in to comment.