diff --git a/app/assets/javascripts/outfits/edit.js b/app/assets/javascripts/outfits/edit.js index 59243814..dd43e1f6 100644 --- a/app/assets/javascripts/outfits/edit.js +++ b/app/assets/javascripts/outfits/edit.js @@ -1286,6 +1286,26 @@ View.Search = function (wardrobe) { if ($('meta[name=user-signed-in]').attr('content') === 'true') { wrapper.find('li.must-log-in input').removeAttr('disabled'); } + + var speciesNamesById = null; + + function updateCurrentSpeciesName() { + if (speciesNamesById !== null) { + var speciesId = wardrobe.outfits.getPetType().species_id; + var speciesName = speciesNamesById[speciesId]; + $('label[for=advanced-search-species] span').text(speciesName); + } + } + + wardrobe.pet_attributes.bind('update', function(petAttributes) { + speciesNamesById = {}; + petAttributes.species.forEach(function(species) { + speciesNamesById[species.id] = species.name; + }); + updateCurrentSpeciesName(); + }); + + wardrobe.outfits.bind('updatePetType', updateCurrentSpeciesName); } View.PrankColorMessage = function(wardrobe) { diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index 693c9616..7aa19732 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -145,8 +145,7 @@ %input{type: 'checkbox', id: 'advanced-search-species'} %label{for: 'advanced-search-species'} Fits the - -# TODO: update to current species - %span Acara + %span (the current species) %li.checkbox.must-log-in %input{type: 'checkbox', id: 'advanced-search-owns', disabled: true}